Thread: [pywin32-checkins] pywin32 setup_win32all.py,1.10,1.11
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@pr...> - 2004-01-26 04:08:06
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31528 Modified Files: setup_win32all.py Log Message: Get things building with Python 2.2 Index: setup_win32all.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup_win32all.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** setup_win32all.py 22 Jan 2004 04:53:37 -0000 1.10 --- setup_win32all.py 26 Jan 2004 04:07:18 -0000 1.11 *************** *** 43,47 **** from distutils.command.install_data import install_data from distutils.dep_util import newer_group - from distutils import log from distutils import dir_util, file_util from distutils.sysconfig import get_python_lib --- 43,46 ---- *************** *** 58,61 **** --- 57,70 ---- True=0==0 False=1==0 + # nor distutils.log + try: + from distutils import log + except ImportError: + class Log: + def debug(self, msg, *args): + print msg % args + def info(self, msg, *args): + print msg % args + log = Log() try: *************** *** 243,246 **** --- 252,263 ---- if self.mingw32: self.libraries.append("stdc++") + # Python 2.2 distutils doesn't handle the 'PC'/PCBuild directory for + # us (it only exists if building from the source tree) + extra = os.path.join(sys.exec_prefix, 'PC') + if extra not in self.include_dirs and os.path.isdir(extra): + self.include_dirs.append(extra) + extra = os.path.join(sys.exec_prefix, 'PCBuild') + if extra not in self.library_dirs and os.path.isdir(extra): + self.library_dirs.append(os.path.join(extra)) def _why_cant_build_extension(self, ext): *************** *** 385,388 **** --- 402,407 ---- ext_filename = os.path.join(self.build_lib, self.get_ext_filename(fullname)) + if not hasattr(ext, "depends"): + ext.depends = [] # 2.2 doesn't have this depends = sources + ext.depends if not (self.force or newer_group(depends, ext_filename, 'newer')): *************** *** 416,427 **** for undef in ext.undef_macros: macros.append((undef,)) ! ! objects = self.compiler.compile(sources, ! output_dir=self.build_temp, ! macros=macros, ! include_dirs=ext.include_dirs, ! debug=self.debug, ! extra_postargs=extra_args, ! depends=ext.depends) # XXX -- this is a Vile HACK! --- 435,448 ---- for undef in ext.undef_macros: macros.append((undef,)) ! # 2.2 has no 'depends' param. ! kw = {'output_dir': self.build_temp, ! 'macros': macros, ! 'include_dirs': ext.include_dirs, ! 'debug': self.debug, ! 'extra_postargs': extra_args ! } ! if sys.version_info > (2,3): ! kw["depends"] = ext.depends ! objects = self.compiler.compile(sources, **kw) # XXX -- this is a Vile HACK! *************** *** 443,459 **** extra_args = ext.extra_link_args or [] ! # Detect target language, if not provided ! language = ext.language or self.compiler.detect_language(sources) self.compiler.link( "executable", ! objects, ext_filename, ! libraries=self.get_libraries(ext), ! library_dirs=ext.library_dirs, ! runtime_library_dirs=ext.runtime_library_dirs, ! extra_postargs=extra_args, ! debug=self.debug, ! build_temp=self.build_temp, ! target_lang=language) def build_extension(self, ext): --- 464,483 ---- extra_args = ext.extra_link_args or [] ! # 2.2 has no 'language' support ! kw = { 'libraries': self.get_libraries(ext), ! 'library_dirs': ext.library_dirs, ! 'runtime_library_dirs': ext.runtime_library_dirs, ! 'extra_postargs': extra_args, ! 'debug': self.debug, ! 'build_temp': self.build_temp, ! } ! if sys.version_info > (2,3): ! # Detect target language, if not provided ! language = ext.language or self.compiler.detect_language(sources) ! kw["target_lang"] = language self.compiler.link( "executable", ! objects, ext_filename, **kw) def build_extension(self, ext): *************** *** 475,478 **** --- 499,504 ---- ext.extra_compile_args = ext.extra_compile_args or [] ext.extra_compile_args.append("/YX"+ext.pch_header) + pch_name = os.path.join(self.build_temp, ext.name) + ".pch" + ext.extra_compile_args.append("/Fp"+pch_name) # some source files are compiled for different extensions *************** *** 480,487 **** # directory for objects, we must use a special one for each extension. old_build_temp = self.build_temp self.swig_cpp = True try: build_ext.build_extension(self, ext) - # XXX This has to be changed for mingw32 extra = self.debug and "_d.lib" or ".lib" --- 506,515 ---- # directory for objects, we must use a special one for each extension. old_build_temp = self.build_temp + if sys.version_info < (2,3): + # 2.3+ - Wrong dir, numbered name + self.build_temp = os.path.join(self.build_temp, ext.name) self.swig_cpp = True try: build_ext.build_extension(self, ext) # XXX This has to be changed for mingw32 extra = self.debug and "_d.lib" or ".lib" *************** *** 493,506 **** else: name1 = name2 = ext.name + extra ! # MSVCCompiler constructs the .lib file in the same directory ! # as the first source file's object file: # os.path.dirname(objects[0]) ! # but we want it in the (old) build_temp directory ! src = os.path.join(self.build_temp, os.path.dirname(ext.sources[0]), name1) dst = os.path.join(old_build_temp, name2) ! self.copy_file(src, dst)#, update=1) ! finally: self.build_temp = old_build_temp --- 521,541 ---- else: name1 = name2 = ext.name + extra ! # The compiler always creates 'pywintypes22.lib', whereas we ! # actually want 'pywintypes.lib' - copy it over. ! # Worse: 2.3+ MSVCCompiler constructs the .lib file in the same ! # directory as the first source file's object file: # os.path.dirname(objects[0]) ! # rather than in the self.build_temp directory ! if sys.version_info > (2,3): ! # 2.3+ - Wrong dir, numbered name ! src = os.path.join(old_build_temp, os.path.dirname(ext.sources[0]), name1) + else: + # 2.2 it is in the right dir, just with the 'numbered' named. + src = os.path.join(self.build_temp, name1) dst = os.path.join(old_build_temp, name2) ! if os.path.abspath(src) != os.path.abspath(dst): ! self.copy_file(src, dst)#, update=1) finally: self.build_temp = old_build_temp *************** *** 831,838 **** print "Standard usage information follows:" dist = setup(name="pywin32", ! version="version", description="Python for Window Extensions", ! long_description="", author="Mark Hammond (et al)", author_email = "mha...@us...", --- 866,915 ---- print "Standard usage information follows:" + packages=['win32com', + 'win32com.client', + 'win32com.demos', + 'win32com.makegw', + 'win32com.server', + 'win32com.servers', + 'win32com.test', + + 'win32comext.axscript', + 'win32comext.axscript.client', + 'win32comext.axscript.server', + + 'win32comext.axdebug', + + 'win32comext.shell', + 'win32comext.mapi', + 'win32comext.internet', + 'win32comext.axcontrol', + + 'Pythonwin.pywin', + 'Pythonwin.pywin.debugger', + 'Pythonwin.pywin.dialogs', + 'Pythonwin.pywin.docking', + 'Pythonwin.pywin.framework', + 'Pythonwin.pywin.framework.editor', + 'Pythonwin.pywin.framework.editor.color', + 'Pythonwin.pywin.idle', + 'Pythonwin.pywin.mfc', + 'Pythonwin.pywin.scintilla', + 'Pythonwin.pywin.tools', + ] + + # Python 2.2 distutils can't handle py_modules *and* packages, + # but putting 'win32.lib' as a package whinges there is no __init__ + if sys.version_info < (2,3): + packages.append('win32.lib') + py_modules = None + else: + py_modules = expand_modules("win32\\lib") + dist = setup(name="pywin32", ! version="200", description="Python for Window Extensions", ! long_description="Includes access to much of the Win32 API, the " ! "ability to create and use COM objects, and the " ! "Pythonwin environment", author="Mark Hammond (et al)", author_email = "mha...@us...", *************** *** 852,888 **** "win32comext": "com/win32comext", "Pythonwin": "Pythonwin"}, ! packages=['win32com', ! 'win32com.client', ! 'win32com.demos', ! 'win32com.makegw', ! 'win32com.server', ! 'win32com.servers', ! 'win32com.test', ! ! 'win32comext.axscript', ! 'win32comext.axscript.client', ! 'win32comext.axscript.server', ! ! 'win32comext.axdebug', ! ! 'win32comext.shell', ! 'win32comext.mapi', ! 'win32comext.internet', ! 'win32comext.axcontrol', ! ! 'Pythonwin.pywin', ! 'Pythonwin.pywin.debugger', ! 'Pythonwin.pywin.dialogs', ! 'Pythonwin.pywin.docking', ! 'Pythonwin.pywin.framework', ! 'Pythonwin.pywin.framework.editor', ! 'Pythonwin.pywin.framework.editor.color', ! 'Pythonwin.pywin.idle', ! 'Pythonwin.pywin.mfc', ! 'Pythonwin.pywin.scintilla', ! 'Pythonwin.pywin.tools', ! ], ! ! py_modules = expand_modules("win32\\lib"), data_files=convert_optional_data_files([ --- 929,934 ---- "win32comext": "com/win32comext", "Pythonwin": "Pythonwin"}, ! packages = packages, ! py_modules = py_modules, data_files=convert_optional_data_files([ |