New submission from zouguangxian:

with vs 2003, msi.py get msvcr71.dll from msm. but with vs 2005, It's 
better to extract msvcr80.dll from %VCINTALLDIR%\redist\x86
\Microsoft.VC80.CRT\. In addition, it seems to extract file from 
Microsoft_VC80_CRT_x86.msm need upgrade MSI to 3.1, i am not sure.

I 'PCbuild' to 'PCbuild8' in msi.py and add extract_msvcr80, that will 
make msi.py work with vs 2005.

----------
files: msi.patch
messages: 57532
nosy: weck
severity: normal
status: open
title: make msi  work the vs 2005(MSVC8)
type: compile error
versions: Python 2.5
Added file: http://bugs.python.org/file8754/msi.patch

__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1449>
__________________________________
Index: msi.py
===================================================================
--- msi.py      (revision 58978)
+++ msi.py      (working copy)
@@ -1,7 +1,7 @@
 # Python MSI Generator
 # (C) 2003 Martin v. Loewis
 # 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
 import uisample
 from win32com.client import constants
@@ -25,7 +25,7 @@
 # Is Tcl available at all?
 have_tcl = True
 # Where is sqlite3.dll located, relative to srcdir?
-sqlite_dir = "../sqlite-source-3.3.4"
+sqlite_dir = "../sqlite-3.5.2"
 
 try:
     from config import *
@@ -101,6 +101,7 @@
 # Using the same UUID is fine since these files are versioned,
 # so Installer will always keep the newest version.
 msvcr71_uuid = "{8666C8DD-D0B4-4B42-928E-A69E32FA5D4D}"
