Changeset 388 for python/vendor/current/Tools/msi
- Timestamp:
- Mar 19, 2014, 11:11:30 AM (11 years ago)
- Location:
- python/vendor/current/Tools/msi
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
python/vendor/current/Tools/msi/msi.py
r2 r388 2 2 # (C) 2003 Martin v. Loewis 3 3 # See "FOO" in comments refers to MSDN sections with the title FOO. 4 import msilib, schema, sequence, os, glob, time, re, shutil 4 import msilib, schema, sequence, os, glob, time, re, shutil, zipfile 5 5 from msilib import Feature, CAB, Directory, Dialog, Binary, add_data 6 6 import uisample … … 8 8 from distutils.spawn import find_executable 9 9 from uuids import product_codes 10 import tempfile 10 11 11 12 # Settings can be overridden in config.py below … … 29 30 # msvcrt version 30 31 MSVCR = "90" 32 # Name of certificate in default store to sign MSI with 33 certname = None 34 # Make a zip file containing the PDB files for this build? 35 pdbzip = True 31 36 32 37 try: … … 112 117 "25":"{2e41b118-38bd-4c1b-a840-6977efd1b911}", 113 118 "26":"{34ebecac-f046-4e1c-b0e3-9bac3cdaacfa}", 119 "27":"{4fe21c76-1760-437b-a2f2-99909130a175}", 114 120 } [major+minor] 115 121 116 122 # Compute the name that Sphinx gives to the docfile 117 123 docfile = "" 118 if micro:119 docfile = str(micro)124 if int(micro): 125 docfile = micro 120 126 if level < 0xf: 121 docfile += '%x%s' % (level, serial) 127 if level == 0xC: 128 docfile += "rc%s" % (serial,) 129 else: 130 docfile += '%x%s' % (level, serial) 122 131 docfile = 'python%s%s%s.chm' % (major, minor, docfile) 123 132 … … 168 177 have_mingw = build_mingw_lib(lib_file, def_file, dll_file, mingw_lib) 169 178 170 # Determine the target architechture 179 # Determine the target architecture 180 if os.system("nmake /nologo /c /f msisupport.mak") != 0: 181 raise RuntimeError("'nmake /f msisupport.mak' failed") 171 182 dll_path = os.path.join(srcdir, PCBUILD, dll_file) 172 183 msilib.set_arch_from_file(dll_path) … … 215 226 # sequence is the set of standard sequences 216 227 # (ui/execute, admin/advt/install) 217 db = msilib.init_database("python-%s%s.msi" % (full_current_version, msilib.arch_ext), 228 msiname = "python-%s%s.msi" % (full_current_version, msilib.arch_ext) 229 db = msilib.init_database(msiname, 218 230 schema, ProductName="Python "+full_current_version+productsuffix, 219 231 ProductCode=product_code, … … 238 250 ]) 239 251 db.Commit() 240 return db 252 return db, msiname 241 253 242 254 def remove_old_versions(db): … … 365 377 # the installed/uninstalled state according to both the 366 378 # Extensions and TclTk features. 367 if os.system("nmake /nologo /c /f msisupport.mak") != 0:368 raise "'nmake /f msisupport.mak' failed"369 379 add_data(db, "Binary", [("Script", msilib.Binary("msisupport.dll"))]) 370 380 # See "Custom Action Type 1" … … 399 409 ]) 400 410 401 compileargs = r'-Wi "[TARGETDIR]Lib\compileall.py" -f -x bad_coding|badsyntax|site-packages|py3_"[TARGETDIR]Lib"'411 compileargs = r'-Wi "[TARGETDIR]Lib\compileall.py" -f -x "bad_coding|badsyntax|site-packages|py3_" "[TARGETDIR]Lib"' 402 412 lib2to3args = r'-c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()"' 403 413 # See "CustomAction Table" … … 486 496 exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title, 487 497 "Finish", "Finish", "Finish") 488 exit_dialog.title("Complet ingthe [ProductName] Installer")498 exit_dialog.title("Complete the [ProductName] Installer") 489 499 exit_dialog.back("< Back", "Finish", active = 0) 490 500 exit_dialog.cancel("Cancel", "Back", active = 0) … … 496 506 497 507 c = exit_dialog.text("warning", 135, 200, 220, 40, 0x30003, 498 "{\\VerdanaRed9}Warning: Python 2.5.xis the last "499 "Python release for Windows 9x.")500 c.condition("Hide", " NOT Version9X")508 "{\\VerdanaRed9}Warning: Python 3.3.0 is the last " 509 "Python release for Windows 2000.") 510 c.condition("Hide", "VersionNT > 500") 501 511 502 512 exit_dialog.text("Description", 135, 235, 220, 20, 0x30003, … … 1002 1012 lib.add_file("cfgparser.1") 1003 1013 lib.add_file("sgml_input.html") 1004 lib.add_file("test.xml")1005 lib.add_file("test.xml.out")1006 1014 lib.add_file("testtar.tar") 1007 1015 lib.add_file("test_difflib_expect.html") … … 1012 1020 lib.glob("*.pem") 1013 1021 lib.glob("*.pck") 1014 lib.add_file("readme.txt", src="README")1015 1022 lib.add_file("zipdir.zip") 1023 if dir=='tests' and parent.physical=='distutils': 1024 lib.add_file("Setup.sample") 1016 1025 if dir=='decimaltestdata': 1017 1026 lib.glob("*.decTest") 1027 if dir=='xmltestdata': 1028 lib.glob("*.xml") 1029 lib.add_file("test.xml.out") 1018 1030 if dir=='output': 1019 1031 lib.glob("test_*") … … 1188 1200 tcl_verbs=[ 1189 1201 ("py.IDLE", -1, pat % (testprefix, "", ewi), "", 1190 r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" - n -e "%1"',1202 r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" -e "%1"', 1191 1203 "REGISTRY.tcl"), 1192 1204 ("pyw.IDLE", -1, pat % (testprefix, "NoCon", ewi), "", 1193 r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" - n -e "%1"',1205 r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" -e "%1"', 1194 1206 "REGISTRY.tcl"), 1195 1207 ] … … 1290 1302 db.Commit() 1291 1303 1292 db = build_database() 1304 def build_pdbzip(): 1305 pdbexclude = ['kill_python.pdb', 'make_buildinfo.pdb', 1306 'make_versioninfo.pdb'] 1307 path = "python-%s%s-pdb.zip" % (full_current_version, msilib.arch_ext) 1308 pdbzip = zipfile.ZipFile(path, 'w') 1309 for f in glob.glob1(os.path.join(srcdir, PCBUILD), "*.pdb"): 1310 if f not in pdbexclude and not f.endswith('_d.pdb'): 1311 pdbzip.write(os.path.join(srcdir, PCBUILD, f), f) 1312 pdbzip.close() 1313 1314 db,msiname = build_database() 1293 1315 try: 1294 1316 add_features(db) … … 1300 1322 finally: 1301 1323 del db 1324 1325 # Merge CRT into MSI file. This requires the database to be closed. 1326 mod_dir = os.path.join(os.environ["ProgramFiles"], "Common Files", "Merge Modules") 1327 if msilib.Win64: 1328 modules = ["Microsoft_VC90_CRT_x86_x64.msm", "policy_9_0_Microsoft_VC90_CRT_x86_x64.msm"] 1329 else: 1330 modules = ["Microsoft_VC90_CRT_x86.msm","policy_9_0_Microsoft_VC90_CRT_x86.msm"] 1331 1332 for i, n in enumerate(modules): 1333 modules[i] = os.path.join(mod_dir, n) 1334 1335 def merge(msi, feature, rootdir, modules): 1336 cab_and_filecount = [] 1337 # Step 1: Merge databases, extract cabfiles 1338 m = msilib.MakeMerge2() 1339 m.OpenLog("merge.log") 1340 m.OpenDatabase(msi) 1341 for module in modules: 1342 print module 1343 m.OpenModule(module,0) 1344 m.Merge(feature, rootdir) 1345 print "Errors:" 1346 for e in m.Errors: 1347 print e.Type, e.ModuleTable, e.DatabaseTable 1348 print " Modkeys:", 1349 for s in e.ModuleKeys: print s, 1350 print 1351 print " DBKeys:", 1352 for s in e.DatabaseKeys: print s, 1353 print 1354 cabname = tempfile.mktemp(suffix=".cab") 1355 m.ExtractCAB(cabname) 1356 cab_and_filecount.append((cabname, len(m.ModuleFiles))) 1357 m.CloseModule() 1358 m.CloseDatabase(True) 1359 m.CloseLog() 1360 1361 # Step 2: Add CAB files 1362 i = msilib.MakeInstaller() 1363 db = i.OpenDatabase(msi, constants.msiOpenDatabaseModeTransact) 1364 1365 v = db.OpenView("SELECT LastSequence FROM Media") 1366 v.Execute(None) 1367 maxmedia = -1 1368 while 1: 1369 r = v.Fetch() 1370 if not r: break 1371 seq = r.IntegerData(1) 1372 if seq > maxmedia: 1373 maxmedia = seq 1374 print "Start of Media", maxmedia 1375 1376 for cabname, count in cab_and_filecount: 1377 stream = "merged%d" % maxmedia 1378 msilib.add_data(db, "Media", 1379 [(maxmedia+1, maxmedia+count, None, "#"+stream, None, None)]) 1380 msilib.add_stream(db, stream, cabname) 1381 os.unlink(cabname) 1382 maxmedia += count 1383 # The merge module sets ALLUSERS to 1 in the property table. 1384 # This is undesired; delete that 1385 v = db.OpenView("DELETE FROM Property WHERE Property='ALLUSERS'") 1386 v.Execute(None) 1387 v.Close() 1388 db.Commit() 1389 1390 merge(msiname, "SharedCRT", "TARGETDIR", modules) 1391 1392 # certname (from config.py) should be (a substring of) 1393 # the certificate subject, e.g. "Python Software Foundation" 1394 if certname: 1395 os.system('signtool sign /n "%s" ' 1396 '/t http://timestamp.verisign.com/scripts/timestamp.dll ' 1397 '/d "Python %s" ' 1398 '%s' % (certname, full_current_version, msiname)) 1399 1400 if pdbzip: 1401 build_pdbzip() -
python/vendor/current/Tools/msi/msilib.py
r2 r388 306 306 # Fill the validation table 307 307 add_data(db, "_Validation", schema._Validation_records) 308 # Initialize the summary information, allowing at most 20 properties308 # Initialize the summary information, allowing at most 20 properties 309 309 si = db.GetSummaryInformation(20) 310 310 si.SetProperty(PID_TITLE, "Installation Database") … … 517 517 def add_file(self, file, src=None, version=None, language=None): 518 518 """Add a file to the current component of the directory, starting a new one 519 oneif there is no current component. By default, the file name in the source519 if there is no current component. By default, the file name in the source 520 520 and the file table will be identical. If the src file is specified, it is 521 521 interpreted relative to the current directory. Optionally, a version and a -
python/vendor/current/Tools/msi/msisupport.c
r2 r388 8 8 static UINT debug(MSIHANDLE hInstall, LPCSTR msg) 9 9 { 10 11 12 13 14 15 16 10 MSIHANDLE hRec = MsiCreateRecord(1); 11 if (!hRec || MsiRecordSetStringA(hRec, 1, msg) != ERROR_SUCCESS) { 12 return ERROR_INSTALL_FAILURE; 13 } 14 MsiProcessMessage(hInstall, INSTALLMESSAGE_INFO, hRec); 15 MsiCloseHandle(hRec); 16 return ERROR_SUCCESS; 17 17 } 18 18 … … 23 23 { 24 24 #define PSIZE 1024 25 26 27 28 29 25 WCHAR wpath[PSIZE]; 26 char path[PSIZE]; 27 UINT result; 28 DWORD size = PSIZE; 29 DWORD attributes; 30 30 31 32 result = MsiGetPropertyW(hInstall, L"TARGETDIR", wpath, &size);33 if (result != ERROR_SUCCESS)34 return result;35 wpath[size] = L'\0';36 path[size] = L'\0';37 31 38 attributes = GetFileAttributesW(wpath); 39 if (attributes == INVALID_FILE_ATTRIBUTES || 40 !(attributes & FILE_ATTRIBUTE_DIRECTORY)) 41 { 42 return MsiSetPropertyA(hInstall, "TargetExists", "0"); 43 } else { 44 return MsiSetPropertyA(hInstall, "TargetExists", "1"); 45 } 32 result = MsiGetPropertyW(hInstall, L"TARGETDIR", wpath, &size); 33 if (result != ERROR_SUCCESS) 34 return result; 35 wpath[size] = L'\0'; 36 path[size] = L'\0'; 37 38 attributes = GetFileAttributesW(wpath); 39 if (attributes == INVALID_FILE_ATTRIBUTES || 40 !(attributes & FILE_ATTRIBUTE_DIRECTORY)) 41 { 42 return MsiSetPropertyA(hInstall, "TargetExists", "0"); 43 } else { 44 return MsiSetPropertyA(hInstall, "TargetExists", "1"); 45 } 46 46 } 47 47 … … 52 52 UINT __declspec(dllexport) __stdcall UpdateEditIDLE(MSIHANDLE hInstall) 53 53 { 54 55 54 INSTALLSTATE ext_old, ext_new, tcl_old, tcl_new, reg_new; 55 UINT result; 56 56 57 58 59 60 61 62 57 result = MsiGetFeatureStateA(hInstall, "Extensions", &ext_old, &ext_new); 58 if (result != ERROR_SUCCESS) 59 return result; 60 result = MsiGetFeatureStateA(hInstall, "TclTk", &tcl_old, &tcl_new); 61 if (result != ERROR_SUCCESS) 62 return result; 63 63 64 65 66 67 68 69 70 64 /* If the current state is Absent, and the user did not select 65 the feature in the UI, Installer apparently sets the "selected" 66 state to unknown. Update it to the current value, then. */ 67 if (ext_new == INSTALLSTATE_UNKNOWN) 68 ext_new = ext_old; 69 if (tcl_new == INSTALLSTATE_UNKNOWN) 70 tcl_new = tcl_old; 71 71 72 73 74 75 76 77 78 79 80 } else { 81 82 83 84 72 // XXX consider current state of REGISTRY.tcl? 73 if (((tcl_new == INSTALLSTATE_LOCAL) || 74 (tcl_new == INSTALLSTATE_SOURCE) || 75 (tcl_new == INSTALLSTATE_DEFAULT)) && 76 ((ext_new == INSTALLSTATE_LOCAL) || 77 (ext_new == INSTALLSTATE_SOURCE) || 78 (ext_new == INSTALLSTATE_DEFAULT))) { 79 reg_new = INSTALLSTATE_SOURCE; 80 } else { 81 reg_new = INSTALLSTATE_ABSENT; 82 } 83 result = MsiSetComponentStateA(hInstall, "REGISTRY.tcl", reg_new); 84 return result; 85 85 } 86 86 87 BOOL APIENTRY DllMain(HANDLE hModule, 88 DWORD ul_reason_for_call, 87 BOOL APIENTRY DllMain(HANDLE hModule, 88 DWORD ul_reason_for_call, 89 89 LPVOID lpReserved) 90 90 { -
python/vendor/current/Tools/msi/uuids.py
r2 r388 8 8 # so people can refer to them. 9 9 product_codes = { 10 '2.4.101': '{0e9b4d8e-6cda-446e-a208-7b92f3ddffa0}', # 2.4a1, released as a snapshot11 '2.4.102': '{1b998745-4901-4edb-bc52-213689e1b922}', # 2.4a212 '2.4.103': '{33fc8bd2-1e8f-4add-a40a-ade2728d5942}', # 2.4a313 '2.4.111': '{51a7e2a8-2025-4ef0-86ff-e6aab742d1fa}', # 2.4b114 '2.4.112': '{4a5e7c1d-c659-4fe3-b8c9-7c65bd9c95a5}', # 2.4b215 '2.4.121': '{75508821-a8e9-40a8-95bd-dbe6033ddbea}', # 2.4c116 '2.4.122': '{83a9118b-4bdd-473b-afc3-bcb142feca9e}', # 2.4c217 '2.4.150': '{82d9302e-f209-4805-b548-52087047483a}', # 2.4.018 '2.4.1121':'{be027411-8e6b-4440-a29b-b07df0690230}', # 2.4.1c119 '2.4.1122':'{02818752-48bf-4074-a281-7a4114c4f1b1}', # 2.4.1c220 '2.4.1150':'{4d4f5346-7e4a-40b5-9387-fdb6181357fc}', # 2.4.121 '2.4.2121':'{5ef9d6b6-df78-45d2-ab09-14786a3c5a99}', # 2.4.2c122 '2.4.2150':'{b191e49c-ea23-43b2-b28a-14e0784069b8}', # 2.4.223 '2.4.3121':'{f669ed4d-1dce-41c4-9617-d985397187a1}', # 2.4.3c124 '2.4.3150':'{75e71add-042c-4f30-bfac-a9ec42351313}', # 2.4.325 '2.4.4121':'{cd2862db-22a4-4688-8772-85407ea21550}', # 2.4.4c126 '2.4.4150':'{60e2c8c9-6cf3-4b1a-9618-e304946c94e6}', # 2.4.427 10 '2.5.101': '{bc14ce3e-5e72-4a64-ac1f-bf59a571898c}', # 2.5a1 28 11 '2.5.102': '{5eed51c1-8e9d-4071-94c5-b40de5d49ba5}', # 2.5a2 … … 59 42 '2.6.5122':'{fa227b76-0671-4dc6-b826-c2ff2a70dfd5}', # 2.6.5c2 60 43 '2.6.5150':'{4723f199-fa64-4233-8e6e-9fccc95a18ee}', # 2.6.5 44 '2.7.101': '{eca1bbef-432c-49ae-a667-c213cc7bbf22}', # 2.7a1 45 '2.7.102': '{21ce16ed-73c4-460d-9b11-522f417b2090}', # 2.7a2 46 '2.7.103': '{6e7dbd55-ba4a-48ac-a688-6c75db4d7500}', # 2.7a3 47 '2.7.104': '{ee774ba3-74a5-48d9-b425-b35a287260c8}', # 2.7a4 48 '2.7.111': '{9cfd9ec7-a9c7-4980-a1c6-054fc6493eb3}', # 2.7b1 49 '2.7.112': '{9a72faf6-c304-4165-8595-9291ff30cac6}', # 2.7b2 50 '2.7.121': '{f530c94a-dd53-4de9-948e-b632b9cb48d2}', # 2.7c1 51 '2.7.122': '{f80905d2-dd8d-4b8e-8a40-c23c93dca07d}', # 2.7c2 52 '2.7.150': '{20c31435-2a0a-4580-be8b-ac06fc243ca4}', # 2.7.0 53 '2.7.1121':'{60a4036a-374c-4fd2-84b9-bfae7db03931}', # 2.7.1rc1 54 '2.7.1122':'{5965e7d1-5584-4de9-b13a-694e0b2ee3a6}', # 2.7.1rc2 55 '2.7.1150':'{32939827-d8e5-470a-b126-870db3c69fdf}', # 2.7.1 56 '2.7.2121':'{B2E1F06E-F719-4786-972A-488A336EB2A0}', # 2.7.2rc1 57 '2.7.2150':'{2E295B5B-1AD4-4d36-97C2-A316084722CF}', # 2.7.2 58 '2.7.3121':'{1ACB88BF-1425-4f11-B664-6C89A3D7699C}', # 2.7.3rc1 59 '2.7.3122':'{B12311BE-6364-4b2a-A49A-551EEE10F3E4}', # 2.7.3rc2 60 '2.7.3150':'{C0C31BCC-56FB-42a7-8766-D29E1BD74C7C}', # 2.7.3 61 '2.7.4121':'{47F45F45-72D7-4e54-AF41-26767EDE95CF}', # 2.7.4rc1 62 '2.7.4150':'{84ADC96C-B7E0-4938-9D6E-2B640D5DA224}', # 2.7.4 63 '2.7.5150':'{DBDD570E-0952-475f-9453-AB88F3DD5659}', # 2.7.5 64 '2.7.6121':'{D1EBC07F-A7B1-4163-83DB-AE813CEF392F}', # 2.7.6rc1 65 '2.7.6150':'{C3CC4DF5-39A5-4027-B136-2B3E1F5AB6E2}', # 2.7.6 61 66 }
Note:
See TracChangeset
for help on using the changeset viewer.