From 5e4f2bfbff6dd934da41da029869c6699ff091bb Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 18 Nov 2010 08:05:50 +0000 Subject: [PATCH] fixes for the build on MSW and other tweaks and cleanup git-svn-id: https://svn.wxwidgets.org/svn/wx/sandbox/trunk/Phoenix@66188 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- buildtools/config.py | 45 +++++++++++++++++++++++++++-------- buildtools/distutils_hacks.py | 13 ++++++---- buildtools/sipdistutils.py | 4 ---- buildtools/version.py | 2 +- 4 files changed, 44 insertions(+), 20 deletions(-) diff --git a/buildtools/config.py b/buildtools/config.py index 25f6c05e..f3a31551 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -8,7 +8,7 @@ # # Created: 3-Nov-2010 # Copyright: (c) 2010 by Total Control Software -# Licence: wxWindows license +# License: wxWindows License #---------------------------------------------------------------------- import sys @@ -25,14 +25,27 @@ from distutils.spawn import spawn runSilently = False +#---------------------------------------------------------------------- +# Set some defaults based on the environment or platform + +if os.environ.get('SIP'): + SIPdefault = os.environ.get('SIP') + +elif os.name == 'nt': + SIPdefault = 'c:/projects/sip/sip/sipgen/sip.exe' + +else: + SIPdefault = '/projects/sip/sip/sipgen/sip' + + #---------------------------------------------------------------------- class Configuration(object): USE_SIP = True - SIP = '/projects/sip/sip/sipgen/sip' + SIP = SIPdefault SIPINC = 'sip/siplib' # Use our local copy of sip.h - SIPGEN = 'sip/gen' # Where the generated .zip files go + SIPGEN = 'sip/gen' # Where the generated .sip files go SIPFILES = 'sip' # where to find other sip files for %Include or %Import SIPOUT = 'sip/cpp' # where to put the generated C++ code @@ -148,14 +161,14 @@ class Configuration(object): self.VCDLL = 'vc_dll' self.includes = ['include', 'src', - opj(WXDIR, 'lib', VCDLL, 'msw' + self.libFlag()), - opj(WXDIR, 'include'), - opj(WXDIR, 'contrib', 'include'), + opj(self.WXDIR, 'lib', self.VCDLL, 'msw' + self.libFlag()), + opj(self.WXDIR, 'include'), + opj(self.WXDIR, 'contrib', 'include'), ] self.defines = [ ('WIN32', None), ('_WINDOWS', None), - (WXPLAT, None), + (self.WXPLAT, None), ('WXUSINGDLL', '1'), ('ISOLATION_AWARE_ENABLED', None), ('NDEBUG',), # using a 1-tuple makes it do an undef @@ -166,9 +179,9 @@ class Configuration(object): if self.MONOLITHIC: self.libs += makeLibName('') else: - self.libs += [ 'wxbase' + WXDLLVER + libFlag(), - 'wxbase' + WXDLLVER + libFlag() + '_net', - 'wxbase' + WXDLLVER + libFlag() + '_xml', + self.libs += [ 'wxbase' + self.WXDLLVER + self.libFlag(), + 'wxbase' + self.WXDLLVER + self.libFlag() + '_net', + 'wxbase' + self.WXDLLVER + self.libFlag() + '_xml', self.makeLibName('core')[0], self.makeLibName('adv')[0], self.makeLibName('html')[0], @@ -502,3 +515,15 @@ def msg(text): def opj(*args): path = os.path.join(*args) return os.path.normpath(path) + +def posixjoin(a, *p): + """Join two or more pathname components, inserting sep as needed""" + path = a + for b in p: + if os.path.isabs(b): + path = b + elif path == '' or path[-1:] in '/\\:': + path = path + b + else: + path = path + '/' + b + return path diff --git a/buildtools/distutils_hacks.py b/buildtools/distutils_hacks.py index 12499570..17c1dfbe 100644 --- a/buildtools/distutils_hacks.py +++ b/buildtools/distutils_hacks.py @@ -7,7 +7,7 @@ # # Created: 3-Nov-2010 # Copyright: (c) 2010 by Total Control Software -# Licence: wxWindows license +# License: wxWindows License #---------------------------------------------------------------------- import sys @@ -19,7 +19,7 @@ import distutils.command.install_headers import distutils.command.clean from distutils.dep_util import newer -from config import Config +from config import Config, posixjoin @@ -324,7 +324,7 @@ class etgsip_build_ext(build_ext): def etg2sip(self, etgfile): cfg = Config() sipfile = os.path.splitext(os.path.basename(etgfile))[0] + '.sip' - sipfile = os.path.join(cfg.SIPGEN, sipfile) + sipfile = posixjoin(cfg.SIPGEN, sipfile) return sipfile @@ -375,12 +375,15 @@ class etgsip_build_ext(build_ext): def _sip_compile(self, sip_bin, source, sbf): + cfg = Config() + if not cfg.USE_SIP: + return + other_opts = [] base = os.path.basename(source) if base.startswith('_'): - cfg = Config() pycode = os.path.splitext(base[1:])[0] + '.py' - pycode = os.path.join(cfg.PKGDIR, pycode) + pycode = posixjoin(cfg.PKGDIR, pycode) other_opts = ['-X', 'pycode:'+pycode] self.spawn([sip_bin] + self.sip_opts + other_opts + diff --git a/buildtools/sipdistutils.py b/buildtools/sipdistutils.py index eaa2adfa..9c4ade00 100644 --- a/buildtools/sipdistutils.py +++ b/buildtools/sipdistutils.py @@ -4,10 +4,6 @@ # Written by Giovanni Bajo # Based on Pyrex.Distutils, written by Graham Fawcett and Darrel Gallion. -# NOTE: This has been tweaked slightly to allow the folder used for the SIP -# output to be overridden in a derived class. It is otherwise the same as the -# module provided by sip. --Robin - import distutils.command.build_ext from distutils.dep_util import newer, newer_group import os diff --git a/buildtools/version.py b/buildtools/version.py index 85f249e9..07037149 100644 --- a/buildtools/version.py +++ b/buildtools/version.py @@ -7,7 +7,7 @@ # # Created: 3-Nov-2010 # Copyright: (c) 2010 by Total Control Software -# Licence: wxWindows license +# License: wxWindows License #----------------------------------------------------------------------