+msvcr80_uuid = "{82a0ee70-92d0-11dc-a156-0015c53a55e7}"
 pythondll_uuid = {
     "24":"{9B81E618-2301-4035-AC77-75D9ABEB7301}",
     "25":"{2e41b118-38bd-4c1b-a840-6977efd1b911}"
@@ -144,16 +145,16 @@
 
     return True
 
-# Target files (.def and .a) go in PCBuild directory
-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))
+# Target files (.def and .a) go in PCBuild8 directory
+lib_file = os.path.join(srcdir, "PCBuild8", "python%s%s.lib" % (major, minor))
+def_file = os.path.join(srcdir, "PCBuild8", "python%s%s.def" % (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, "PCBuild8", "libpython%s%s.a" % (major, 
minor))
 
 have_mingw = build_mingw_lib(lib_file, def_file, dll_file, mingw_lib)
 
 # Determine the target architechture
-dll_path = os.path.join(srcdir, "PCBuild", dll_file)
+dll_path = os.path.join(srcdir, "PCBuild8", dll_file)
 msilib.set_arch_from_file(dll_path)
 if msilib.pe_type(dll_path) != msilib.pe_type("msisupport.dll"):
     raise SystemError, "msisupport.dll for incorrect architecture"
@@ -827,6 +828,32 @@
     return installer.FileVersion("msvcr71.dll", 0), \
            installer.FileVersion("msvcr71.dll", 1)
 
+
+def extract_msvcr80():
+    import _winreg
+    # Find the location of the merge modules
+    k = _winreg.OpenKey(
+        _winreg.HKEY_LOCAL_MACHINE,
+        r"Software\Microsoft\VisualStudio\8.0\Setup\VS")
+    prod_dir = _winreg.QueryValueEx(k, "ProductDir")[0]
+    _winreg.CloseKey(k)
+
+    # Copy msvcr80*
+    dir = os.path.join(prod_dir, 'VC\\redist\\x86\\Microsoft.VC80.CRT')    
+    files = glob.glob1(dir, "*CRT*") + glob.glob1(dir, "*VCR*") 
+    for x in files:
+        print x
+        shutil.copy(os.path.join(dir, x), '.')
+
+    dir = os.path.join(prod_dir, 
'VC\\redist\\Debug_NonRedist\\x86\\Microsoft.VC80.DebugCRT')    
+    files = glob.glob1(dir, "*CRT*") + glob.glob1(dir, "*VCR*") 
+    for x in files:
+        print x
+        shutil.copy(os.path.join(dir, x), '.')
+
+    # Find the version/language of msvcr80.dll
+    return '8.00.50727.42', 'english'
+
 class PyDirectory(Directory):
     """By default, all components in the Python installer
     can run from source."""
@@ -844,19 +871,19 @@
     root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir")
     default_feature.set_current()
     if not msilib.Win64:
-        root.add_file("PCBuild/w9xpopen.exe")
+        root.add_file("PCBuild8/w9xpopen.exe")
     root.add_file("README.txt", src="README")
     root.add_file("NEWS.txt", src="Misc/NEWS")
     root.add_file("LICENSE.txt", src="LICENSE")
     root.start_component("python.exe", keyfile="python.exe")
-    root.add_file("PCBuild/python.exe")
+    root.add_file("PCBuild8/python.exe")
     root.start_component("pythonw.exe", keyfile="pythonw.exe")
-    root.add_file("PCBuild/pythonw.exe")
+    root.add_file("PCBuild8/pythonw.exe")
 
     # msidbComponentAttributesSharedDllRefCount = 8, see "Component Table"
     dlldir = PyDirectory(db, cab, root, srcdir, "DLLDIR", ".")
     pydll = "python%s%s.dll" % (major, minor)
-    pydllsrc = srcdir + "/PCBuild/" + pydll
+    pydllsrc = srcdir + "/PCBuild8/" + pydll
     dlldir.start_component("DLLDIR", flags = 8, keyfile = pydll, uuid = 
pythondll_uuid)
     installer = msilib.MakeInstaller()
     pyversion = installer.FileVersion(pydllsrc, 0)
@@ -864,18 +891,18 @@
         # For releases, the Python DLL has the same version as the
         # installer package.
         assert pyversion.split(".")[:3] == current_version.split(".")
-    dlldir.add_file("PCBuild/python%s%s.dll" % (major, minor),
+    dlldir.add_file("PCBuild8/python%s%s.dll" % (major, minor),
                     version=pyversion,
                     language=installer.FileVersion(pydllsrc, 1))
     # XXX determine dependencies
-    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, lang = extract_msvcr80()
+    dlldir.start_component("msvcr80", flags=8, keyfile="msvcr80.dll", 
uuid=msvcr80_uuid)
+    dlldir.add_file("msvcr80.dll", src=os.path.abspath("msvcr80.dll"),
                     version=version, language=lang)
-    tmpfiles.append("msvcr71.dll")
+    tmpfiles.append("msvcr80.dll")
 
     # Check if _ctypes.pyd exists
-    have_ctypes = os.path.exists(srcdir+"/PCBuild/_ctypes.pyd")
+    have_ctypes = os.path.exists(srcdir+"/PCBuild8/_ctypes.pyd")
     if not have_ctypes:
         print "WARNING: _ctypes.pyd not found, ctypes will not be included"
         extensions.remove("_ctypes.pyd")
@@ -961,7 +988,7 @@
                 pydirs.append((lib, f))
     # Add DLLs
     default_feature.set_current()
-    lib = PyDirectory(db, cab, root, srcdir+"/PCBuild", "DLLs", "DLLS|DLLs")
+    lib = PyDirectory(db, cab, root, srcdir+"/PCBuild8", "DLLs", "DLLS|DLLs")
     lib.add_file("py.ico", src="../PC/py.ico")
     lib.add_file("pyc.ico", src="../PC/pyc.ico")
     dlls = []
@@ -969,7 +996,7 @@
     for f in extensions:
         if f=="_tkinter.pyd":
             continue
-        if not os.path.exists(srcdir+"/PCBuild/"+f):
+        if not os.path.exists(srcdir+"/PCBuild8/"+f):
             print "WARNING: Missing extension", f
             continue
         dlls.append(f)
@@ -983,7 +1010,7 @@
         sqlite_arch = ""
     lib.add_file(srcdir+"/"+sqlite_dir+sqlite_arch+"/sqlite3.dll")
     if have_tcl:
-        if not os.path.exists(srcdir+"/PCBuild/_tkinter.pyd"):
+        if not os.path.exists(srcdir+"/PCBuild8/_tkinter.pyd"):
             print "WARNING: Missing _tkinter.pyd"
         else:
             lib.start_component("TkDLLs", tcltk)
@@ -993,7 +1020,7 @@
             for f in glob.glob1(tcldir, "*.dll"):
                 lib.add_file(f, src=os.path.join(tcldir, f))
     # check whether there are any unknown extensions
-    for f in glob.glob1(srcdir+"/PCBuild", "*.pyd"):
+    for f in glob.glob1(srcdir+"/PCBuild8", "*.pyd"):
         if f.endswith("_d.pyd"): continue # debug version
         if f in dlls: continue
         print "WARNING: Unknown extension", f
@@ -1004,7 +1031,7 @@
     lib.glob("*.h")
     lib.add_file("pyconfig.h", src="../PC/pyconfig.h")
     # Add import libraries
-    lib = PyDirectory(db, cab, root, "PCBuild", "libs", "LIBS|libs")
+    lib = PyDirectory(db, cab, root, "PCBuild8", "libs", "LIBS|libs")
     for f in dlls:
         lib.add_file(f.replace('pyd','lib'))
     lib.add_file('python%s%s.lib' % (major, minor))
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to