[pywin32-checkins] pywin32 setup_win32all_core.py,1.13,1.14
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-11-10 23:54:05
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1:/tmp/cvs-serv19994 Modified Files: setup_win32all_core.py Log Message: Try and locate the libraries we need, and elegantly skip building extensions that require libraries that aren't installed, reporting a summary of skipped extensions at the end. Index: setup_win32all_core.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup_win32all_core.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** setup_win32all_core.py 10 Nov 2003 21:24:37 -0000 1.13 --- setup_win32all_core.py 10 Nov 2003 23:54:00 -0000 1.14 *************** *** 146,149 **** --- 146,163 ---- self.libraries.append("stdc++") + def _why_cant_build_extension(self, ext): + # Return None, or a reason it can't be built. + common_dirs = self.compiler.library_dirs + common_dirs += os.environ.get("LIB").split(os.pathsep) + for lib in ext.libraries: + if self.found_libraries.has_key(lib.lower()): + continue + for dir in common_dirs + ext.library_dirs: + if os.path.isfile(os.path.join(dir, lib + ".lib")): + self.found_libraries[lib.lower()] = True + break + else: + return "No library '%s'" % lib + def build_extensions(self): # Is there a better way than this? *************** *** 155,158 **** --- 169,181 ---- self.compiler._cpp_extensions.append(".CPP") self.compiler.src_extensions.append(".CPP") + + # First, sanity-check the 'extensions' list + self.check_extensions_list(self.extensions) + + self.found_libraries = {} + self.excluded_extensions = [] # list of (ext, why) + + # Here we hack a "pywin32" directory into the mix. Distutils + # doesn't seem to like the concept of multiple top-level directories. assert self.package is None for ext in self.extensions: *************** *** 164,167 **** --- 187,204 ---- def build_extension(self, ext): + # It is well known that some of these extensions are difficult to + # build, requiring various hard-to-track libraries etc. So we + # check the extension list for the extra libraries explicitly + # listed. We then search for this library the same way the C + # compiler would - if we can't find a library, we exclude the + # extension from the build. + # Note we can't do this in advance, as some of the .lib files + # we depend on may be built as part of the process - thus we can + # only check an extension's lib files as we are building it. + why = self._why_cant_build_extension(ext) + if why is not None: + self.excluded_extensions.append((ext, why)) + return + # some source files are compiled for different extensions # with special defines. So we cannot use a shared *************** *** 333,337 **** com_extensions = [pythoncom] com_extensions += [ ! ### WinExt_win32com('adsi', libraries="ACTIVEDS ADSIID"), WinExt_win32com('axcontrol'), WinExt_win32com('axscript', --- 370,374 ---- com_extensions = [pythoncom] com_extensions += [ ! WinExt_win32com('adsi', libraries="ACTIVEDS ADSIID"), WinExt_win32com('axcontrol'), WinExt_win32com('axscript', *************** *** 339,357 **** extra_compile_args = ['-DPY_BUILD_AXSCRIPT'], ), ! ### WinExt_win32com('axdebug', ! ### dsp_file=r"com\Active Debugging.dsp", ! ### libraries="axscript msdbg", ! ### ), WinExt_win32com('internet'), ! ### WinExt_win32com('mapi', libraries="mapi32"), ! ### WinExt_win32com_mapi('exchange', ! ### libraries="""MBLOGON ADDRLKUP mapi32 exchinst ! ### EDKCFG EDKUTILS EDKMAPI ! ### ACLCLS version""", ! ### extra_link_args=["/nodefaultlib:libc"]), ! ### WinExt_win32com_mapi('exchdapi', ! ### libraries="""DAPI ADDRLKUP exchinst EDKCFG EDKUTILS ! ### EDKMAPI mapi32 version""", ! ### extra_link_args=["/nodefaultlib:libc"]), WinExt_win32com('shell', libraries='shell32') ] --- 376,394 ---- extra_compile_args = ['-DPY_BUILD_AXSCRIPT'], ), ! WinExt_win32com('axdebug', ! dsp_file=r"com\Active Debugging.dsp", ! libraries="axscript msdbg", ! ), WinExt_win32com('internet'), ! WinExt_win32com('mapi', libraries="mapi32"), ! WinExt_win32com_mapi('exchange', ! libraries="""MBLOGON ADDRLKUP mapi32 exchinst ! EDKCFG EDKUTILS EDKMAPI ! ACLCLS version""", ! extra_link_args=["/nodefaultlib:libc"]), ! WinExt_win32com_mapi('exchdapi', ! libraries="""DAPI ADDRLKUP exchinst EDKCFG EDKUTILS ! EDKMAPI mapi32 version""", ! extra_link_args=["/nodefaultlib:libc"]), WinExt_win32com('shell', libraries='shell32') ] *************** *** 361,365 **** extra_compile_args = ['-DBUILD_PYW']), ! ### WinExt_pythonwin("win32uiole"), WinExt_pythonwin("dde"), ] --- 398,402 ---- extra_compile_args = ['-DBUILD_PYW']), ! WinExt_pythonwin("win32uiole"), WinExt_pythonwin("dde"), ] *************** *** 367,371 **** ################################################################ ! setup(name="pywin32", version="version", description="Python for Window Extensions", --- 404,408 ---- ################################################################ ! dist = setup(name="pywin32", version="version", description="Python for Window Extensions", *************** *** 426,427 **** --- 463,474 ---- ], ) + # If we did any extension building... + if dist.command_obj.has_key('build_ext'): + # Print the list of extension modules we skipped building. + excluded_extensions = dist.command_obj['build_ext'].excluded_extensions + if excluded_extensions: + print "*** NOTE: The following extensions were NOT built:" + for ext, why in excluded_extensions: + print " %s: %s" % (ext.name, why) + else: + print "All extension modules built OK" |