[pywin32-checkins] pywin32 setup.py,1.64,1.65
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-02-07 05:43:09
|
Update of /cvsroot/pywin32/pywin32 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21814 Modified Files: setup.py Log Message: More adventures making things build with Vista SDKs and vc2008, plus changes for recent shell and propdesc changes. Index: setup.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/setup.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** setup.py 8 Jan 2008 00:41:03 -0000 1.64 --- setup.py 7 Feb 2008 05:43:13 -0000 1.65 *************** *** 1,3 **** ! build_id="210.5" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) --- 1,3 ---- ! build_id="210.9" # may optionally include a ".{patchno}" suffix. # Putting buildno at the top prevents automatic __doc__ assignment, and # I *want* the build number at the top :) *************** *** 49,57 **** To build 64bit versions of this: ! * Using VS2003 - these instructions are for cross-compiling on a 32bit ! environment. You must install the platform SDK with 64bit versions of ! the tools, then setup your environment with a command similar to: ! {sdk_dir}\SetEnv.Cmd /X64 /RETAIL then: --- 49,58 ---- To build 64bit versions of this: ! * py2.5 and earlier, using VS2003 and earlier: ! These instructions are for cross-compiling on a 32bit environment. ! You must install the platform SDK with 64bit versions of the tools, then ! setup your environment with a command similar to: ! {sdk_dir}\bin\SetEnv.Cmd /X64 /Release then: *************** *** 65,75 **** Now it starts getting wierd - we need to execute python.exe (32bit) to ! do the disutils build, but this build needs to find 64bit version of ! python.lib etc. The work-around for this is: * Extract a new Python source tree into a new directory * Build this tree using the 64bit instructions. ! * Set PYTHONHOME=c:\path_to_64bit_python ! * Execute: c:\path_to_32bit_python\python.exe setup.py build * un-set PYTHONHOME (set PYTHONHOME=) * Execute: c:\path_to_32bit_python_6\python.exe setup.py bdist_msi --skip-build --- 66,76 ---- Now it starts getting wierd - we need to execute python.exe (32bit) to ! do the distutils build, but this build needs to find 64bit version of ! python.lib etc. The work-around for this (on a 32 bit machine) is: * Extract a new Python source tree into a new directory * Build this tree using the 64bit instructions. ! * set PYTHONHOME=c:\path_to_64bit_python ! * Execute: c:\path_to_32bit_python\python.exe c:\path_to\pywin32\setup.py build * un-set PYTHONHOME (set PYTHONHOME=) * Execute: c:\path_to_32bit_python_6\python.exe setup.py bdist_msi --skip-build *************** *** 77,80 **** --- 78,84 ---- python 6 has not been released, you must use Python as built from the svn trunk] + [XXX - the above is a little wrong, as python 2.6 has moved to vs2008 and + the trunk currently builds to a different structure. This is still under + discussion on python-dev] (Note that these instructions will have clobbered your 32bit build of *************** *** 83,93 **** platforms so things don't get confused) ! * Using VS2005 natively in a 64bit environment: you must manually setup your ! compiler and SDK environment variables, then set the environment variables ! 'DISTUTILS_USE_SDK' and 'MSSdk' to any value before running setup. This ! will prevent distutils trying to sniff out the correct directories, which ! it generally fails to do these days... ! """ # Originally by Thomas Heller, started in 2000 or so. --- 87,95 ---- platforms so things don't get confused) + * py2.6 and later - tdb ! * Using VS2005 is not supported; either use the official py25 and earlier ! instructions for cross-compiling, or the new official py26+ instructions ! (using VS2008+) """ # Originally by Thomas Heller, started in 2000 or so. *************** *** 106,111 **** # when cross-compiling on a 32bit platform, the variable CPU reflects # the *target*. Distutil's get_build_architecture() still reports 'Intel' ! # in this environment - so we trust the CPU variable. def get_build_architecture(): try: return os.environ["CPU"] --- 108,120 ---- # when cross-compiling on a 32bit platform, the variable CPU reflects # the *target*. Distutil's get_build_architecture() still reports 'Intel' ! # in this environment - so we trust the CPU variable (or in Vista+ SDKs, ! # the TARGET_CPU variable) def get_build_architecture(): + # *sob* - Vista's SDK sets TARGET_CPU to 'x64' and doesn't set CPU at all + # presumably will need something similar for itanium + if os.environ.get("TARGET_CPU") == 'x64': + return "AMD64" + elif os.environ.get("TARGET_CPU") == 'x86': + return "Intel" try: return os.environ["CPU"] *************** *** 129,133 **** # want a distinction. # so we monkey-patch distutils :( We must do this before the main distutils ! # imports, which generall does 'from distutils.util import get_platform' # NOTE: Python 2.6 has the base get_platform() fixed - but there still # remains the cross-compile issue (ie, get_platform() needs to know the --- 138,142 ---- # want a distinction. # so we monkey-patch distutils :( We must do this before the main distutils ! # imports, which does 'from distutils.util import get_platform' # NOTE: Python 2.6 has the base get_platform() fixed - but there still # remains the cross-compile issue (ie, get_platform() needs to know the *************** *** 158,161 **** --- 167,176 ---- # py23 and earlier bdist_msi = None + try: + from distutils.msvccompiler import get_build_version + except ImportError: + # py22 + def get_build_version(): + return 6.0 from distutils.dep_util import newer_group, newer from distutils import dir_util, file_util *************** *** 308,311 **** --- 323,327 ---- optional_headers=[], base_address = None, + depends=None, ): assert dsp_file or sources, "Either dsp_file or sources must be specified" *************** *** 315,320 **** libraries=libraries.split() # VC2003 on x64 requires this library be explicitly linked... ! if is_64bit and msvccompiler.get_build_version() < 8.0: ! libraries.append('bufferoverflowU') extra_compile_args = (extra_compile_args or [])[:] # take copy --- 331,337 ---- libraries=libraries.split() # VC2003 on x64 requires this library be explicitly linked... ! # (well - apparently it used to :) Vista SDK fails if we do this... ! #if is_64bit and msvccompiler.get_build_version() < 8.0: ! # libraries.append('bufferoverflowU') extra_compile_args = (extra_compile_args or [])[:] # take copy *************** *** 356,359 **** --- 373,377 ---- extra_link_args, export_symbols) + self.depends = depends or [] # stash it here, as py22 doesn't have it. def parse_def_file(self, path): *************** *** 507,513 **** pass elif sdk_dir: extra = os.path.join(sdk_dir, 'include') if extra not in self.include_dirs and os.path.isdir(extra): ! self.include_dirs.insert(0, extra) extra = os.path.join(sdk_dir, 'lib') assert os.path.isdir(extra) --- 525,533 ---- pass elif sdk_dir: + # hrm - this should probably go down in build_ext with the + # other manipulation of the include/lib dirs... extra = os.path.join(sdk_dir, 'include') if extra not in self.include_dirs and os.path.isdir(extra): ! self.include_dirs.append(extra) extra = os.path.join(sdk_dir, 'lib') assert os.path.isdir(extra) *************** *** 534,551 **** 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 --- 554,579 ---- include_dirs = self.compiler.include_dirs + \ os.environ.get("INCLUDE", "").split(os.pathsep) ! # new platform SDKs stick the version in sdkddkver.h ! for header in ('WINDOWS.H', 'SDKDDKVER.H'): ! for d in include_dirs: ! look = os.path.join(d, header) ! if os.path.isfile(look): ! # read the fist 100 lines, looking for #define WINVER 0xNN ! # (Vista SDKs now define this based on _WIN32_WINNT, ! # which should still be fine for old versions) ! reob = re.compile("#define\W*_WIN32_WINNT\W*(0x[0-9a-fA-F]+)") ! f = open(look, "r") ! for i in range(500): ! line = f.readline() ! match = reob.match(line) ! if match is not None: ! self.windows_h_version = int(match.group(1), 16) ! log.info("Found version 0x%x in %s" \ ! % (self.windows_h_version, look)) ! break ! else: ! log.debug("No version in %r - looking for another...", look) ! if self.windows_h_version is not None: ! break if self.windows_h_version is not None: break *************** *** 562,573 **** % (ext.windows_h_version, self.windows_h_version) - try: - get_msvc_paths = self.compiler.get_msvc_paths - except AttributeError: - # module method in early Python versions - get_msvc_paths = msvccompiler.get_msvc_paths look_dirs = self.include_dirs - if is_32bit: # don't sniff MSVC paths on x64 - get_msvc_paths("include") for h in ext.optional_headers: for d in look_dirs: --- 590,594 ---- *************** *** 623,627 **** makeargs.append("SUB_DIR_O=%s" % build_temp) makeargs.append("SUB_DIR_BIN=%s" % build_temp) ! if is_64bit and msvccompiler.get_build_version() < 8.0: makeargs.append("LINK=bufferoverflowU.lib") --- 644,648 ---- makeargs.append("SUB_DIR_O=%s" % build_temp) makeargs.append("SUB_DIR_BIN=%s" % build_temp) ! if is_64bit and get_build_version() < 8.0: makeargs.append("LINK=bufferoverflowU.lib") *************** *** 720,725 **** 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')): --- 741,744 ---- *************** *** 825,837 **** if ext.pch_header: ext.extra_compile_args = ext.extra_compile_args or [] ! if is_32bit: 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) ! # if we are a verbose build, allow 64bit warnings (but not ! # when using VC6 - it doesn't understand that option. ! if self.distribution.verbose and sys.version_info > (2,4): ! ext.extra_compile_args.append("/Wp64") # some source files are compiled for different extensions --- 844,863 ---- if ext.pch_header: ext.extra_compile_args = ext.extra_compile_args or [] ! # /YX doesn't work in vs2008 ! if is_32bit and get_build_version() < 9.0: 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) ! # It gets uglier and uglier: {mssdk}/vc/include and /lib must ! # be stuck on the path. /include must get used for both cl.exe ! # and rc.exe, so its impossible to so here - so we do it in ! # _setup_compile() below. /lib can't be set there, so we do it ! # here. Will someone please put this out of its misery? ! # actually, we don't need this for 2.4+ (but I won't actually ! # kill 2.4- stuff yet.) ! if 0 and sdk_dir and get_build_version() < 9.0: ! if os.path.isdir(os.path.join(sdk_dir, 'VC', 'LIB')): ! ext.library_dirs.append(os.path.join(sdk_dir, 'VC', 'LIB')) # some source files are compiled for different extensions *************** *** 1172,1177 **** return self._items build = OnlyItems(items) return macros, objects, extra, pp_opts, build ! ################################################################ --- 1198,1217 ---- return self._items build = OnlyItems(items) + + # Vista SDKs have a 'VC' directory with headers and libs for older + # compilers. We need to hack the support in here so that the + # directories are after the compiler's own (where simply seeing + # ext.include_dirs means they end up before) and so they apply + # to the 'rc' executable (where tricks like ext.extra_compile_args + # don't work) + # We know its not needed on vs9... + if sdk_dir and get_build_version() < 9.0: + x = os.path.join(sdk_dir, 'VC', 'INCLUDE') + pp_opts.append("-I" + x.encode("mbcs")) + # *sob* - can't do the .lib dir here - see build_extension() + # above. + return macros, objects, extra, pp_opts, build ! ################################################################ *************** *** 1324,1327 **** --- 1364,1368 ---- dirs = { 'adsi' : 'com/win32comext/adsi/src', + 'propsys' : 'com/win32comext/propsys/src', 'shell' : 'com/win32comext/shell/src', 'axcontrol' : 'com/win32comext/axcontrol/src', *************** *** 1418,1427 **** --- 1459,1472 ---- %(shell)s/PyIAsyncOperation.cpp %(shell)s/PyIBrowserFrameOptions.cpp + %(shell)s/PyICategorizer.cpp + %(shell)s/PyICategoryProvider.cpp %(shell)s/PyIColumnProvider.cpp %(shell)s/PyIContextMenu.cpp %(shell)s/PyICopyHook.cpp + %(shell)s/PyIDefaultExtractIconInit.cpp %(shell)s/PyIDeskBand.cpp %(shell)s/PyIDockingWindow.cpp %(shell)s/PyIDropTargetHelper.cpp + %(shell)s/PyIEnumExplorerCommand.cpp %(shell)s/PyIEnumIDList.cpp %(shell)s/PyIEmptyVolumeCache.cpp *************** *** 1430,1433 **** --- 1475,1479 ---- %(shell)s/PyIExplorerBrowserEvents.cpp %(shell)s/PyIExplorerCommand.cpp + %(shell)s/PyIExplorerCommandProvider.cpp %(shell)s/PyIExtractIcon.cpp %(shell)s/PyIExtractIconW.cpp *************** *** 1435,1442 **** --- 1481,1490 ---- %(shell)s/PyIInputObject.cpp %(shell)s/PyIPersistFolder.cpp + %(shell)s/PyIPersistFolder2.cpp %(shell)s/PyIQueryAssociations.cpp %(shell)s/PyIShellBrowser.cpp %(shell)s/PyIShellExtInit.cpp %(shell)s/PyIShellFolder.cpp + %(shell)s/PyIShellFolder2.cpp %(shell)s/PyIShellIcon.cpp %(shell)s/PyIShellIconOverlay.cpp *************** *** 1453,1456 **** --- 1501,1510 ---- """ % dirs).split()), + WinExt_win32com('propsys', libraries='propsys', + sources=(""" + %(propsys)s/propsys.cpp + """ % dirs).split()), + + WinExt_win32com('taskscheduler', libraries='mstask', sources=(""" *************** *** 1476,1480 **** pythonwin_extensions = [ WinExt_pythonwin("win32ui", extra_compile_args = ['-DBUILD_PYW'], ! pch_header="stdafx.h", base_address=dll_base_address), WinExt_pythonwin("win32uiole", pch_header="stdafxole.h", windows_h_version = 0x500), --- 1530,1535 ---- pythonwin_extensions = [ WinExt_pythonwin("win32ui", extra_compile_args = ['-DBUILD_PYW'], ! pch_header="stdafx.h", base_address=dll_base_address, ! depends=["Pythonwin/stdafx.h", "Pythonwin/win32uiExt.h"]), WinExt_pythonwin("win32uiole", pch_header="stdafxole.h", windows_h_version = 0x500), *************** *** 1640,1643 **** --- 1695,1699 ---- 'win32comext.axdebug', + 'win32comext.propsys', 'win32comext.shell', 'win32comext.mapi', *************** *** 1749,1752 **** --- 1805,1809 ---- 'com/win32comext/axscript/Demos/*', 'com/win32comext/mapi/demos/*.py', + 'com/win32comext/propsys/test/*.py', 'com/win32comext/shell/test/*.py', 'com/win32comext/shell/demos/servers/*.py', |