cpython/Tools/msi/merge.py

76 lines
2.5 KiB
Python
Raw Normal View History

Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62055-62058,62060-62066,62068-62074,62076-62079,62081-62083,62086-62089,62092-62094,62098,62101,62104,62106-62109,62115-62122,62124-62125,62128,62130,62132,62134-62135,62137,62139-62140,62144,62146,62151,62155,62157,62162-62174 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r62167 | martin.v.loewis | 2008-04-05 17:45:25 +0200 (Sa, 05 Apr 2008) | 1 line Extend sizes of various fields, to support the CRT90 merge module. ........ r62168 | martin.v.loewis | 2008-04-05 17:48:36 +0200 (Sa, 05 Apr 2008) | 1 line Add two features to distinguish between private and SxS CRT. ........ r62169 | martin.v.loewis | 2008-04-05 17:50:58 +0200 (Sa, 05 Apr 2008) | 1 line Add script to merge msvcr90. ........ r62170 | andrew.kuchling | 2008-04-05 17:57:46 +0200 (Sa, 05 Apr 2008) | 1 line Markup fixes; write PEP 3118 section ........ r62173 | georg.brandl | 2008-04-05 19:45:58 +0200 (Sa, 05 Apr 2008) | 2 lines Mention that the tuple returned by __reduce__ is pickled as normal. ........ r62174 | andrew.kuchling | 2008-04-05 20:15:30 +0200 (Sa, 05 Apr 2008) | 1 line Write PEP 3119 section ........
2008-04-05 15:58:09 -03:00
import msilib,os,win32com,tempfile
PCBUILD="PCBuild"
from config import *
Win64 = "amd64" in PCBUILD
mod_dir = os.path.join(os.environ["ProgramFiles"], "Common Files", "Merge Modules")
if Win64:
modules = ["Microsoft_VC90_CRT_x86.msm", "policy_8_0_Microsoft_VC80_CRT_x86_x64.msm"]
msi = "python-%s.amd64.msi" % full_current_version
else:
modules = ["Microsoft_VC90_CRT_x86.msm","policy_8_0_Microsoft_VC80_CRT_x86.msm"]
msi = "python-%s.msi" % full_current_version
for i, n in enumerate(modules):
modules[i] = os.path.join(mod_dir, n)
def merge(msi, feature, rootdir, modules):
cab_and_filecount = []
# Step 1: Merge databases, extract cabfiles
m = msilib.MakeMerge2()
m.OpenLog("merge.log")
print "Opened Log"
m.OpenDatabase(msi)
print "Opened DB"
for module in modules:
print module
m.OpenModule(module,0)
print "Opened Module",module
m.Merge(feature, rootdir)
print "Errors:"
for e in m.Errors:
print e.Type, e.ModuleTable, e.DatabaseTable
print " Modkeys:",
for s in e.ModuleKeys: print s,
print
print " DBKeys:",
for s in e.DatabaseKeys: print s,
print
cabname = tempfile.mktemp(suffix=".cab")
m.ExtractCAB(cabname)
cab_and_filecount.append((cabname, len(m.ModuleFiles)))
m.CloseModule()
m.CloseDatabase(True)
m.CloseLog()
# Step 2: Add CAB files
i = msilib.MakeInstaller()
db = i.OpenDatabase(msi, win32com.client.constants.msiOpenDatabaseModeTransact)
v = db.OpenView("SELECT LastSequence FROM Media")
v.Execute(None)
maxmedia = -1
while 1:
r = v.Fetch()
if not r: break
seq = r.IntegerData(1)
if seq > maxmedia:
maxmedia = seq
print "Start of Media", maxmedia
for cabname, count in cab_and_filecount:
stream = "merged%d" % maxmedia
msilib.add_data(db, "Media",
[(maxmedia+1, maxmedia+count, None, "#"+stream, None, None)])
msilib.add_stream(db, stream, cabname)
os.unlink(cabname)
maxmedia += count
# The merge module sets ALLUSERS to 1 in the property table.
# This is undesired; delete that
v = db.OpenView("DELETE FROM Property WHERE Property='ALLUSERS'")
v.Execute(None)
v.Close()
Merged revisions 61440-61441,61443,61445-61448,61451-61452,61455-61457,61459-61464,61466-61467,61469-61470,61476-61477,61479,61481-61482,61485,61487,61490,61493-61494,61497,61499-61502,61505-61506,61508,61511-61514,61519,61521-61522,61530-61531,61533-61537,61541-61555,61557-61558,61561-61562,61566-61569,61572-61574,61578-61579,61583-61584,61588-61589,61592,61594,61598-61601,61603-61604,61607-61612,61617,61619-61620,61624,61626,61628-61630,61635-61638,61640-61643,61645,61648,61653-61655,61659-61662,61664,61666,61668-61671,61673,61675,61679-61680,61682,61685-61686,61689-61695,61697-61699,61701-61703,61706,61710,61713,61717,61723,61726-61730,61736,61738,61740,61742,61745-61752,61754-61760,61762-61764,61768,61770-61772,61774-61775,61784-61787,61789-61792,61794-61795,61797-61806,61808-61809,61811-61812,61814-61819,61824,61826-61833,61835-61840,61843-61845,61848,61850,61854-61862,61865-61866,61868,61872-61873,61876-61877,61883-61888,61890-61891,61893-61899,61901-61903,61905-61912,61914,61917,61920-61921,61927,61930,61932-61934,61939,61941-61942,61944-61951,61955,61960-61963,61980,61982-61983,61991,61994-61996,62001-62003,62008-62010,62016-62017,62022,62024,62027,62031-62034,62041,62045-62046,62055-62058,62060-62066,62068-62074,62076-62079,62081-62083,62086-62089,62092-62094,62098,62101,62104,62106-62109,62115-62122,62124-62125,62128,62130,62132,62134-62135,62137,62139-62140,62144,62146,62151,62155,62157,62162-62174 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r62167 | martin.v.loewis | 2008-04-05 17:45:25 +0200 (Sa, 05 Apr 2008) | 1 line Extend sizes of various fields, to support the CRT90 merge module. ........ r62168 | martin.v.loewis | 2008-04-05 17:48:36 +0200 (Sa, 05 Apr 2008) | 1 line Add two features to distinguish between private and SxS CRT. ........ r62169 | martin.v.loewis | 2008-04-05 17:50:58 +0200 (Sa, 05 Apr 2008) | 1 line Add script to merge msvcr90. ........ r62170 | andrew.kuchling | 2008-04-05 17:57:46 +0200 (Sa, 05 Apr 2008) | 1 line Markup fixes; write PEP 3118 section ........ r62173 | georg.brandl | 2008-04-05 19:45:58 +0200 (Sa, 05 Apr 2008) | 2 lines Mention that the tuple returned by __reduce__ is pickled as normal. ........ r62174 | andrew.kuchling | 2008-04-05 20:15:30 +0200 (Sa, 05 Apr 2008) | 1 line Write PEP 3119 section ........
2008-04-05 15:58:09 -03:00
db.Commit()
merge(msi, "SharedCRT", "TARGETDIR", modules)