Updates to the msi builder and PCbuild9 directory. msi.py can now create installers from the PCbuild9 directory with MSVCR90.dll. PCbuild and MSVCR71.dll are still the default.

This commit is contained in:
Christian Heimes 2007-11-18 18:18:41 +00:00
parent 6030a60a4e
commit 81ca7c784c
4 changed files with 83 additions and 32 deletions

BIN
PCbuild9/installer.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View File

@ -7,13 +7,17 @@
> >
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
RuntimeLibrary="2"
PreprocessorDefinitions="NDEBUG" PreprocessorDefinitions="NDEBUG"
RuntimeLibrary="2"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName).pyd" OutputFile="$(OutDir)\$(ProjectName).pyd"
ImportLibrary="$(IntDir)\$(TargetName).lib"
ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb" ProgramDatabaseFile="$(OutDir)\$(ProjectName).pdb"
ImportLibrary="$(IntDir)\$(TargetName).lib"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy $(IntDir)\$(ProjectName).lib $(OutDir)"
/> />
</VisualStudioPropertySheet> </VisualStudioPropertySheet>

View File

@ -16,7 +16,11 @@
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)\$(ProjectName)_d.pyd" OutputFile="$(OutDir)\$(ProjectName)_d.pyd"
LinkIncremental="1" LinkIncremental="1"
ImportLibrary="$(IntDir)\$(TargetName).lib"
ProgramDatabaseFile="$(OutDir)\$(ProjectName)_d.pdb" ProgramDatabaseFile="$(OutDir)\$(ProjectName)_d.pdb"
ImportLibrary="$(IntDir)\$(TargetName).lib"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy $(IntDir)\$(ProjectName)_d.lib $(OutDir)"
/> />
</VisualStudioPropertySheet> </VisualStudioPropertySheet>

View File

