Patch by Toby Dickenson, mentored by Mark Hammond, to support

automatically finding (most of) the standard PYD extensions, and to
remove the hardcoded Python version.
This commit is contained in:
Guido van Rossum 2000-07-13 15:45:17 +00:00
parent 5e70cfe22f
commit f67c2383da
4 changed files with 62 additions and 7 deletions

View File

@ -54,7 +54,7 @@ class CExtension:
def GetLinkerLibs(self):
return self.linkerLibs
def checkextensions(unknown, extra_inis):
def checkextensions(unknown, extra_inis, prefix):
# Create a table of frozen extensions
defaultMapName = os.path.join( os.path.split(sys.argv[0])[0], "extensions_win32.ini")
@ -68,7 +68,7 @@ def checkextensions(unknown, extra_inis):
for mod in unknown:
for ini in extra_inis:
# print "Looking for", mod, "in", win32api.GetFullPathName(ini),"...",
defn = get_extension_defn( mod, ini )
defn = get_extension_defn( mod, ini, prefix )
if defn is not None:
# print "Yay - found it!"
ret.append( defn )
@ -79,8 +79,9 @@ def checkextensions(unknown, extra_inis):
return ret
def get_extension_defn(moduleName, mapFileName):
def get_extension_defn(moduleName, mapFileName, prefix):
if win32api is None: return None
os.environ['PYTHONPREFIX'] = prefix
dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName)
if dsp=="":
return None

View File

@ -9,6 +9,51 @@
; You must ensure that the environment variable PYTHONEX is set
; to point to the root win32 extensions directory
; PYTHONPREFIX must point to the Python build root directory
; (the *parent* of PCbuild); normally the freeze script takes
; care of this.
;--------------------------------------------------------------
;
; Standard Python extension modules
;
; Here are some of the standard Python extensions modules.
; If you need others, add them here
[_socket]
dsp=%PYTHONPREFIX%\PCBuild\_socket.dsp
[_sre]
dsp=%PYTHONPREFIX%\PCBuild\_sre.dsp
[unicodedata]
dsp=%PYTHONPREFIX%\PCBuild\unicodedata.dsp
[mmap]
dsp=%PYTHONPREFIX%\PCBuild\mmap.dsp
[winsound]
dsp=%PYTHONPREFIX%\PCBuild\winsound.dsp
libs=winmm.lib
[parser]
dsp=%PYTHONPREFIX%\PCBuild\parser.dsp
[select]
dsp=%PYTHONPREFIX%\PCBuild\select.dsp
[ucnhash]
dsp=%PYTHONPREFIX%\PCBuild\ucnhash.dsp
[zlib]
dsp=%PYTHONPREFIX%\PCBuild\zlib.dsp
cl=/I %PYTHONPREFIX%\..\zlib113 /D WINDOWS /D _WINDOWS /D ZLIB_DLL /D WIN32
libs=%PYTHONPREFIX%\..\zlib113dll\static32\zlibstat.lib /nodefaultlib:libc
;--------------------------------------------------------------
;
@ -39,6 +84,10 @@ libs=advapi32.lib
dsp=%PYTHONEX%\win32\win32evtlog.dsp
cl=/I %PYTHONEX%\win32\src
[win32process]
dsp=%PYTHONEX%\win32\win32process.dsp
cl=/I %PYTHONEX%\win32\src
[win32event]
dsp=%PYTHONEX%\win32\win32event.dsp
cl=/I %PYTHONEX%\win32\src
@ -82,6 +131,10 @@ dsp=%PYTHONEX%\com\win32com.dsp
cl=/I %PYTHONEX%\com\win32com\src\include /I %PYTHONEX%\win32\src
libs=uuid.lib
[win32com.axcontrol.axcontrol]
dsp=%PYTHONEX%\com\axcontrol.dsp
cl=/I %PYTHONEX%\win32\src /I %PYTHONEX%\com\win32com\src\include
[win32com.axscript.axscript]
dsp=%PYTHONEX%\com\Active Scripting.dsp
cl=/I %PYTHONEX%\win32\src /I %PYTHONEX%\com\win32com\src\include

View File

@ -112,7 +112,7 @@ def main():
# default the exclude list for each platform
if win: exclude = exclude + [
'dos', 'dospath', 'mac', 'macpath', 'macfs', 'MACFS', 'posix', 'os2']
'dos', 'dospath', 'mac', 'macpath', 'macfs', 'MACFS', 'posix', 'os2', 'ce']
# modules that are imported by the Python runtime
implicits = ["site", "exceptions"]
@ -376,7 +376,7 @@ def main():
# Get a list of CExtension instances, each describing a module
# (including its source files)
frozen_extensions = checkextensions_win32.checkextensions(
unknown, extensions)
unknown, extensions, prefix)
for mod in frozen_extensions:
unknown.remove(mod.name)

View File

@ -51,6 +51,7 @@ def makemakefile(outfp, vars, files, target):
sys.stdout = save
def realwork(vars, moddefns, target):
version_suffix = `sys.version_info[0]`+`sys.version_info[1]`
print "# Makefile for Microsoft Visual C++ generated by freeze.py script"
print
print 'target = %s' % target
@ -72,7 +73,7 @@ def realwork(vars, moddefns, target):
print '# The following line assumes you have built Python using the standard instructions'
print '# Otherwise fix the following line to point to the library.'
print 'pythonlib = "$(pythonhome)/pcbuild/python15$(debug_suffix).lib"'
print 'pythonlib = "$(pythonhome)/pcbuild/python%s$(debug_suffix).lib"' % version_suffix
print
# We only ever write one "entry point" symbol - either
@ -87,7 +88,7 @@ def realwork(vars, moddefns, target):
target_ext = ".dll"
print "# As the target uses Python15.dll, we must use this compiler option!"
print "# As the target uses Python%s.dll, we must use this compiler option!" % version_suffix
print "cdl = /MD"
print
print "all: $(target)$(debug_suffix)%s" % (target_ext)