From 6b4601273a69c82a00caf1f2151fb75a26900c2c Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Sat, 30 Mar 2013 04:42:00 +0000 Subject: [PATCH] Include the svn revision in the version numbers. Various other sdist and bdist tweaks and updates. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build.py | 53 +++++++++++++--------- buildtools/config.py | 18 ++++++-- buildtools/version.py | 2 +- packaging/{README.txt => README-bdist.txt} | 38 ++++++---------- packaging/README-sdist.txt | 19 ++++++++ packaging/phoenix_environ.sh | 3 -- 6 files changed, 78 insertions(+), 55 deletions(-) rename packaging/{README.txt => README-bdist.txt} (54%) create mode 100644 packaging/README-sdist.txt delete mode 100644 packaging/phoenix_environ.sh diff --git a/build.py b/build.py index 85376215..3c36d712 100755 --- a/build.py +++ b/build.py @@ -32,7 +32,6 @@ from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip, fi getSvnRev, runcmd, textfile_open, getSipFiles, \ getVisCVersion - import buildtools.version as version # defaults @@ -51,6 +50,9 @@ unstable_series = (version.VER_MINOR % 2) == 1 # is the minor version odd or ev isWindows = sys.platform.startswith('win') isDarwin = sys.platform == "darwin" +baseName = 'wxPython_Phoenix' +eggInfoName = baseName + '.egg-info' + # Some tools will be downloaded for the builds. These are the versions and # MD5s of the tool binaries currently in use. @@ -791,9 +793,9 @@ def cmd_docs_bdist(options, args): cmdTimer = CommandTimer('docs_bdist') pwd = pushDir(phoenixDir()) - svnrev = getSvnRev() + cfg = Config() - rootname = "wxPython-Phoenix-%s-docs" % svnrev + rootname = "%s-%s-docs" % (baseName, cfg.VERSION) tarfilename = "dist/%s.tar.gz" % rootname if not os.path.exists('dist'): @@ -1215,11 +1217,18 @@ def cmd_bdist_wininst(options, args): _doSimpleSetupCmd(options, args, 'bdist_wininst') # bdist_msi requires the version number to be only 3 components, but we're -# using 4. TODO: Fix this? +# using 4. TODO: Can we fix this? #def cmd_bdist_msi(options, args): # _doSimpleSetupCmd(options, args, 'bdist_msi') +def cmd_egg_info(options, args, egg_base=None): + cmdTimer = CommandTimer('egg_info') + VERBOSE = '--verbose' if options.verbose else '' + BASE = '--egg-base '+egg_base if egg_base is not None else '' + cmd = "%s setup.py egg_info %s %s" % (PYTHON, VERBOSE, BASE) + runcmd(cmd) + @@ -1341,10 +1350,12 @@ def cmd_sdist(options, args): cmdTimer = CommandTimer('sdist') assert os.getcwd() == phoenixDir() + cfg = Config() + isGit = os.path.exists('.git') isSvn = os.path.exists('.svn') if not isGit and not isSvn: - msg("Sorry, I don't know what to do in this source tree, no git or svn repos found.") + msg("Sorry, I don't know what to do in this source tree, no git or svn workspace found.") return # make a tree for building up the archive files @@ -1389,16 +1400,14 @@ def cmd_sdist(options, args): # Add some extra stuff to the root folder copyFile('packaging/setup.py', ADEST) - copyFile('packaging/README.rst', ADEST) - cmd = "%s setup.py egg_info --egg-base %s" % (PYTHON, ADEST) - runcmd(cmd) + copyFile('packaging/README-sdist.txt', opj(ADEST, 'README.txt')) + cmd_egg_info(options, args, egg_base=ADEST) copyFile(opj(ADEST, 'wxPython_Phoenix.egg-info/PKG-INFO'), opj(ADEST, 'PKG-INFO')) # build the tarball msg('Archiving Phoenix source...') - svnrev = getSvnRev() - rootname = "wxPython-Phoenix-%s-src" % svnrev + rootname = "%s-%s-src" % (baseName, cfg.VERSION) tarfilename = "dist/%s.tar.gz" % rootname if os.path.exists(tarfilename): os.remove(tarfilename) @@ -1424,20 +1433,18 @@ def cmd_bdist(options, args): cmdTimer = CommandTimer('bdist') assert os.getcwd() == phoenixDir() + cmd_egg_info(options, args) + cfg = Config() + dllext = ".so" - environ_script="packaging/phoenix_environ.sh" - readme = "packaging/README.txt" wxlibdir = os.path.join(getBuildDir(options), "lib") - if sys.platform.startswith('win'): - environ_script = None - elif sys.platform.startswith('darwin'): + if sys.platform.startswith('darwin'): dllext = ".dylib" - svnrev = getSvnRev() platform = sys.platform if isWindows and PYTHON_ARCH == '64bit': platform = 'win64' - rootname = "wxPython-Phoenix-%s-%s-py%s" % (svnrev, platform, PYVER) + rootname = "%s-%s-%s-py%s" % (baseName, cfg.VERSION, platform, PYVER) tarfilename = "dist/%s.tar.gz" % rootname if not os.path.exists('dist'): @@ -1447,8 +1454,12 @@ def cmd_bdist(options, args): os.remove(tarfilename) msg("Archiving Phoenix binaries...") tarball = tarfile.open(name=tarfilename, mode="w:gz") - tarball.add('wx', os.path.join(rootname, 'wx'), - filter=lambda info: None if '.svn' in info.name else info) + tarball.add('wx', opj(rootname, 'wx'), + filter=lambda info: None if '.svn' in info.name \ + or info.name.endswith('.pyc') \ + or '__pycache__' in info.name else info) + tarball.add(eggInfoName, opj(rootname, eggInfoName)) + if not isDarwin and not isWindows and not options.no_magic and not options.use_syswx: # If the DLLs are not already in the wx package folder then go fetch # them now. @@ -1457,9 +1468,7 @@ def cmd_bdist(options, args): for dll in dlls: tarball.add(dll, os.path.join(rootname, 'wx', os.path.basename(dll))) - if environ_script: - tarball.add(environ_script, os.path.join(rootname, os.path.basename(environ_script))) - tarball.add(readme, os.path.join(rootname, os.path.basename(readme))) + tarball.add('packaging/README-bdist.txt', os.path.join(rootname, 'README.txt')) tarball.close() if options.upload_package: diff --git a/buildtools/config.py b/buildtools/config.py index 1109de72..a30d8be9 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -94,16 +94,24 @@ class Configuration(object): # load the version numbers into this instance's namespace versionfile = opj(os.path.split(__file__)[0], 'version.py') myExecfile(versionfile, self.__dict__) - - # If we're doing a dated build then alter the VERSION strings - if os.path.exists('DAILY_BUILD'): - self.VER_FLAGS += '.b' + open('DAILY_BUILD').read().strip() + + # 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() + self.VERSION = "%s.%s.%s.%s%s" % (self.VER_MAJOR, self.VER_MINOR, self.VER_RELEASE, self.VER_SUBREL, self.VER_FLAGS) - + self.WXDLLVER = '%d%d' % (self.VER_MAJOR, self.VER_MINOR) # change the PORT default for wxMac diff --git a/buildtools/version.py b/buildtools/version.py index 156559ee..513b83f1 100644 --- a/buildtools/version.py +++ b/buildtools/version.py @@ -14,5 +14,5 @@ VER_MAJOR = 2 # The first three must match wxWidgets VER_MINOR = 9 VER_RELEASE = 5 -VER_SUBREL = 80 # wxPython release num for x.y.z release of wxWidgets +VER_SUBREL = 81 # wxPython release num for x.y.z release of wxWidgets VER_FLAGS = "" # release flags, such as prerelease or RC num, etc. diff --git a/packaging/README.txt b/packaging/README-bdist.txt similarity index 54% rename from packaging/README.txt rename to packaging/README-bdist.txt index 5980a754..8b202c67 100644 --- a/packaging/README.txt +++ b/packaging/README-bdist.txt @@ -30,7 +30,7 @@ Help Python find Phoenix All the usual suspects apply here. You can simply add this folder to your PYTHONPATH environment variable. Or you can add a phoenix.pth -file to some place already on the sys.path which contains the path to +file to someplace already on the sys.path which contains the path to this folder. Or you can even copy the wx folder into the site-packages folder in your virtualenv. @@ -38,30 +38,20 @@ site-packages folder in your virtualenv. Help Phoenix find wxWidgets --------------------------- -The Phoenix extension modules need to load the dynamic libraries that -contain the wxWidgets code for the platform. For the Windows platform -nothing extra should be needed because the system will automatically -look for the DLLs in the same folder that the extension modules are -located in. +The Phoenix extension modules need to load the dynamic libraries that contain +the wxWidgets code for the platform. In most cases the extension modules in +this snapshot already know to look in the same folder for the wxWidgets +shared libraries. This will work for Windows and Mac, and should also work +for any unix-like system based on ELF binaries, and if the expected objdump +utility was found on the build system. -For Mac OSX there should also not be anything extra needed to help -Phoenix find the wxWidgets dynamic libraries because the install names -have been modified to use @loader_path so they can find the libraries -in the same folder as the extension modules. - -For Unix-like systems like Linux the locations that are searched for -the dynamic libraries can be controlled by setting the LD_LIBRARY_PATH -environment variable. Basically you just need to set that variable to -the path of the wx package, for example if you're in the folder where -this README is located, then you can do something like this:: +For those cases where the build was not able to perform the neccesary magic +required to be able to make and use relocatable shared libraries, you may +need to do a little extra to help wxPython find the wxWidgets libraries. +Check your platform's documentation for details, but it may be as simple as +setting the LD_LIBRARY_PATH variable in the environment. For example if +you're in the folder where this README is located, then you can do something +like this:: export LD_LIBRARY_PATH=`pwd`/wx -The phoenix_environ.sh shell script included with this build can help -you do that, just be sure to use the "source" command so the variables -in the current shell's environment will be modified. - -It is also possible to embed the path that the dynamic library should -be loaded from directly into the extension module. For now at least -this is left as an exercise for the reader. Look for the chrpath -tool. diff --git a/packaging/README-sdist.txt b/packaging/README-sdist.txt new file mode 100644 index 00000000..93db641c --- /dev/null +++ b/packaging/README-sdist.txt @@ -0,0 +1,19 @@ +================ +wxPython Phoenix +================ + + +Introduction +============ + +Phoenix is a new implementation of wxPython focused on improving speed, +maintainability and extensibility. Just like wxPython it wraps the wxWidgets +C++ toolkit and provides access to the UI portions of the wx API, enabling +Python applications to have a GUI on Windows, Macs or Unix systems with a +native look and feel and requiring very little (if any) platform specific code. + + + +More to be written... + + diff --git a/packaging/phoenix_environ.sh b/packaging/phoenix_environ.sh deleted file mode 100644 index 35793418..00000000 --- a/packaging/phoenix_environ.sh +++ /dev/null @@ -1,3 +0,0 @@ -DIR=$(cd $(dirname "$BASH_SOURCE") && pwd) -export PYTHONPATH=$DIR -export LD_LIBRARY_PATH=$DIR/wx