Instead of fetching the svn revision every time a Config object is created add a command to fetch it on demand and cache the value for later use.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2013-04-10 00:05:30 +00:00
parent e5eefd8625
commit ebdfcfe2db
3 changed files with 23 additions and 10 deletions

1
.gitignore vendored
View File

@@ -17,6 +17,7 @@
/dist
/license
/*.egg-info
/REV.txt
# /bin/
/bin/sip-*

View File

@@ -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__':

View File

@@ -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,