Commit 3b6cc095 authored by Martin v. Löwis's avatar Martin v. Löwis

Revert r63378. These files need to stay compatible with Python 2.x (until...

Revert r63378. These files need to stay compatible with Python 2.x (until Python 3.0 is actually used to package Python).
parent 5a722409
...@@ -19,23 +19,23 @@ def merge(msi, feature, rootdir, modules): ...@@ -19,23 +19,23 @@ def merge(msi, feature, rootdir, modules):
# Step 1: Merge databases, extract cabfiles # Step 1: Merge databases, extract cabfiles
m = msilib.MakeMerge2() m = msilib.MakeMerge2()
m.OpenLog("merge.log") m.OpenLog("merge.log")
print("Opened Log") print "Opened Log"
m.OpenDatabase(msi) m.OpenDatabase(msi)
print("Opened DB") print "Opened DB"
for module in modules: for module in modules:
print(module) print module
m.OpenModule(module,0) m.OpenModule(module,0)
print("Opened Module",module) print "Opened Module",module
m.Merge(feature, rootdir) m.Merge(feature, rootdir)
print("Errors:") print "Errors:"
for e in m.Errors: for e in m.Errors:
print(e.Type, e.ModuleTable, e.DatabaseTable) print e.Type, e.ModuleTable, e.DatabaseTable
print(" Modkeys:", end=' ') print " Modkeys:",
for s in e.ModuleKeys: print(s, end=' ') for s in e.ModuleKeys: print s,
print() print
print(" DBKeys:", end=' ') print " DBKeys:",
for s in e.DatabaseKeys: print(s, end=' ') for s in e.DatabaseKeys: print s,
print() print
cabname = tempfile.mktemp(suffix=".cab") cabname = tempfile.mktemp(suffix=".cab")
m.ExtractCAB(cabname) m.ExtractCAB(cabname)
cab_and_filecount.append((cabname, len(m.ModuleFiles))) cab_and_filecount.append((cabname, len(m.ModuleFiles)))
...@@ -56,7 +56,7 @@ def merge(msi, feature, rootdir, modules): ...@@ -56,7 +56,7 @@ def merge(msi, feature, rootdir, modules):
seq = r.IntegerData(1) seq = r.IntegerData(1)
if seq > maxmedia: if seq > maxmedia:
maxmedia = seq maxmedia = seq
print("Start of Media", maxmedia) print "Start of Media", maxmedia
for cabname, count in cab_and_filecount: for cabname, count in cab_and_filecount:
stream = "merged%d" % maxmedia stream = "merged%d" % maxmedia
......
...@@ -204,7 +204,7 @@ def build_database(): ...@@ -204,7 +204,7 @@ def build_database():
schema, ProductName="Python "+full_current_version, schema, ProductName="Python "+full_current_version,
ProductCode=product_code, ProductCode=product_code,
ProductVersion=current_version, ProductVersion=current_version,
Manufacturer="Python Software Foundation") Manufacturer=u"Python Software Foundation")
# The default sequencing of the RemoveExistingProducts action causes # The default sequencing of the RemoveExistingProducts action causes
# removal of files that got just installed. Place it after # removal of files that got just installed. Place it after
# InstallInitialize, so we first uninstall everything, but still roll # InstallInitialize, so we first uninstall everything, but still roll
......
...@@ -5,7 +5,12 @@ import win32com.client.gencache ...@@ -5,7 +5,12 @@ import win32com.client.gencache
import win32com.client import win32com.client
import pythoncom, pywintypes import pythoncom, pywintypes
from win32com.client import constants from win32com.client import constants
import re, string, os, sets, glob, subprocess, sys, winreg, struct import re, string, os, sets, glob, subprocess, sys, _winreg, struct
try:
basestring
except NameError:
basestring = (str, unicode)
# Partially taken from Wine # Partially taken from Wine
datasizemask= 0x00ff datasizemask= 0x00ff
...@@ -90,7 +95,7 @@ class Table: ...@@ -90,7 +95,7 @@ class Table:
index -= 1 index -= 1
unk = type & ~knownbits unk = type & ~knownbits
if unk: if unk:
print("%s.%s unknown bits %x" % (self.name, name, unk)) print "%s.%s unknown bits %x" % (self.name, name, unk)
size = type & datasizemask size = type & datasizemask
dtype = type & typemask dtype = type & typemask
if dtype == type_string: if dtype == type_string:
...@@ -109,7 +114,7 @@ class Table: ...@@ -109,7 +114,7 @@ class Table:
tname="OBJECT" tname="OBJECT"
else: else:
tname="unknown" tname="unknown"
print("%s.%sunknown integer type %d" % (self.name, name, size)) print "%s.%sunknown integer type %d" % (self.name, name, size)
if type & type_nullable: if type & type_nullable:
flags = "" flags = ""
else: else:
...@@ -168,14 +173,14 @@ def gen_schema(destpath, schemapath): ...@@ -168,14 +173,14 @@ def gen_schema(destpath, schemapath):
r = v.Fetch() r = v.Fetch()
if not r:break if not r:break
# Table, Column, Nullable # Table, Column, Nullable
f.write("(%r,%r,%r," % f.write("(%s,%s,%s," %
(r.StringData(1), r.StringData(2), r.StringData(3))) (`r.StringData(1)`, `r.StringData(2)`, `r.StringData(3)`))
def put_int(i): def put_int(i):
if r.IsNull(i):f.write("None, ") if r.IsNull(i):f.write("None, ")
else:f.write("%d," % r.IntegerData(i)) else:f.write("%d," % r.IntegerData(i))
def put_str(i): def put_str(i):
if r.IsNull(i):f.write("None, ") if r.IsNull(i):f.write("None, ")
else:f.write("%r," % r.StringData(i)) else:f.write("%s," % `r.StringData(i)`)
put_int(4) # MinValue put_int(4) # MinValue
put_int(5) # MaxValue put_int(5) # MaxValue
put_str(6) # KeyTable put_str(6) # KeyTable
...@@ -197,7 +202,7 @@ def gen_sequence(destpath, msipath): ...@@ -197,7 +202,7 @@ def gen_sequence(destpath, msipath):
v = seqmsi.OpenView("SELECT * FROM _Tables"); v = seqmsi.OpenView("SELECT * FROM _Tables");
v.Execute(None) v.Execute(None)
f = open(destpath, "w") f = open(destpath, "w")
f.write("import msilib,os;dirname=os.path.dirname(__file__)\n") print >>f, "import msilib,os;dirname=os.path.dirname(__file__)"
tables = [] tables = []
while 1: while 1:
r = v.Fetch() r = v.Fetch()
...@@ -230,12 +235,12 @@ def gen_sequence(destpath, msipath): ...@@ -230,12 +235,12 @@ def gen_sequence(destpath, msipath):
else: else:
rec.append(bytes) rec.append(bytes)
else: else:
raise ValueError("Unsupported column type", info.StringData(i)) raise "Unsupported column type", info.StringData(i)
f.write(repr(tuple(rec))+",\n") f.write(repr(tuple(rec))+",\n")
v1.Close() v1.Close()
f.write("]\n\n") f.write("]\n\n")
v.Close() v.Close()
f.write("tables=%s\n" % repr(list(map(str,tables)))) f.write("tables=%s\n" % repr(map(str,tables)))
f.close() f.close()
class _Unspecified:pass class _Unspecified:pass
...@@ -249,7 +254,7 @@ def change_sequence(seq, action, seqno=_Unspecified, cond = _Unspecified): ...@@ -249,7 +254,7 @@ def change_sequence(seq, action, seqno=_Unspecified, cond = _Unspecified):
seqno = seq[i][2] seqno = seq[i][2]
seq[i] = (action, cond, seqno) seq[i] = (action, cond, seqno)
return return
raise ValueError("Action not found in sequence") raise ValueError, "Action not found in sequence"
def add_data(db, table, values): def add_data(db, table, values):
d = MakeInstaller() d = MakeInstaller()
...@@ -260,16 +265,16 @@ def add_data(db, table, values): ...@@ -260,16 +265,16 @@ def add_data(db, table, values):
assert len(value) == count, value assert len(value) == count, value
for i in range(count): for i in range(count):
field = value[i] field = value[i]
if isinstance(field, int): if isinstance(field, (int, long)):
r.SetIntegerData(i+1,field) r.SetIntegerData(i+1,field)
elif isinstance(field, str): elif isinstance(field, basestring):
r.SetStringData(i+1,field) r.SetStringData(i+1,field)
elif field is None: elif field is None:
pass pass
elif isinstance(field, Binary): elif isinstance(field, Binary):
r.SetStream(i+1, field.name) r.SetStream(i+1, field.name)
else: else:
raise TypeError("Unsupported type %s" % field.__class__.__name__) raise TypeError, "Unsupported type %s" % field.__class__.__name__
v.Modify(win32com.client.constants.msiViewModifyInsert, r) v.Modify(win32com.client.constants.msiViewModifyInsert, r)
r.ClearData() r.ClearData()
v.Close() v.Close()
...@@ -365,9 +370,9 @@ class CAB: ...@@ -365,9 +370,9 @@ class CAB:
logical = self.gen_id(dir, file) logical = self.gen_id(dir, file)
self.index += 1 self.index += 1
if full.find(" ")!=-1: if full.find(" ")!=-1:
self.file.write('"%s" %s\n' % (full, logical)) print >>self.file, '"%s" %s' % (full, logical)
else: else:
self.file.write('%s %s\n' % (full, logical)) print >>self.file, '%s %s' % (full, logical)
return self.index, logical return self.index, logical
def commit(self, db): def commit(self, db):
...@@ -382,9 +387,9 @@ class CAB: ...@@ -382,9 +387,9 @@ class CAB:
(r"Software\Microsoft\Win32SDK\Directories", "Install Dir"), (r"Software\Microsoft\Win32SDK\Directories", "Install Dir"),
]: ]:
try: try:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, k) key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, k)
dir = winreg.QueryValueEx(key, v)[0] dir = _winreg.QueryValueEx(key, v)[0]
winreg.CloseKey(key) _winreg.CloseKey(key)
except (WindowsError, IndexError): except (WindowsError, IndexError):
continue continue
cabarc = os.path.join(dir, r"Bin", "cabarc.exe") cabarc = os.path.join(dir, r"Bin", "cabarc.exe")
...@@ -392,7 +397,7 @@ class CAB: ...@@ -392,7 +397,7 @@ class CAB:
continue continue
break break
else: else:
print("WARNING: cabarc.exe not found in registry") print "WARNING: cabarc.exe not found in registry"
cabarc = "cabarc.exe" cabarc = "cabarc.exe"
cmd = r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name) cmd = r'"%s" -m lzx:21 n %s.cab @%s.txt' % (cabarc, self.name, self.name)
p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
...@@ -404,7 +409,7 @@ class CAB: ...@@ -404,7 +409,7 @@ class CAB:
sys.stdout.write(line) sys.stdout.write(line)
sys.stdout.flush() sys.stdout.flush()
if not os.path.exists(self.name+".cab"): if not os.path.exists(self.name+".cab"):
raise IOError("cabarc failed") raise IOError, "cabarc failed"
add_data(db, "Media", add_data(db, "Media",
[(1, self.index, None, "#"+self.name, None, None)]) [(1, self.index, None, "#"+self.name, None, None)])
add_stream(db, self.name, self.name+".cab") add_stream(db, self.name, self.name+".cab")
...@@ -523,7 +528,7 @@ class Directory: ...@@ -523,7 +528,7 @@ class Directory:
file = os.path.basename(file) file = os.path.basename(file)
absolute = os.path.join(self.absolute, src) absolute = os.path.join(self.absolute, src)
assert not re.search(r'[\?|><:/*]"', file) # restrictions on long names assert not re.search(r'[\?|><:/*]"', file) # restrictions on long names
if file in self.keyfiles: if self.keyfiles.has_key(file):
logical = self.keyfiles[file] logical = self.keyfiles[file]
else: else:
logical = None logical = None
...@@ -683,5 +688,5 @@ def set_arch_from_file(path): ...@@ -683,5 +688,5 @@ def set_arch_from_file(path):
Win64 = 1 Win64 = 1
arch_ext = '.amd64' arch_ext = '.amd64'
else: else:
raise ValueError("Unsupported architecture") raise ValueError, "Unsupported architecture"
msi_type += ";1033" msi_type += ";1033"
This source diff could not be displayed because it is too large. You can view the blob instead.
AdminExecuteSequence = [ AdminExecuteSequence = [
('InstallInitialize', None, 1500), (u'InstallInitialize', None, 1500),
('InstallFinalize', None, 6600), (u'InstallFinalize', None, 6600),
('InstallFiles', None, 4000), (u'InstallFiles', None, 4000),
('InstallAdminPackage', None, 3900), (u'InstallAdminPackage', None, 3900),
('FileCost', None, 900), (u'FileCost', None, 900),
('CostInitialize', None, 800), (u'CostInitialize', None, 800),
('CostFinalize', None, 1000), (u'CostFinalize', None, 1000),
('InstallValidate', None, 1400), (u'InstallValidate', None, 1400),
] ]
AdminUISequence = [ AdminUISequence = [
('FileCost', None, 900), (u'FileCost', None, 900),
('CostInitialize', None, 800), (u'CostInitialize', None, 800),
('CostFinalize', None, 1000), (u'CostFinalize', None, 1000),
('ExecuteAction', None, 1300), (u'ExecuteAction', None, 1300),
('ExitDialog', None, -1), (u'ExitDialog', None, -1),
('FatalError', None, -3), (u'FatalError', None, -3),
('UserExit', None, -2), (u'UserExit', None, -2),
] ]
AdvtExecuteSequence = [ AdvtExecuteSequence = [
('InstallInitialize', None, 1500), (u'InstallInitialize', None, 1500),
('InstallFinalize', None, 6600), (u'InstallFinalize', None, 6600),
('CostInitialize', None, 800), (u'CostInitialize', None, 800),
('CostFinalize', None, 1000), (u'CostFinalize', None, 1000),
('InstallValidate', None, 1400), (u'InstallValidate', None, 1400),
('CreateShortcuts', None, 4500), (u'CreateShortcuts', None, 4500),
('MsiPublishAssemblies', None, 6250), (u'MsiPublishAssemblies', None, 6250),
('PublishComponents', None, 6200), (u'PublishComponents', None, 6200),
('PublishFeatures', None, 6300), (u'PublishFeatures', None, 6300),
('PublishProduct', None, 6400), (u'PublishProduct', None, 6400),
('RegisterClassInfo', None, 4600), (u'RegisterClassInfo', None, 4600),
('RegisterExtensionInfo', None, 4700), (u'RegisterExtensionInfo', None, 4700),
('RegisterMIMEInfo', None, 4900), (u'RegisterMIMEInfo', None, 4900),
('RegisterProgIdInfo', None, 4800), (u'RegisterProgIdInfo', None, 4800),
] ]
InstallExecuteSequence = [ InstallExecuteSequence = [
('InstallInitialize', None, 1500), (u'InstallInitialize', None, 1500),
('InstallFinalize', None, 6600), (u'InstallFinalize', None, 6600),
('InstallFiles', None, 4000), (u'InstallFiles', None, 4000),
('FileCost', None, 900), (u'FileCost', None, 900),
('CostInitialize', None, 800), (u'CostInitialize', None, 800),
('CostFinalize', None, 1000), (u'CostFinalize', None, 1000),
('InstallValidate', None, 1400), (u'InstallValidate', None, 1400),
('CreateShortcuts', None, 4500), (u'CreateShortcuts', None, 4500),
('MsiPublishAssemblies', None, 6250), (u'MsiPublishAssemblies', None, 6250),
('PublishComponents', None, 6200), (u'PublishComponents', None, 6200),
('PublishFeatures', None, 6300), (u'PublishFeatures', None, 6300),
('PublishProduct', None, 6400), (u'PublishProduct', None, 6400),
('RegisterClassInfo', None, 4600), (u'RegisterClassInfo', None, 4600),
('RegisterExtensionInfo', None, 4700), (u'RegisterExtensionInfo', None, 4700),
('RegisterMIMEInfo', None, 4900), (u'RegisterMIMEInfo', None, 4900),
('RegisterProgIdInfo', None, 4800), (u'RegisterProgIdInfo', None, 4800),
('AllocateRegistrySpace', 'NOT Installed', 1550), (u'AllocateRegistrySpace', u'NOT Installed', 1550),
('AppSearch', None, 400), (u'AppSearch', None, 400),
('BindImage', None, 4300), (u'BindImage', None, 4300),
('CCPSearch', 'NOT Installed', 500), (u'CCPSearch', u'NOT Installed', 500),
('CreateFolders', None, 3700), (u'CreateFolders', None, 3700),
('DeleteServices', 'VersionNT', 2000), (u'DeleteServices', u'VersionNT', 2000),
('DuplicateFiles', None, 4210), (u'DuplicateFiles', None, 4210),
('FindRelatedProducts', None, 200), (u'FindRelatedProducts', None, 200),
('InstallODBC', None, 5400), (u'InstallODBC', None, 5400),
('InstallServices', 'VersionNT', 5800), (u'InstallServices', u'VersionNT', 5800),
('IsolateComponents', None, 950), (u'IsolateComponents', None, 950),
('LaunchConditions', None, 100), (u'LaunchConditions', None, 100),
('MigrateFeatureStates', None, 1200), (u'MigrateFeatureStates', None, 1200),
('MoveFiles', None, 3800), (u'MoveFiles', None, 3800),
('PatchFiles', None, 4090), (u'PatchFiles', None, 4090),
('ProcessComponents', None, 1600), (u'ProcessComponents', None, 1600),
('RegisterComPlus', None, 5700), (u'RegisterComPlus', None, 5700),
('RegisterFonts', None, 5300), (u'RegisterFonts', None, 5300),
('RegisterProduct', None, 6100), (u'RegisterProduct', None, 6100),
('RegisterTypeLibraries', None, 5500), (u'RegisterTypeLibraries', None, 5500),
('RegisterUser', None, 6000), (u'RegisterUser', None, 6000),
('RemoveDuplicateFiles', None, 3400), (u'RemoveDuplicateFiles', None, 3400),
('RemoveEnvironmentStrings', None, 3300), (u'RemoveEnvironmentStrings', None, 3300),
('RemoveExistingProducts', None, 6700), (u'RemoveExistingProducts', None, 6700),
('RemoveFiles', None, 3500), (u'RemoveFiles', None, 3500),
('RemoveFolders', None, 3600), (u'RemoveFolders', None, 3600),
('RemoveIniValues', None, 3100), (u'RemoveIniValues', None, 3100),
('RemoveODBC', None, 2400), (u'RemoveODBC', None, 2400),
('RemoveRegistryValues', None, 2600), (u'RemoveRegistryValues', None, 2600),
('RemoveShortcuts', None, 3200), (u'RemoveShortcuts', None, 3200),
('RMCCPSearch', 'NOT Installed', 600), (u'RMCCPSearch', u'NOT Installed', 600),
('SelfRegModules', None, 5600), (u'SelfRegModules', None, 5600),
('SelfUnregModules', None, 2200), (u'SelfUnregModules', None, 2200),
('SetODBCFolders', None, 1100), (u'SetODBCFolders', None, 1100),
('StartServices', 'VersionNT', 5900), (u'StartServices', u'VersionNT', 5900),
('StopServices', 'VersionNT', 1900), (u'StopServices', u'VersionNT', 1900),
('MsiUnpublishAssemblies', None, 1750), (u'MsiUnpublishAssemblies', None, 1750),
('UnpublishComponents', None, 1700), (u'UnpublishComponents', None, 1700),
('UnpublishFeatures', None, 1800), (u'UnpublishFeatures', None, 1800),
('UnregisterClassInfo', None, 2700), (u'UnregisterClassInfo', None, 2700),
('UnregisterComPlus', None, 2100), (u'UnregisterComPlus', None, 2100),
('UnregisterExtensionInfo', None, 2800), (u'UnregisterExtensionInfo', None, 2800),
('UnregisterFonts', None, 2500), (u'UnregisterFonts', None, 2500),
('UnregisterMIMEInfo', None, 3000), (u'UnregisterMIMEInfo', None, 3000),
('UnregisterProgIdInfo', None, 2900), (u'UnregisterProgIdInfo', None, 2900),
('UnregisterTypeLibraries', None, 2300), (u'UnregisterTypeLibraries', None, 2300),
('ValidateProductID', None, 700), (u'ValidateProductID', None, 700),
('WriteEnvironmentStrings', None, 5200), (u'WriteEnvironmentStrings', None, 5200),
('WriteIniValues', None, 5100), (u'WriteIniValues', None, 5100),
('WriteRegistryValues', None, 5000), (u'WriteRegistryValues', None, 5000),
] ]
InstallUISequence = [ InstallUISequence = [
('FileCost', None, 900), (u'FileCost', None, 900),
('CostInitialize', None, 800), (u'CostInitialize', None, 800),
('CostFinalize', None, 1000), (u'CostFinalize', None, 1000),
('ExecuteAction', None, 1300), (u'ExecuteAction', None, 1300),
('ExitDialog', None, -1), (u'ExitDialog', None, -1),
('FatalError', None, -3), (u'FatalError', None, -3),
('UserExit', None, -2), (u'UserExit', None, -2),
('AppSearch', None, 400), (u'AppSearch', None, 400),
('CCPSearch', 'NOT Installed', 500), (u'CCPSearch', u'NOT Installed', 500),
('FindRelatedProducts', None, 200), (u'FindRelatedProducts', None, 200),
('IsolateComponents', None, 950), (u'IsolateComponents', None, 950),
('LaunchConditions', None, 100), (u'LaunchConditions', None, 100),
('MigrateFeatureStates', None, 1200), (u'MigrateFeatureStates', None, 1200),
('RMCCPSearch', 'NOT Installed', 600), (u'RMCCPSearch', u'NOT Installed', 600),
('ValidateProductID', None, 700), (u'ValidateProductID', None, 700),
] ]
tables=['AdminExecuteSequence', 'AdminUISequence', 'AdvtExecuteSequence', 'InstallExecuteSequence', 'InstallUISequence'] tables=['AdminExecuteSequence', 'AdminUISequence', 'AdvtExecuteSequence', 'InstallExecuteSequence', 'InstallUISequence']
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment