From 541c4882dac0f3830982e545ee0d4b533062ddad Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 27 Sep 2017 17:24:47 -0700 Subject: [PATCH] Add an item to wx.PlatformInfo and wx.__version__ indicating build type: Development, snapshot or release --- build.py | 3 +++ buildtools/config.py | 10 +++++++++- demo/version.py | 2 +- src/core_ex.py | 3 +++ wscript | 9 +++++---- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/build.py b/build.py index 923bdc26..5af912f2 100755 --- a/build.py +++ b/build.py @@ -1368,6 +1368,9 @@ def cmd_build_py(options, args): BUILD_DIR = getBuildDir(options) + if options.release: + os.environ['WXPYTHON_RELEASE'] = 'yes' + if not isWindows: WX_CONFIG = posixjoin(BUILD_DIR, 'wx-config') if options.use_syswx: diff --git a/buildtools/config.py b/buildtools/config.py index c4acfc85..4fe5fdba 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -337,8 +337,16 @@ class Configuration(object): # is a release build. (In theory) if os.path.exists('REV.txt'): f = open('REV.txt') - self.VER_FLAGS += f.read().strip() + txt = f.read().strip() + self.VER_FLAGS += txt + if txt[0] == '.': + txt = txt[1:] + self.BUILD_TYPE = txt f.close() + elif os.environ.get('WXPYTHON_RELEASE') == 'yes': + self.BUILD_TYPE = "release" + else: + self.BUILD_TYPE = "devel" self.VERSION = "%s.%s.%s%s" % (self.VER_MAJOR, self.VER_MINOR, diff --git a/demo/version.py b/demo/version.py index 143a48f0..3e9a6e5f 100644 --- a/demo/version.py +++ b/demo/version.py @@ -1,3 +1,3 @@ -# This file was generated by Phoenix's wscript. +# This file was generated by wxPython's wscript. VERSION_STRING = '4.0.0rc1' diff --git a/src/core_ex.py b/src/core_ex.py index 494c9dfe..c7b203b2 100644 --- a/src/core_ex.py +++ b/src/core_ex.py @@ -6,6 +6,9 @@ if 'wxEVT_NULL' in dir(): import wx._core __version__ = VERSION_STRING + # Add the build type to PlatformInfo + PlatformInfo = PlatformInfo + ('build-type: ' + BUILD_TYPE, ) + # Register a function to be called when Python terminates that will clean # up and release all system resources that wxWidgets allocated. import atexit diff --git a/wscript b/wscript index 7954f1d2..192c1b2b 100644 --- a/wscript +++ b/wscript @@ -34,7 +34,7 @@ def options(opt): opt.load('python') opt.add_option('--debug', dest='debug', action='store_true', default=False, - help='Turn on debug compile options.') + help='Turn on debugger-related compile options.') opt.add_option('--python', dest='python', default='', action='store', help='Full path to the Python executable to use.') opt.add_option('--wx_config', dest='wx_config', default='wx-config', action='store', @@ -482,16 +482,17 @@ def build(bld): # create the package's __version__ module open(opj(cfg.PKGDIR, '__version__.py'), 'w').write( - "# This file was generated by Phoenix's wscript.\n\n" + "# This file was generated by wxPython's wscript.\n\n" "VERSION_STRING = '%(VERSION)s'\n" "MAJOR_VERSION = %(VER_MAJOR)s\n" "MINOR_VERSION = %(VER_MINOR)s\n" - "RELEASE_NUMBER = %(VER_RELEASE)s\n\n" + "RELEASE_NUMBER = %(VER_RELEASE)s\n" + "BUILD_TYPE = '%(BUILD_TYPE)s'\n\n" "VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_NUMBER, '%(VER_FLAGS)s')\n" % cfg.__dict__) # and one for the demo folder too open('demo/version.py', 'w').write( - "# This file was generated by Phoenix's wscript.\n\n" + "# This file was generated by wxPython's wscript.\n\n" "VERSION_STRING = '%(VERSION)s'\n" % cfg.__dict__)