From c604ae96f010a59cb2f2e0a4cbe8ec29d02be6a4 Mon Sep 17 00:00:00 2001 From: Kevin Ollivier Date: Fri, 4 Nov 2011 02:56:42 +0000 Subject: [PATCH] Add bdist build command for putting out a binary distribution (currently Unix only). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69658 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- build.py | 54 ++++++++++++++++++++++++++++++++---- packaging/phoenix_environ.sh | 4 +++ 2 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 packaging/phoenix_environ.sh diff --git a/build.py b/build.py index 902c33a8..743524a0 100755 --- a/build.py +++ b/build.py @@ -5,16 +5,18 @@ # the Python extension mocdules. #--------------------------------------------------------------------------- -import sys +import commands +import glob +import hashlib +import optparse import os import re -import glob import shutil import subprocess -import optparse +import sys +import tarfile import tempfile import urllib2 -import hashlib from distutils.dep_util import newer, newer_group from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip, findCmd @@ -66,6 +68,8 @@ Usage: ./build.py [command(s)] [options] build_py Build wxPython only build Build both wxWidgets and wxPython + bdist Create a binary release of wxPython Phoenix + clean_wx Clean the wx parts of the build clean_py Clean the wxPython parts of the build clean Clean both wx and wxPython @@ -104,7 +108,7 @@ def main(args): if cmd.startswith('test_'): testOne(cmd, options, args) elif cmd in ['dox', 'doxhtml', 'etg', 'sip', 'touch', 'test', - 'build_wx', 'build_py', 'build', + 'build_wx', 'build_py', 'build', 'bdist', 'clean', 'clean_wx', 'clean_py', 'cleanall']: function = globals()[cmd] function(options, args) @@ -832,8 +836,46 @@ def sdist(options, args): def bdist(options, args): # Build a tarball and/or installer that includes all the files needed at # runtime for the current platform and the current version of Python. - pass + + dllext = ".so" + environ_script="packaging/phoenix_environ.sh" + wxlibdir = os.path.join(getBuildDir(options), "lib") + if sys.platform.startswith('win'): + dllext = ".dll" + wxlibdir = os.path.join(wxlibdir, "vc_dll") + #environ_script="packaging/phoenix_environ.bat" + elif sys.platform.startswith('darwin'): + dllext = ".dylib" + + dlls = glob.glob(os.path.join(wxlibdir, "*%s" % dllext)) + + svnrev = None + try: + svnrev = "r" + commands.getoutput('svnversion').split(':')[0] + except: + #TODO: if this fails, append the date built instead + raise + + rootname = "wxPython-Phoenix-%s" % svnrev + tarfilename = "dist/%s.tar.gz" % rootname + if not os.path.exists('dist'): + os.makedirs('dist') + + if os.path.exists(tarfilename): + os.remove(tarfilename) + print "Archiving Phoenix bindings..." + tarball = tarfile.open(name=tarfilename, mode="w:gz") + tarball.add('wx', os.path.join(rootname, 'wx')) + print "Archiving wxWidgets dlls..." + for dll in dlls: + tarball.add(dll, os.path.join(rootname, 'wx', os.path.basename(dll))) + tarball.add(environ_script, os.path.join(rootname, os.path.basename(environ_script))) + tarball.close() + + print "Relase built at %s" % tarfilename + + #--------------------------------------------------------------------------- if __name__ == '__main__': diff --git a/packaging/phoenix_environ.sh b/packaging/phoenix_environ.sh new file mode 100644 index 00000000..af644c88 --- /dev/null +++ b/packaging/phoenix_environ.sh @@ -0,0 +1,4 @@ +DIR=$(cd $(dirname "$BASH_SOURCE") && pwd) +export PYTHONPATH=$DIR +export DYLD_LIBRARY_PATH=$DIR/wx +export LD_LIBRARY_PATH=$DIR/wx