[Python-checkins] python/dist/src/Tools/msi msi.py, 1.21.2.1, 1.21.2.2 msilib.py, 1.4.4.1, 1.4.4.2 msisupport.c, 1.1.4.1, 1.1.4.2

jhylton@users.sourceforge.net jhylton at users.sourceforge.net
Sun Oct 16 07:24:10 CEST 2005


Update of /cvsroot/python/python/dist/src/Tools/msi
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27718/Tools/msi

Modified Files:
      Tag: ast-branch
	msi.py msilib.py msisupport.c 
Log Message:
Merge head to branch (for the last time)


Index: msi.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/msi/msi.py,v
retrieving revision 1.21.2.1
retrieving revision 1.21.2.2
diff -u -d -r1.21.2.1 -r1.21.2.2
--- msi.py	7 Jan 2005 07:05:38 -0000	1.21.2.1
+++ msi.py	16 Oct 2005 05:24:06 -0000	1.21.2.2
@@ -81,6 +81,11 @@
     '2.4.121': '{75508821-a8e9-40a8-95bd-dbe6033ddbea}', # 2.4c1
     '2.4.122': '{83a9118b-4bdd-473b-afc3-bcb142feca9e}', # 2.4c2
     '2.4.150': '{82d9302e-f209-4805-b548-52087047483a}', # 2.4.0
+    '2.4.1121':'{be027411-8e6b-4440-a29b-b07df0690230}', # 2.4.1c1
+    '2.4.1122':'{02818752-48bf-4074-a281-7a4114c4f1b1}', # 2.4.1c2
+    '2.4.1150':'{4d4f5346-7e4a-40b5-9387-fdb6181357fc}', # 2.4.1
+    '2.4.2121':'{5ef9d6b6-df78-45d2-ab09-14786a3c5a99}', # 2.4.2c1
+    '2.4.2150':'{b191e49c-ea23-43b2-b28a-14e0784069b8}', # 2.4.2
 }
 
 if snapshot:
@@ -117,6 +122,20 @@
     'parser.pyd',
     ])
 
+# Well-known component UUIDs
+# These are needed for SharedDLLs reference counter; if
+# a different UUID was used for each incarnation of, say,
+# python24.dll, an upgrade would set the reference counter
+# from 1 to 2 (due to what I consider a bug in MSI)
+# 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}"
+pythondll_uuid = {
+    "24":"{9B81E618-2301-4035-AC77-75D9ABEB7301}",
+    "25":"{2e41b118-38bd-4c1b-a840-6977efd1b911}"
+    } [major+minor]
+
+
 # Build the mingw import library, libpythonXY.a
 # This requires 'nm' and 'dlltool' executables on your PATH
 def build_mingw_lib(lib_file, def_file, dll_file, mingw_lib):
@@ -215,6 +234,7 @@
     # accordingly.
     add_data(db, "Property", [("UpgradeCode", uc),
                               ("WhichUsers", "ALL"),
+                              ("ProductLine", "Python%s%s" % (major, minor)),
                              ])
     db.Commit()
     return db
@@ -346,11 +366,17 @@
         raise "'nmake /f msisupport.mak' failed"
     add_data(db, "Binary", [("Script", msilib.Binary("msisupport.dll"))])
     # See "Custom Action Type 1"
+    if msilib.Win64:
+        CheckDir = "CheckDir"
+        UpdateEditIdle = "UpdateEditIDLE"
+    else:
+        CheckDir =  "_CheckDir at 4"
+        UpdateEditIDLE = "_UpdateEditIDLE at 4"
     add_data(db, "CustomAction",
-        [("CheckDir", 1, "Script", "_CheckDir at 4")])
+        [("CheckDir", 1, "Script", CheckDir)])
     if have_tcl:
         add_data(db, "CustomAction",
-        [("UpdateEditIDLE", 1, "Script", "_UpdateEditIDLE at 4")])
+        [("UpdateEditIDLE", 1, "Script", UpdateEditIDLE)])
 
     # UI customization properties
     add_data(db, "Property",
@@ -367,6 +393,7 @@
              [("DlgFont8", "Tahoma", 9, None, 0),
               ("DlgFontBold8", "Tahoma", 8, None, 1), #bold
               ("VerdanaBold10", "Verdana", 10, None, 1),
+              ("VerdanaRed9", "Verdana", 9, 255, 0),
              ])
 
     compileargs = r"-Wi [TARGETDIR]Lib\compileall.py -f -x badsyntax [TARGETDIR]Lib"
@@ -555,6 +582,9 @@
     seldlg = PyDialog(db, "SelectDirectoryDlg", x, y, w, h, modal, title,
                     "Next", "Next", "Cancel")
     seldlg.title("Select Destination Directory")
