[pywin32-checkins] /hgrepo/p/py/pywin32/pywin32: 2 new changesets
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <pyw...@li...> - 2011-04-14 04:56:08
|
changeset bd629535294b in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=bd629535294b summary: force SWIG generated wrappers to be rebuilt if any SWIG .i files changed changeset cdbcf976e498 in /hgrepo/p/py/pywin32/pywin32 details: http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/hgrepo/p/py/pywin32/pywin32?cmd=changeset;node=cdbcf976e498 summary: fix DWORD handling of 32bit longs with the MSB set diffstat: CHANGES.txt | 3 +++ SWIG/swig_lib/python/pywintypes.i | 10 ++++++++++ setup.py | 18 ++++++++++++++---- 3 files changed, 27 insertions(+), 4 deletions(-) diffs (82 lines): diff -r 945ffb215e08 -r cdbcf976e498 CHANGES.txt --- a/CHANGES.txt Mon Apr 11 14:26:48 2011 +1000 +++ b/CHANGES.txt Thu Apr 14 14:54:45 2011 +1000 @@ -11,6 +11,9 @@ could have returned trailing garbage after an embedded NULL character. (bug 3277647) +* Some functions which accepted a DWORD did not accept long integers which + fit in 32bits with the most signficant bit set (eg, 0x80000000). + * Source-code management moved from CVS to Mercurual. Since build 215: diff -r 945ffb215e08 -r cdbcf976e498 SWIG/swig_lib/python/pywintypes.i --- a/SWIG/swig_lib/python/pywintypes.i Mon Apr 11 14:26:48 2011 +1000 +++ b/SWIG/swig_lib/python/pywintypes.i Thu Apr 14 14:54:45 2011 +1000 @@ -44,6 +44,16 @@ #include "tchar.h" %} +// DWORDs can use longs so long as they fit in 32 unsigned bits +%typemap(python,in) DWORD { + // PyLong_AsUnsignedLongMask isn't ideal - no overflow checking - but + // this is what the 'k' format specifier in PyArg_ParseTuple uses, and + // that is what much of pywin32 uses for DWORDS, so we use it here too + $target = PyLong_AsUnsignedLongMask($source); + if ($target==(DWORD)-1 && PyErr_Occurred()) + return NULL; +} + // Override the SWIG default for this. %typemap(python,out) PyObject *{ if ($source==NULL) return NULL; // get out now! diff -r 945ffb215e08 -r cdbcf976e498 setup.py --- a/setup.py Mon Apr 11 14:26:48 2011 +1000 +++ b/setup.py Thu Apr 14 14:54:45 2011 +1000 @@ -1196,6 +1196,17 @@ ext.finalize_options(self) + # ensure the SWIG .i files are treated as dependencies. + for source in ext.sources: + if source.endswith(".i"): + self.find_swig() # for the side-effect of the environment value. + # Find the swig_lib .i files we care about for dependency tracking. + ext.swig_deps = glob.glob(os.path.join(os.environ["SWIG_LIB"], "python", "*.i")) + ext.depends.extend(ext.swig_deps) + break + else: + ext.swig_deps = None + # some source files are compiled for different extensions # with special defines. So we cannot use a shared # directory for objects, we must use a special one for each extension. @@ -1311,8 +1322,8 @@ # to the temp dir... target_ext = '.cpp' for source in sources: - (base, ext) = os.path.splitext(source) - if ext == ".i": # SWIG interface file + (base, sext) = os.path.splitext(source) + if sext == ".i": # SWIG interface file if os.path.split(base)[1] in swig_include_files: continue swig_sources.append(source) @@ -1340,7 +1351,6 @@ return new_sources swig = self.find_swig() - for source in swig_sources: swig_cmd = [swig, "-python", "-c++"] swig_cmd.append("-dnone",) # we never use the .doc files. @@ -1372,7 +1382,7 @@ # This could probably go once we generate .cpp into the temp dir. fqsource = os.path.abspath(source) fqtarget = os.path.abspath(target) - rebuild = self.force or newer(fqsource, fqtarget) + rebuild = self.force or newer_group(ext.swig_deps + [fqsource], fqtarget) log.debug("should swig %s->%s=%s", source, target, rebuild) if rebuild: swig_cmd.extend(["-o", fqtarget, fqsource]) |