Thread: [pywin32-checkins] pywin32 setup_win32all.py,1.2,1.3
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-12-02 23:07:04
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1:/tmp/cvs-serv19321 Modified Files: setup_win32all.py Log Message: Allow an extension to nominate the minimum WINDOWS.H version they need. Win2kras in particular needs a platform SDK version (the MSVC6 version one fails) Index: setup_win32all.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup_win32all.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setup_win32all.py 2 Dec 2003 12:33:25 -0000 1.2 --- setup_win32all.py 2 Dec 2003 23:06:59 -0000 1.3 *************** *** 75,79 **** export_symbol_file=None, dsp_file=None, ! pch_header=None ): assert dsp_file or sources, "Either dsp_file or sources must be specified" --- 75,80 ---- export_symbol_file=None, dsp_file=None, ! pch_header=None, ! windows_h_version=None, # min version of windows.h needed. ): assert dsp_file or sources, "Either dsp_file or sources must be specified" *************** *** 92,95 **** --- 93,97 ---- self.pch_header = pch_header + self.windows_h_version = windows_h_version Extension.__init__ (self, name, sources, include_dirs, *************** *** 183,186 **** --- 185,189 ---- def finalize_options(self): build_ext.finalize_options(self) + self.windows_h_version = None # The pywintypes library is created in the build_temp # directory, so we need to add this to library_dirs *************** *** 192,195 **** --- 195,224 ---- def _why_cant_build_extension(self, ext): # Return None, or a reason it can't be built. + if self.windows_h_version is None: + include_dirs = self.compiler.include_dirs + \ + os.environ.get("INCLUDE").split(os.pathsep) + for d in include_dirs: + look = os.path.join(d, "WINDOWS.H") + if os.path.isfile(look): + # read the fist 100 lines, looking for #define WINVER 0xNN + reob = re.compile("#define\WWINVER\W(0x[0-9a-fA-F]+)") + f = open(look, "r") + for i in range(100): + line = f.readline() + match = reob.match(line) + if match is not None: + self.windows_h_version = int(match.group(1), 16) + log.info("Found WINDOWS.H version 0x%x in %s" \ + % (self.windows_h_version, d)) + break + if self.windows_h_version is not None: + break + else: + raise RuntimeError, "Can't find a version in Windows.h" + if ext.windows_h_version > self.windows_h_version: + return "WINDOWS.H with version 0x%x is required, but only " \ + "version 0x%x is installed." \ + % (ext.windows_h_version, self.windows_h_version) + common_dirs = self.compiler.library_dirs common_dirs += os.environ.get("LIB").split(os.pathsep) *************** *** 541,545 **** ) ! for name, lib_names, is_unicode in ( ("dbi", "", False), ("mmapfile", "", False), --- 570,574 ---- ) ! for info in ( ("dbi", "", False), ("mmapfile", "", False), *************** *** 547,551 **** ("perfmon", "", True), ("timer", "user32", False), ! ("win2kras", "rasapi32", False), ("win32api", "user32 advapi32 shell32 version", False), ("win32file", "oleaut32", False), --- 576,580 ---- ("perfmon", "", True), ("timer", "user32", False), ! ("win2kras", "rasapi32", False, 0x0500), ("win32api", "user32 advapi32 shell32 version", False), ("win32file", "oleaut32", False), *************** *** 569,572 **** --- 598,606 ---- ): + name, lib_names, is_unicode = info[:3] + if len(info)>3: + windows_h_ver = info[3] + else: + windows_h_ver = None extra_compile_args = [] if is_unicode: *************** *** 574,578 **** ext = WinExt_win32(name, libraries=lib_names, ! extra_compile_args = extra_compile_args) win32_extensions.append(ext) --- 608,613 ---- ext = WinExt_win32(name, libraries=lib_names, ! extra_compile_args = extra_compile_args, ! windows_h_version = windows_h_ver) win32_extensions.append(ext) *************** *** 722,726 **** if not str(details).startswith("No file"): raise ! print 'NOTE: Optional file %s not found - skipping' % file else: ret.append(temp[0]) --- 757,761 ---- if not str(details).startswith("No file"): raise ! log.info('NOTE: Optional file %s not found - skipping' % file) else: ret.append(temp[0]) |