+    c = seldlg.text("Existing", 135, 25, 235, 30, 0x30003,
+                    "{\VerdanaRed9}This update will replace your existing [ProductLine] installation.")
+    c.condition("Hide", 'REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""')
     seldlg.text("Description", 135, 50, 220, 40, 0x30003,
                "Please select a directory for the [ProductName] files.")
 
@@ -854,7 +884,7 @@
     dlldir = PyDirectory(db, cab, root, srcdir, "DLLDIR", ".")
     pydll = "python%s%s.dll" % (major, minor)
     pydllsrc = srcdir + "/PCBuild/" + pydll
-    dlldir.start_component("DLLDIR", flags = 8, keyfile = pydll)
+    dlldir.start_component("DLLDIR", flags = 8, keyfile = pydll, uuid = pythondll_uuid)
     installer = msilib.MakeInstaller()
     pyversion = installer.FileVersion(pydllsrc, 0)
     if not snapshot:
@@ -866,7 +896,7 @@
                     language=installer.FileVersion(pydllsrc, 1))
     # XXX determine dependencies
     version, lang = extract_msvcr71()
-    dlldir.start_component("msvcr71", flags=8, keyfile="msvcr71.dll")
+    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")
@@ -977,7 +1007,7 @@
     lib.add_file('python%s%s.lib' % (major, minor))
     # Add the mingw-format library
     if have_mingw:
-	lib.add_file('libpython%s%s.a' % (major, minor))
+        lib.add_file('libpython%s%s.a' % (major, minor))
     if have_tcl:
         # Add Tcl/Tk
         tcldirs = [(root, '../tcltk/lib', 'tcl')]
@@ -1036,6 +1066,8 @@
              # msidbComponentAttributesRegistryKeyPath = 4
              [("REGISTRY", msilib.gen_uuid(), "TARGETDIR", 4, None,
                "InstallPath"),
+              ("REGISTRY.doc", msilib.gen_uuid(), "TARGETDIR", 4, None,
+               "Documentation"),
               ("REGISTRY.def", msilib.gen_uuid(), "TARGETDIR", 4,
                None, None)] + tcldata)
     # See "FeatureComponents Table".
@@ -1051,6 +1083,7 @@
         tcldata = [(tcltk.id, "pythonw.exe")]
     add_data(db, "FeatureComponents",
              [(default_feature.id, "REGISTRY"),
+              (htmlfiles.id, "REGISTRY.doc"),
               (ext_feature.id, "REGISTRY.def")] +
               tcldata
               )
@@ -1119,7 +1152,7 @@
               ("PythonPath", -1, prefix+r"\PythonPath", "",
                r"[TARGETDIR]Lib;[TARGETDIR]DLLs;[TARGETDIR]Lib\lib-tk", "REGISTRY"),
               ("Documentation", -1, prefix+r"\Help\Main Python Documentation", "",
-               r"[TARGETDIR]Doc\Python%s%s.chm" % (major, minor), "REGISTRY"),
+               r"[TARGETDIR]Doc\Python%s%s.chm" % (major, minor), "REGISTRY.doc"),
               ("Modules", -1, prefix+r"\Modules", "+", None, "REGISTRY"),
               ("AppPaths", -1, r"Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe",
                "", r"[TARGETDIR]Python.exe", "REGISTRY.def")
@@ -1143,9 +1176,14 @@
              [# Advertised shortcuts: targets are features, not files
               ("Python", "MenuDir", "PYTHON|Python (command line)", "python.exe",
                default_feature.id, None, None, None, "python_icon.exe", 2, None, "TARGETDIR"),
-              ("Manual", "MenuDir", "MANUAL|Python Manuals", "documentation",
-               htmlfiles.id, None, None, None, None, None, None, None),
+              # Advertising the Manual breaks on (some?) Win98, and the shortcut lacks an
+              # icon first.
+              #("Manual", "MenuDir", "MANUAL|Python Manuals", "documentation",
+              # htmlfiles.id, None, None, None, None, None, None, None),
               ## Non-advertised shortcuts: must be associated with a registry component
+              ("Manual", "MenuDir", "MANUAL|Python Manuals", "REGISTRY.doc",
+               "[#Python%s%s.chm]" % (major,minor), None,
+               None, None, None, None, None, None),
               ("Uninstall", "MenuDir", "UNINST|Uninstall Python", "REGISTRY",
                SystemFolderName+"msiexec",  "/x%s" % product_code,
                None, None, None, None, None, None),

Index: msilib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/msi/msilib.py,v
retrieving revision 1.4.4.1
retrieving revision 1.4.4.2
diff -u -d -r1.4.4.1 -r1.4.4.2
--- msilib.py	7 Jan 2005 07:05:38 -0000	1.4.4.1
+++ msilib.py	16 Oct 2005 05:24:06 -0000	1.4.4.2
@@ -393,7 +393,7 @@
         else:
             print "WARNING: cabarc.exe not found in registry"
             cabarc = "cabarc.exe"
-        f = popen2.popen4(r'"%s" n %s.cab @%s.txt' % (cabarc, self.name, self.name))[0]
+        f = popen2.popen4(r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name))[0]
         for line in f:
             if line.startswith("  -- adding "):
                 sys.stdout.write(".")
