thezbyg / gpick

Advanced color picker written in C++ using GTK+ toolkit
BSD 3-Clause "New" or "Revised" License
376 stars 33 forks source link

scons looks for .version file in parent directory #215

Closed ryandesign closed 1 year ago

ryandesign commented 1 year ago

I downloaded the gpick 0.3 release tarball and ran scons in it and it failed:

scons: Reading SConscript files ...
Version file ".version" is required when GIT can not be used to get version information.

The .version file exists. It appears to be looking for the .version file one directory up from where it is for some reason:

https://github.com/thezbyg/gpick/blob/a8bc29c60d57933d9e8e8cb930d8e06586e0d315/tools/gpick.py#L164

This seems to fix it—at least it gets past this error and on to another one:

Fix path to .version file.
--- tools/gpick.py.orig 2023-05-25 11:30:17.000000000 -0500
+++ tools/gpick.py  2023-05-25 11:40:55.000000000 -0500
@@ -163,3 +163,3 @@
            try:
-               with open("../.version", "r", encoding = 'utf-8') as version_file:
+               with open(".version", "r", encoding = 'utf-8') as version_file:
                    (version, revision, hash, date) = version_file.read().splitlines()
thezbyg commented 1 year ago

When build/ directory exists, SCons executes SConscript script with current directory set to build/, but current directory is not changed when this directory does not exist and ../.version path becomes incorrect.

Should be fixed now. Apply the following change to 0.3 release:

--- tools/gpick.py
+++ tools/gpick.py
@@ -159,1 +159,1 @@
-               with open("../.version", "r", encoding = 'utf-8') as version_file:
+               with open(self.File('#.version').abspath, "r", encoding = 'utf-8') as version_file:
ryandesign commented 1 year ago

Thanks! That works.