diff --git a/.gitignore b/.gitignore index a5461bda..f8b9d412 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ /dist /license /*.egg-info +/REV.txt # /bin/ /bin/sip-* diff --git a/build.py b/build.py index a89b2db7..67f1b5cd 100755 --- a/build.py +++ b/build.py @@ -1482,7 +1482,21 @@ def cmd_bdist(options, args): msg("Binary release built at %s" % tarfilename) + +def cmd_setrev(options, args): + # Grab the current SVN revision number (if possible) and write it to a + # file we'll use later for building the package version number + cmdTimer = CommandTimer('setrev') + assert os.getcwd() == phoenixDir() + + svnrev = getSvnRev() + f = open('REV.txt', 'w') + f.write(svnrev) + f.close() + + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/buildtools/config.py b/buildtools/config.py index d57f0439..99589935 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -95,16 +95,14 @@ class Configuration(object): versionfile = opj(os.path.split(__file__)[0], 'version.py') myExecfile(versionfile, self.__dict__) - # Include the subversion revision in the version number? - if os.environ.get('WXRELEASE') is None: - # TODO: It would be nice to have a better fallback than the date - # if this is not being run in a svn or git-svn environment... - # Perhaps writing the last used valid revision number to a file? - # Or perhaps pull it from the PKG-INFO file in egg-info? - # - # TODO #2: an environment variable is not a good way to control - # this... - self.VER_FLAGS = '-' + getSvnRev() + # Include the subversion revision in the version number? REV.txt can + # be created using the build.py setrev command. If it doesn't exist + # then the version number is built without a revision number. IOW, it + # is a release build. (In theory) + if os.path.exists('REV.txt'): + f = open('REV.txt') + self.VER_FLAGS = '-' + f.read().strip() + f.close() self.VERSION = "%s.%s.%s.%s%s" % (self.VER_MAJOR, self.VER_MINOR,