@@ -445,7 +445,7 @@
             blogical = None
         add_data(db, "Directory", [(logical, blogical, default)])
 
-    def start_component(self, component = None, feature = None, flags = None, keyfile = None):
+    def start_component(self, component = None, feature = None, flags = None, keyfile = None, uuid=None):
         """Add an entry to the Component table, and make this component the current for this
         directory. If no component name is given, the directory name is used. If no feature
         is given, the current feature is used. If no flags are given, the directory's default
@@ -453,7 +453,10 @@
         table."""
         if flags is None:
             flags = self.componentflags
-        uuid = gen_uuid()
+        if uuid is None:
+            uuid = gen_uuid()
+        else:
+            uuid = uuid.upper()
         if component is None:
             component = self.logical
         self.component = component

Index: msisupport.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/msi/msisupport.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -u -d -r1.1.4.1 -r1.1.4.2
--- msisupport.c	7 Jan 2005 07:05:39 -0000	1.1.4.1
+++ msisupport.c	16 Oct 2005 05:24:06 -0000	1.1.4.2
@@ -1,14 +1,16 @@
 #include "windows.h"
 #include "msiquery.h"
 
+int isWinNT;
+
 /* Print a debug message to the installer log file.
  * To see the debug messages, install with
  * msiexec /i pythonxy.msi /l*v python.log
  */
-static UINT debug(MSIHANDLE hInstall, LPCWSTR msg)
+static UINT debug(MSIHANDLE hInstall, LPCSTR msg)
 {
 	MSIHANDLE hRec = MsiCreateRecord(1);
-	if (!hRec || MsiRecordSetStringW(hRec, 1, msg) != ERROR_SUCCESS) {
+	if (!hRec || MsiRecordSetStringA(hRec, 1, msg) != ERROR_SUCCESS) {
 		return ERROR_INSTALL_FAILURE;
 	}
 	MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hRec);
@@ -21,23 +23,34 @@
  */
 UINT __declspec(dllexport) __stdcall CheckDir(MSIHANDLE hInstall)
 {
-	WCHAR path[1024];
+#define PSIZE 1024
+	WCHAR wpath[PSIZE];
+	char path[PSIZE];
 	UINT result;
-	DWORD size = sizeof(path)/sizeof(WCHAR);
+	DWORD size = PSIZE;
 	DWORD attributes;
+
+	isWinNT = (GetVersion() < 0x80000000) ? 1 : 0;
 	
-	result = MsiGetPropertyW(hInstall, L"TARGETDIR", path, &size);
+	if (isWinNT)
+		result = MsiGetPropertyW(hInstall, L"TARGETDIR", wpath, &size);
+	else
+		result = MsiGetPropertyA(hInstall, "TARGETDIR", path, &size);
 	if (result != ERROR_SUCCESS)
 		return result;
+	wpath[size] = L'\0';
 	path[size] = L'\0';
 
-	attributes = GetFileAttributesW(path);
+	if (isWinNT)
+		attributes = GetFileAttributesW(wpath);
+	else
+		attributes = GetFileAttributesA(path);
 	if (attributes == INVALID_FILE_ATTRIBUTES ||
 		!(attributes & FILE_ATTRIBUTE_DIRECTORY)) 
 	{
-		return MsiSetPropertyW(hInstall, L"TargetExists", L"0");
+		return MsiSetPropertyA(hInstall, "TargetExists", "0");
 	} else {
-		return MsiSetPropertyW(hInstall, L"TargetExists", L"1");
+		return MsiSetPropertyA(hInstall, "TargetExists", "1");
 	}
 }
 
@@ -50,10 +63,10 @@
 	INSTALLSTATE ext_old, ext_new, tcl_old, tcl_new, reg_new;
 	UINT result;
 
-	result = MsiGetFeatureStateW(hInstall, L"Extensions", &ext_old, &ext_new);
+	result = MsiGetFeatureStateA(hInstall, "Extensions", &ext_old, &ext_new);
 	if (result != ERROR_SUCCESS)
 		return result;
-	result = MsiGetFeatureStateW(hInstall, L"TclTk", &tcl_old, &tcl_new);
+	result = MsiGetFeatureStateA(hInstall, "TclTk", &tcl_old, &tcl_new);
 	if (result != ERROR_SUCCESS)
 		return result;
 
@@ -76,7 +89,7 @@
 	} else { 
 		reg_new = INSTALLSTATE_ABSENT;
 	}
-	result = MsiSetComponentStateW(hInstall, L"REGISTRY.tcl", reg_new);
+	result = MsiSetComponentStateA(hInstall, "REGISTRY.tcl", reg_new);
 	return result;
 }
 



More information about the Python-checkins mailing list