@ -1,7 +1,7 @@
# Python MSI Generator # Python MSI Generator
# (C) 2003 Martin v. Loewis # (C) 2003 Martin v. Loewis
# See "FOO" in comments refers to MSDN sections with the title FOO. # See "FOO" in comments refers to MSDN sections with the title FOO.
import msilib, schema, sequence, os, glob, time, re import msilib, schema, sequence, os, glob, time, re, shutil
from msilib import Feature, CAB, Directory, Dialog, Binary, add_data from msilib import Feature, CAB, Directory, Dialog, Binary, add_data
import uisample import uisample
from win32com.client import constants from win32com.client import constants
@ -26,6 +26,12 @@ full_current_version = None
have_tcl = True have_tcl = True
# Where is sqlite3.dll located, relative to srcdir? # Where is sqlite3.dll located, relative to srcdir?
sqlite_dir = "../sqlite-source-3.3.4" sqlite_dir = "../sqlite-source-3.3.4"
# path to PCbuild directory
PCBUILD="PCbuild"
#PCBUILD="PCbuild9"
# msvcrt version
MSVCR = "71"
#MSVCR = "90"
try: try:
from config import * from config import *
@ -101,6 +107,7 @@ extensions = [
# Using the same UUID is fine since these files are versioned, # Using the same UUID is fine since these files are versioned,
# so Installer will always keep the newest version. # so Installer will always keep the newest version.
msvcr71_uuid = "{8666C8DD-D0B4-4B42-928E-A69E32FA5D4D}" msvcr71_uuid = "{8666C8DD-D0B4-4B42-928E-A69E32FA5D4D}"
msvcr90_uuid = "" # XXX
pythondll_uuid = { pythondll_uuid = {
"24":"{9B81E618-2301-4035-AC77-75D9ABEB7301}", "24":"{9B81E618-2301-4035-AC77-75D9ABEB7301}",
"25":"{2e41b118-38bd-4c1b-a840-6977efd1b911}", "25":"{2e41b118-38bd-4c1b-a840-6977efd1b911}",
@ -147,15 +154,15 @@ def build_mingw_lib(lib_file, def_file, dll_file, mingw_lib):
return True return True
# Target files (.def and .a) go in PCBuild directory # Target files (.def and .a) go in PCBuild directory
lib_file = os.path.join(srcdir, "PCBuild", "python%s%s.lib" % (major, minor)) lib_file = os.path.join(srcdir, PCBUILD, "python%s%s.lib" % (major, minor))
def_file = os.path.join(srcdir, "PCBuild", "python%s%s.def" % (major, minor)) def_file = os.path.join(srcdir, PCBUILD, "python%s%s.def" % (major, minor))
dll_file = "python%s%s.dll" % (major, minor) dll_file = "python%s%s.dll" % (major, minor)
mingw_lib = os.path.join(srcdir, "PCBuild", "libpython%s%s.a" % (major, minor)) mingw_lib = os.path.join(srcdir, PCBUILD, "libpython%s%s.a" % (major, minor))
have_mingw = build_mingw_lib(lib_file, def_file, dll_file, mingw_lib) have_mingw = build_mingw_lib(lib_file, def_file, dll_file, mingw_lib)
# Determine the target architechture # Determine the target architechture
dll_path = os.path.join(srcdir, "PCBuild", dll_file) dll_path = os.path.join(srcdir, PCBUILD, dll_file)
msilib.set_arch_from_file(dll_path) msilib.set_arch_from_file(dll_path)
if msilib.pe_type(dll_path) != msilib.pe_type("msisupport.dll"): if msilib.pe_type(dll_path) != msilib.pe_type("msisupport.dll"):
raise SystemError("msisupport.dll for incorrect architecture") raise SystemError("msisupport.dll for incorrect architecture")
@ -327,7 +334,7 @@ def add_ui(db):
if not os.path.exists(srcdir+r"\PC\python_icon.exe"): if not os.path.exists(srcdir+r"\PC\python_icon.exe"):
raise "Run icons.mak in PC directory" raise "Run icons.mak in PC directory"
add_data(db, "Binary", add_data(db, "Binary",
[("PythonWin", msilib.Binary(srcdir+r"\PCbuild\installer.bmp")), # 152x328 pixels [("PythonWin", msilib.Binary(r"%s\%s\installer.bmp" % (srcdir, PCBUILD))), # 152x328 pixels
("py.ico",msilib.Binary(srcdir+r"\PC\py.ico")), ("py.ico",msilib.Binary(srcdir+r"\PC\py.ico")),
]) ])
add_data(db, "Icon", add_data(db, "Icon",
@ -816,19 +823,45 @@ def extract_msvcr71():
r"Software\Microsoft\VisualStudio\7.1\Setup\VS") r"Software\Microsoft\VisualStudio\7.1\Setup\VS")
dir = _winreg.QueryValueEx(k, "MSMDir")[0] dir = _winreg.QueryValueEx(k, "MSMDir")[0]
_winreg.CloseKey(k) _winreg.CloseKey(k)
files = glob.glob1(dir, "*CRT71*") files = glob.glob1(dir, "*VCR71*.dll")
assert len(files) == 1 assert len(files) > 0, (dir, files)
file = os.path.join(dir, files[0])
# Extract msvcr71.dll # Extract msvcr71.dll
m = msilib.MakeMerge2() #m = msilib.MakeMerge2()
m.OpenModule(file, 0) #m.OpenModule(file, 0)
m.ExtractFiles(".") #m.ExtractFiles(".")
m.CloseModule() #m.CloseModule()
for file in files:
shutil.copy(os.path.join(dir, file), '.')
# Find the version/language of msvcr71.dll # Find the version/language of msvcr71.dll
installer = msilib.MakeInstaller() installer = msilib.MakeInstaller()
return installer.FileVersion("msvcr71.dll", 0), \ return installer.FileVersion("msvcr71.dll", 0), \
installer.FileVersion("msvcr71.dll", 1) installer.FileVersion("msvcr71.dll", 1)
def extract_msvcr90():
import _winreg
# Find the location of the merge modules
k = _winreg.OpenKey(
_winreg.HKEY_LOCAL_MACHINE,
r"Software\Microsoft\VisualStudio\9.0\Setup\VS")
prod_dir = _winreg.QueryValueEx(k, "ProductDir")[0]
_winreg.CloseKey(k)
# Copy msvcr90*
dir = os.path.join(prod_dir, r'VC\redist\x86\Microsoft.VC90.CRT')
files = glob.glob1(dir, "*CRT*.dll") + glob.glob1(dir, "*VCR*.dll")
for file in files:
shutil.copy(os.path.join(dir, file), '.')
dir = os.path.join(prod_dir, r'VC\redist\Debug_NonRedist\x86\Microsoft.VC90.DebugCRT')
files = glob.glob1(dir, "*CRT*.dll") + glob.glob1(dir, "*VCR*.dll")
for file in files:
shutil.copy(os.path.join(dir, file), '.')
# Find the version/language of msvcr90.dll
installer = msilib.MakeInstaller()
return installer.FileVersion("msvcr90.dll", 0), \
installer.FileVersion("msvcr90.dll", 1)
class PyDirectory(Directory): class PyDirectory(Directory):
"""By default, all components in the Python installer """By default, all components in the Python installer
can run from source.""" can run from source."""
@ -846,19 +879,19 @@ def add_files(db):
root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir") root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir")
default_feature.set_current() default_feature.set_current()
if not msilib.Win64: if not msilib.Win64:
root.add_file("PCBuild/w9xpopen.exe") root.add_file("%s/w9xpopen.exe" % PCBUILD)
root.add_file("README.txt", src="README") root.add_file("README.txt", src="README")
root.add_file("NEWS.txt", src="Misc/NEWS") root.add_file("NEWS.txt", src="Misc/NEWS")
root.add_file("LICENSE.txt", src="LICENSE") root.add_file("LICENSE.txt", src="LICENSE")
root.start_component("python.exe", keyfile="python.exe") root.start_component("python.exe", keyfile="python.exe")
root.add_file("PCBuild/python.exe") root.add_file("%s/python.exe" % PCBUILD)
root.start_component("pythonw.exe", keyfile="pythonw.exe") root.start_component("pythonw.exe", keyfile="pythonw.exe")
root.add_file("PCBuild/pythonw.exe") root.add_file("%s/pythonw.exe" % PCBUILD)
# msidbComponentAttributesSharedDllRefCount = 8, see "Component Table" # msidbComponentAttributesSharedDllRefCount = 8, see "Component Table"
dlldir = PyDirectory(db, cab, root, srcdir, "DLLDIR", ".") dlldir = PyDirectory(db, cab, root, srcdir, "DLLDIR", ".")
pydll = "python%s%s.dll" % (major, minor) pydll = "python%s%s.dll" % (major, minor)
pydllsrc = srcdir + "/PCBuild/" + pydll pydllsrc = os.path.join(srcdir, PCBUILD, pydll)
dlldir.start_component("DLLDIR", flags = 8, keyfile = pydll, uuid = pythondll_uuid) dlldir.start_component("DLLDIR", flags = 8, keyfile = pydll, uuid = pythondll_uuid)
installer = msilib.MakeInstaller() installer = msilib.MakeInstaller()
pyversion = installer.FileVersion(pydllsrc, 0) pyversion = installer.FileVersion(pydllsrc, 0)
@ -866,18 +899,28 @@ def add_files(db):
# For releases, the Python DLL has the same version as the # For releases, the Python DLL has the same version as the
# installer package. # installer package.
assert pyversion.split(".")[:3] == current_version.split(".") assert pyversion.split(".")[:3] == current_version.split(".")
dlldir.add_file("PCBuild/python%s%s.dll" % (major, minor), dlldir.add_file("%s/python%s%s.dll" % (PCBUILD, major, minor),
version=pyversion, version=pyversion,
language=installer.FileVersion(pydllsrc, 1)) language=installer.FileVersion(pydllsrc, 1))
# XXX determine dependencies # XXX determine dependencies
version, lang = extract_msvcr71() if MSVCR == "90":
dlldir.start_component("msvcr71", flags=8, keyfile="msvcr71.dll", uuid=msvcr71_uuid) version, lang = extract_msvcr90()
dlldir.add_file("msvcr71.dll", src=os.path.abspath("msvcr71.dll"), dlldir.start_component("msvcr90", flags=8, keyfile="msvcr90.dll",
version=version, language=lang) uuid=msvcr90_uuid)
tmpfiles.append("msvcr71.dll") dlldir.add_file("msvcr90.dll", src=os.path.abspath("msvcr90.dll"),
version=version, language=lang)
tmpfiles.append("msvcr90.dll")
else:
version, lang = extract_msvcr71()
dlldir.start_component("msvcr71", flags=8, keyfile="msvcr71.dll",
uuid=msvcr71_uuid)
dlldir.add_file("msvcr71.dll", src=os.path.abspath("msvcr71.dll"),
version=version, language=lang)
tmpfiles.append("msvcr71.dll")
# Check if _ctypes.pyd exists # Check if _ctypes.pyd exists
have_ctypes = os.path.exists(srcdir+"/PCBuild/_ctypes.pyd") have_ctypes = os.path.exists(srcdir+"/%s/_ctypes.pyd" % PCBUILD)
if not have_ctypes: if not have_ctypes:
print("WARNING: _ctypes.pyd not found, ctypes will not be included") print("WARNING: _ctypes.pyd not found, ctypes will not be included")
extensions.remove("_ctypes.pyd") extensions.remove("_ctypes.pyd")
@ -963,7 +1006,7 @@ def add_files(db):
pydirs.append((lib, f)) pydirs.append((lib, f))
# Add DLLs # Add DLLs
default_feature.set_current() default_feature.set_current()
lib = PyDirectory(db, cab, root, srcdir+"/PCBuild", "DLLs", "DLLS|DLLs") lib = PyDirectory(db, cab, root, srcdir + "/" + PCBUILD, "DLLs", "DLLS|DLLs")
lib.add_file("py.ico", src="../PC/py.ico") lib.add_file("py.ico", src="../PC/py.ico")
lib.add_file("pyc.ico", src="../PC/pyc.ico") lib.add_file("pyc.ico", src="../PC/pyc.ico")
dlls = [] dlls = []
@ -971,7 +1014,7 @@ def add_files(db):
for f in extensions: for f in extensions:
if f=="_tkinter.pyd": if f=="_tkinter.pyd":
continue continue
if not os.path.exists(srcdir+"/PCBuild/"+f): if not os.path.exists(srcdir + "/" + PCBUILD + "/" + f):
print("WARNING: Missing extension", f) print("WARNING: Missing extension", f)
continue continue
dlls.append(f) dlls.append(f)
@ -985,7 +1028,7 @@ def add_files(db):
sqlite_arch = "" sqlite_arch = ""
lib.add_file(srcdir+"/"+sqlite_dir+sqlite_arch+"/sqlite3.dll") lib.add_file(srcdir+"/"+sqlite_dir+sqlite_arch+"/sqlite3.dll")
if have_tcl: if have_tcl:
if not os.path.exists(srcdir+"/PCBuild/_tkinter.pyd"): if not os.path.exists("%s/%s/_tkinter.pyd" % (srcdir, PCBUILD)):
print("WARNING: Missing _tkinter.pyd") print("WARNING: Missing _tkinter.pyd")
else: else:
lib.start_component("TkDLLs", tcltk) lib.start_component("TkDLLs", tcltk)
@ -995,7 +1038,7 @@ def add_files(db):
for f in glob.glob1(tcldir, "*.dll"): for f in glob.glob1(tcldir, "*.dll"):
lib.add_file(f, src=os.path.join(tcldir, f)) lib.add_file(f, src=os.path.join(tcldir, f))
# check whether there are any unknown extensions # check whether there are any unknown extensions
for f in glob.glob1(srcdir+"/PCBuild", "*.pyd"): for f in glob.glob1(srcdir+"/"+PCBUILD, "*.pyd"):
if f.endswith("_d.pyd"): continue # debug version if f.endswith("_d.pyd"): continue # debug version
if f in dlls: continue if f in dlls: continue
print("WARNING: Unknown extension", f) print("WARNING: Unknown extension", f)
@ -1006,7 +1049,7 @@ def add_files(db):
lib.glob("*.h") lib.glob("*.h")
lib.add_file("pyconfig.h", src="../PC/pyconfig.h") lib.add_file("pyconfig.h", src="../PC/pyconfig.h")
# Add import libraries # Add import libraries
lib = PyDirectory(db, cab, root, "PCBuild", "libs", "LIBS|libs") lib = PyDirectory(db, cab, root, PCBUILD, "libs", "LIBS|libs")
for f in dlls: for f in dlls:
lib.add_file(f.replace('pyd','lib')) lib.add_file(f.replace('pyd','lib'))
lib.add_file('python%s%s.lib' % (major, minor)) lib.add_file('python%s%s.lib' % (major, minor))