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