From 47bea6772b59261e7b69955c1d903e8a52f318e1 Mon Sep 17 00:00:00 2001 From: Tim Stahlhut Date: Wed, 8 Jun 2022 23:53:30 -0400 Subject: Revert some of sip via python changes --- build.py | 51 ++++++++++++++++++++++---------------------- buildtools/config.py | 4 ++-- sip/siplib/sip.h | 3 +++ wscript | 7 ++++++ 4 files changed, 38 insertions(+), 27 deletions(-) diff --git a/build.py b/build.py index b0c8f122..32891945 100755 --- a/build.py +++ b/build.py @@ -46,7 +46,6 @@ from buildtools.config import Config, msg, opj, posixjoin, loadETG, etg2sip, fi getVcsRev, runcmd, textfile_open, getSipFiles, \ getVisCVersion, getToolsPlatformName, updateLicenseFiles, \ TemporaryDirectory, getMSVCInfo -from buildtools.wxpysip import sip_runner import buildtools.version as version @@ -89,6 +88,14 @@ wxICON = 'packaging/docset/mondrian.png' # Some tools will be downloaded for the builds. These are the versions and # MD5s of the tool binaries currently in use. +sipCurrentVersion = '4.19.24' +sipMD5 = { + 'darwin' : '2a22cb7a35eb14384b0829593a366c29', + 'win32' : '49e0aa36397d7629fea95418452961fb', + 'linux32' : 'ea773f6fd92d5f23530730428a86df2f', + 'linux64' : 'b44a45191f5f84db10e2ba1c4cecd8ff', +} + wafCurrentVersion = '2.0.22' wafMD5 = 'f2e5880ba4ecd06f7991181bdba1138b' @@ -629,6 +636,15 @@ def getTool(cmdName, version, MD5, envVar, platformBinary, linuxBits=False): # The download and MD5 check only needs to happen once per run, cache the sip # cmd value here the first time through. +_sipCmd = None +def getSipCmd(): + global _sipCmd + if _sipCmd is None: + _sipCmd = getTool('sip', sipCurrentVersion, sipMD5, 'SIP', True, True) + return _sipCmd + + +# Same thing for WAF _wafCmd = None def getWafCmd(): global _wafCmd @@ -1265,30 +1281,15 @@ def cmd_sip(options, args): if not newer_group(sipFiles, sbf) and os.path.exists(pycode): continue - # Leave it turned off for now. TODO: Experiment with this... - # pyi_extract = posixjoin(cfg.PKGDIR, base[1:]) + '.pyi' - pyi_extract = None - - # SIP extracts are used to pull python snippets and put them into the - # module's .py file - pycode = 'pycode'+base+':'+pycode - - sip_runner(src_name, - abi_version = cfg.SIP_ABI, # siplib abi version - warnings = True, # enable warning messages - docstrings = True, # enable the automatic generation of docstrings - release_gil = True, # always release and reacquire the GIL - sip_module = 'wx.siplib', # the fully qualified name of the sip module - sbf_file=sbf, # File to write the generated file lists to - exceptions = False, # enable support for exceptions - tracing = cfg.SIP_TRACE, # generate code with tracing enabled - sources_dir = tmpdir, # the name of the code directory - extracts = [pycode], # add to the list of extracts to generate - pyi_extract=pyi_extract, # the name of the .pyi stub file - include_dirs = [ - os.path.join(phoenixDir(), 'src'), - os.path.join(phoenixDir(), 'sip', 'gen'), - ]) + # leave this turned off for now... + # typehint = '-y {}'.format(posixjoin(cfg.PKGDIR, base[1:]) + '.pyi') + typehint = '' + + pycode = '-X pycode'+base+':'+pycode + sip = getSipCmd() + cmd = '%s %s -c %s -b %s %s %s %s' % \ + (sip, cfg.SIPOPTS, tmpdir, sbf, pycode, typehint, src_name) + runcmd(cmd) classesNeedingClassInfo = { 'sip_corewxTreeCtrl.cpp' : 'wxTreeCtrl', } diff --git a/buildtools/config.py b/buildtools/config.py index 4482ba9d..bc46412a 100644 --- a/buildtools/config.py +++ b/buildtools/config.py @@ -27,8 +27,6 @@ from distutils.dep_util import newer import distutils.sysconfig -from attrdict import AttrDict - runSilently = False #---------------------------------------------------------------------- @@ -174,6 +172,8 @@ class Configuration(object): ('WXUSINGDLL', '1'), ('ISOLATION_AWARE_ENABLED', None), #('NDEBUG',), # using a 1-tuple makes it do an undef + ('SIP_MODULE_NAME', 'wx.siplib'), + ('SIP_MODULE_BASENAME', 'siplib'), ] if int(getVisCVersion()) > 100: self.defines += [ ('wxUSE_RC_MANIFEST', '1'), diff --git a/sip/siplib/sip.h b/sip/siplib/sip.h index 5f0f0591..449a4e8a 100644 --- a/sip/siplib/sip.h +++ b/sip/siplib/sip.h @@ -109,6 +109,9 @@ typedef unsigned int uint; #endif +/* Remove in v5.0. */ +#define SIP_MLNAME_CAST(s) ((char *)(s)) +#define SIP_MLDOC_CAST(s) ((char *)(s)) /* Remove in v5.1. */ #define SIP_SSIZE_T Py_ssize_t diff --git a/wscript b/wscript index 4f0d0bf5..9ec28673 100644 --- a/wscript +++ b/wscript @@ -302,6 +302,13 @@ def configure(conf): conf.env.CFLAGS_WXPY.append('-UNDEBUG') conf.env.CXXFLAGS_WXPY.append('-UNDEBUG') + # set the name of our siplib module + conf.env.CFLAGS_WXPY.append('-DSIP_MODULE_NAME=wx.siplib') + conf.env.CXXFLAGS_WXPY.append('-DSIP_MODULE_NAME=wx.siplib') + + conf.env.CFLAGS_WXPY.append('-DSIP_MODULE_BASENAME=siplib') + conf.env.CXXFLAGS_WXPY.append('-DSIP_MODULE_BASENAME=siplib') + # Add basic debug info for all builds conf.env.CFLAGS_WXPY.append('-g') conf.env.CXXFLAGS_WXPY.append('-g') --