Commit 75681ec7 authored by Guido van Rossum's avatar Guido van Rossum

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.
parent c033d483
...@@ -54,7 +54,7 @@ class CExtension: ...@@ -54,7 +54,7 @@ class CExtension:
def GetLinkerLibs(self): def GetLinkerLibs(self):
return self.linkerLibs return self.linkerLibs
def checkextensions(unknown, extra_inis): def checkextensions(unknown, extra_inis, prefix):
# Create a table of frozen extensions # Create a table of frozen extensions
defaultMapName = os.path.join( os.path.split(sys.argv[0])[0], "extensions_win32.ini") defaultMapName = os.path.join( os.path.split(sys.argv[0])[0], "extensions_win32.ini")
...@@ -68,7 +68,7 @@ def checkextensions(unknown, extra_inis): ...@@ -68,7 +68,7 @@ def checkextensions(unknown, extra_inis):
for mod in unknown: for mod in unknown:
for ini in extra_inis: for ini in extra_inis:
# print "Looking for", mod, "in", win32api.GetFullPathName(ini),"...", # 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: if defn is not None:
# print "Yay - found it!" # print "Yay - found it!"
ret.append( defn ) ret.append( defn )
...@@ -79,8 +79,9 @@ def checkextensions(unknown, extra_inis): ...@@ -79,8 +79,9 @@ def checkextensions(unknown, extra_inis):
return ret return ret
def get_extension_defn(moduleName, mapFileName): def get_extension_defn(moduleName, mapFileName, prefix):
if win32api is None: return None if win32api is None: return None
os.environ['PYTHONPREFIX'] = prefix
dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName) dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName)
if dsp=="": if dsp=="":
return None return None
......
...@@ -9,6 +9,51 @@ ...@@ -9,6 +9,51 @@
; You must ensure that the environment variable PYTHONEX is set ; You must ensure that the environment variable PYTHONEX is set
; to point to the root win32 extensions directory ; 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 ...@@ -39,6 +84,10 @@ libs=advapi32.lib
dsp=%PYTHONEX%\win32\win32evtlog.dsp dsp=%PYTHONEX%\win32\win32evtlog.dsp
cl=/I %PYTHONEX%\win32\src cl=/I %PYTHONEX%\win32\src
[win32process]
dsp=%PYTHONEX%\win32\win32process.dsp
cl=/I %PYTHONEX%\win32\src
[win32event] [win32event]
dsp=%PYTHONEX%\win32\win32event.dsp dsp=%PYTHONEX%\win32\win32event.dsp
cl=/I %PYTHONEX%\win32\src cl=/I %PYTHONEX%\win32\src
...@@ -82,6 +131,10 @@ dsp=%PYTHONEX%\com\win32com.dsp ...@@ -82,6 +131,10 @@ dsp=%PYTHONEX%\com\win32com.dsp
cl=/I %PYTHONEX%\com\win32com\src\include /I %PYTHONEX%\win32\src cl=/I %PYTHONEX%\com\win32com\src\include /I %PYTHONEX%\win32\src
libs=uuid.lib 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] [win32com.axscript.axscript]
dsp=%PYTHONEX%\com\Active Scripting.dsp dsp=%PYTHONEX%\com\Active Scripting.dsp
cl=/I %PYTHONEX%\win32\src /I %PYTHONEX%\com\win32com\src\include cl=/I %PYTHONEX%\win32\src /I %PYTHONEX%\com\win32com\src\include
......
...@@ -112,7 +112,7 @@ def main(): ...@@ -112,7 +112,7 @@ def main():
# default the exclude list for each platform # default the exclude list for each platform
if win: exclude = exclude + [ 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 # modules that are imported by the Python runtime
implicits = ["site", "exceptions"] implicits = ["site", "exceptions"]
...@@ -376,7 +376,7 @@ def main(): ...@@ -376,7 +376,7 @@ def main():
# Get a list of CExtension instances, each describing a module # Get a list of CExtension instances, each describing a module
# (including its source files) # (including its source files)
frozen_extensions = checkextensions_win32.checkextensions( frozen_extensions = checkextensions_win32.checkextensions(
unknown, extensions) unknown, extensions, prefix)
for mod in frozen_extensions: for mod in frozen_extensions:
unknown.remove(mod.name) unknown.remove(mod.name)
......
...@@ -51,6 +51,7 @@ def makemakefile(outfp, vars, files, target): ...@@ -51,6 +51,7 @@ def makemakefile(outfp, vars, files, target):
sys.stdout = save sys.stdout = save
def realwork(vars, moddefns, target): 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 "# Makefile for Microsoft Visual C++ generated by freeze.py script"
print print
print 'target = %s' % target print 'target = %s' % target
...@@ -72,7 +73,7 @@ def realwork(vars, moddefns, target): ...@@ -72,7 +73,7 @@ def realwork(vars, moddefns, target):
print '# The following line assumes you have built Python using the standard instructions' 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 '# 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 print
# We only ever write one "entry point" symbol - either # We only ever write one "entry point" symbol - either
...@@ -87,7 +88,7 @@ def realwork(vars, moddefns, target): ...@@ -87,7 +88,7 @@ def realwork(vars, moddefns, target):
target_ext = ".dll" 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 "cdl = /MD"
print print
print "all: $(target)$(debug_suffix)%s" % (target_ext) print "all: $(target)$(debug_suffix)%s" % (target_ext)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment