[Python-checkins] python/nondist/sandbox/msi msi.py,1.5,1.6
loewis at users.sourceforge.net
loewis at users.sourceforge.net
Sat Jan 17 15:51:26 EST 2004
Update of /cvsroot/python/python/nondist/sandbox/msi
In directory sc8-pr-cvs1:/tmp/cvs-serv681
Modified Files:
msi.py
Log Message:
Attempt to remove existing versions.
Check whether target dir exists.
Silence some validation warnings.
Index: msi.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/msi/msi.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** msi.py 7 Jan 2004 22:04:10 -0000 1.5
--- msi.py 17 Jan 2004 20:51:24 -0000 1.6
***************
*** 13,23 ****
srcdir = r'e:\pyinst\python'
! major, minor = current_version.split(".")[:2]
short_version = major+"."+minor
# This should never change
! upgrade_code='{92A24481-3ECB-40FC-8836-04B7966EC0D5}'
# This should be extended for each Python release
product_codes = {
'2.3.2' : "{3ad0c9ed-7e5e-478c-b539-5cc3a2f8772a}",
--- 13,25 ----
srcdir = r'e:\pyinst\python'
! major, minor, micro = current_version.split(".")
short_version = major+"."+minor
# This should never change
! upgrade_code_alpha='{92A24481-3ECB-40FC-8836-04B7966EC0D5}'
! upgrade_code='{65E6DE48-A358-434D-AA4F-4AF72DB4718F}'
# This should be extended for each Python release
+ # Alpha releases have their own product code
product_codes = {
'2.3.2' : "{3ad0c9ed-7e5e-478c-b539-5cc3a2f8772a}",
***************
*** 54,58 ****
if alpha:
release = int(time.time()/3600/24)
! current_version += ".%d" % release
if testpackage:
--- 56,62 ----
if alpha:
release = int(time.time()/3600/24)
! full_current_version = "%s.%d" % (current_version, release)
! else:
! full_current_version = current_version
if testpackage:
***************
*** 66,76 ****
def build_database():
! db = msilib.init_database("python%s.msi" % current_version,schema,
! ProductName="Python "+current_version,
! ProductCode=product_code,
! ProductVersion=current_version,
Manufacturer=u"Martin v. L\xf6wis")
msilib.add_tables(db, sequence)
! add_data(db, "Property", [("UpgradeCode", upgrade_code),
("DEFAULTPYTHON", "1"),
("WhichUsers", "ALL")])
--- 70,88 ----
def build_database():
! if alpha:
! cv = "%s.%s.%s" % (major, minor, release)
! uc = upgrade_code_alpha
! pc = msilib.gen_uuid()
! else:
! cv = current_version
! uc = upgrade_code
! pc = product_code
! db = msilib.init_database("python%s.msi" % full_current_version, schema,
! ProductName="Python "+full_current_version,
! ProductCode=pc,
! ProductVersion=cv,
Manufacturer=u"Martin v. L\xf6wis")
msilib.add_tables(db, sequence)
! add_data(db, "Property", [("UpgradeCode", uc),
("DEFAULTPYTHON", "1"),
("WhichUsers", "ALL")])
***************
*** 78,81 ****
--- 90,113 ----
return db
+ def remove_old_versions(db):
+ start = "%s.%s.0" % (major, minor)
+ remove_package = 0
+ migrate_features = 1
+ if alpha:
+ add_data(db, "Upgrade",
+ [(upgrade_code_alpha, start,
+ "%s.%s.%s" % (major, minor, release), None, migrate_features,
+ None, "REMOVEOLDALPHA")])
+ props = "REMOVEOLDALPHA"
+ else:
+ add_data(db, "Upgrade",
+ [(upgrade_code, start, current_version,
+ None, migrate_features, None, "REMOVEOLDVERSION"),
+ (upgrade_code_alpha, start, "%s.%s.0" % (major, minor+1),
+ None, migrate_features, None, "REMOVEOLDALPHA")])
+ props = "REMOVEOLDALPHA;REMOVEOLDVERSION"
+ add_data(db, "Property", [("SecureCustomProperties", props)])
+
+
class PyDialog(Dialog):
def __init__(self, *args, **kw):
***************
*** 136,139 ****
--- 168,185 ----
("py.ico",msilib.Binary(srcdir+r"\PC\py.ico")),
])
+ # Scripts
+ open("inst.vbs","w").write("""
+ Function CheckDir()
+ Set FSO = CreateObject("Scripting.FileSystemObject")
+ if FSO.FolderExists(Session.Property("TARGETDIR")) then
+ Session.Property("TargetExists") = "1"
+ else
+ Session.Property("TargetExists") = "0"
+ end if
+ End Function
+ """)
+ add_data(db, "Binary", [("Script", msilib.Binary("inst.vbs"))])
+ add_data(db, "CustomAction", [("CheckDir", 6, "Script", "CheckDir")])
+ os.unlink("inst.vbs")
***************
*** 290,296 ****
seldlg.back("< Back", None, active=0)
c = seldlg.next("Next >", "Cancel")
! c.event("SetTargetPath", "TARGETDIR", order=1)
! c.event("SpawnWaitDialog", "WaitForCostingDlg", "CostingComplete = 1", 2)
! c.event("NewDialog", "SelectFeaturesDlg", order=3)
c = seldlg.cancel("Cancel", "DirectoryCombo")
--- 336,344 ----
seldlg.back("< Back", None, active=0)
c = seldlg.next("Next >", "Cancel")
! c.event("DoAction", "CheckDir", "TargetExistsOk<>1", order=1)
! c.event("SpawnDialog", "ExistingDirectoryDlg", "TargetExists=1", 2)
! c.event("SetTargetPath", "TARGETDIR", "TargetExists=0", 3)
! c.event("SpawnWaitDialog", "WaitForCostingDlg", "CostingComplete=1", 4)
! c.event("NewDialog", "SelectFeaturesDlg", "TargetExists=0", 5)
c = seldlg.cancel("Cancel", "DirectoryCombo")
***************
*** 398,401 ****
--- 446,461 ----
advanced.cancel("Ok", "Default", name="OK").event("EndDialog", "Return")
+ #####################################################################
+ # Existing Directory dialog
+ dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title,
+ "No", "No", "No")
+ dlg.text("Title", 10, 20, 180, 40, 3,
+ "[TARGETDIR] exists. Are you sure you want to overwrite existing files?")
+ c=dlg.pushbutton("Yes", 30, 60, 55, 17, 3, "Yes", "No")
+ c.event("[TargetExists]", "0", order=1)
+ c.event("[TargetExistsOk]", "1", order=2)
+ c.event("EndDialog", "Return", order=3)
+ c=dlg.pushbutton("No", 115, 60, 55, 17, 3, "No", "Yes")
+ c.event("EndDialog", "Return")
#####################################################################
***************
*** 722,726 ****
add_data(db, "Directory",
[("ProgramMenuFolder", "TARGETDIR", "."),
! ("MENUDIR", "ProgramMenuFolder", "PY%s%s|%sPython %s.%s" % (major,minor,testprefix,major,minor))])
add_data(db, "Shortcut",
[# Advertised shortcuts: targets are features, not files
--- 782,786 ----
add_data(db, "Directory",
[("ProgramMenuFolder", "TARGETDIR", "."),
! ("MenuDir", "ProgramMenuFolder", "PY%s%s|%sPython %s.%s" % (major,minor,testprefix,major,minor))])
add_data(db, "Shortcut",
[# Advertised shortcuts: targets are features, not files
***************
*** 728,755 ****
# XXX, advertised shortcuts don't work, so make them unadvertised
# for now
! #("IDLE", "MENUDIR", "IDLE|IDLE (Python GUI)", "pythonw.exe",
# default_feature.id, r"[TARGETDIR]Lib\idlelib\idle.pyw",
# None, None, None, None, None, "TARGETDIR"),
! #("PyDoc", "MENUDIR", "MODDOCS|Module Docs", "pythonw.exe",
# default_feature.id, r"[TARGETDIR]Tools\scripts\pydocgui.pyw",
# None, None, None, None, None, "TARGETDIR"),
! #("Python", "MENUDIR", "PYTHON|Python (command line)", "python.exe",
# default_feature.id, None,
# None, None, None, None, None, "TARGETDIR"),
! ("IDLE", "MENUDIR", "IDLE|IDLE (Python GUI)", "REGISTRY",
r"[TARGETDIR]pythonw.exe", r"[TARGETDIR]Lib\idlelib\idle.pyw",
None, None, None, None, None, "TARGETDIR"),
! ("PyDoc", "MENUDIR", "MODDOCS|Module Docs", "REGISTRY",
r"[TARGETDIR]pythonw.exe", r"[TARGETDIR]Tools\scripts\pydocgui.pyw",
None, None, None, None, None, "TARGETDIR"),
! ("Python", "MENUDIR", "PYTHON|Python (command line)", "REGISTRY",
r"[TARGETDIR]python.exe", None,
None, None, None, None, None, "TARGETDIR"),
# Non-advertised features: must be associated with a registry component
! ("Manual", "MENUDIR", "MANUAL|Python Manuals", "REGISTRY",
r"[TARGETDIR]Doc\python%s%s.chm" % (major, minor), None,
None, None, None, None, None, None),
# XXX: System64Folder on Win64
! ("Uninstall", "MENUDIR", "UNINST|Uninstall Python", "REGISTRY",
"[SystemFolder]msiexec", "/x%s" % product_code,
None, None, None, None, None, None),
--- 788,815 ----
# XXX, advertised shortcuts don't work, so make them unadvertised
# for now
! #("IDLE", "MenuDir", "IDLE|IDLE (Python GUI)", "pythonw.exe",
# default_feature.id, r"[TARGETDIR]Lib\idlelib\idle.pyw",
# None, None, None, None, None, "TARGETDIR"),
! #("PyDoc", "MenuDir", "MODDOCS|Module Docs", "pythonw.exe",
# default_feature.id, r"[TARGETDIR]Tools\scripts\pydocgui.pyw",
# None, None, None, None, None, "TARGETDIR"),
! #("Python", "MenuDir", "PYTHON|Python (command line)", "python.exe",
# default_feature.id, None,
# None, None, None, None, None, "TARGETDIR"),
! ("IDLE", "MenuDir", "IDLE|IDLE (Python GUI)", "REGISTRY",
r"[TARGETDIR]pythonw.exe", r"[TARGETDIR]Lib\idlelib\idle.pyw",
None, None, None, None, None, "TARGETDIR"),
! ("PyDoc", "MenuDir", "MODDOCS|Module Docs", "REGISTRY",
r"[TARGETDIR]pythonw.exe", r"[TARGETDIR]Tools\scripts\pydocgui.pyw",
None, None, None, None, None, "TARGETDIR"),
! ("Python", "MenuDir", "PYTHON|Python (command line)", "REGISTRY",
r"[TARGETDIR]python.exe", None,
None, None, None, None, None, "TARGETDIR"),
# Non-advertised features: must be associated with a registry component
! ("Manual", "MenuDir", "MANUAL|Python Manuals", "REGISTRY",
r"[TARGETDIR]Doc\python%s%s.chm" % (major, minor), None,
None, None, None, None, None, None),
# XXX: System64Folder on Win64
! ("Uninstall", "MenuDir", "UNINST|Uninstall Python", "REGISTRY",
"[SystemFolder]msiexec", "/x%s" % product_code,
None, None, None, None, None, None),
***************
*** 763,766 ****
--- 823,827 ----
add_files(db)
add_registry(db)
+ remove_old_versions(db)
db.Commit()
finally:
More information about the Python-checkins
mailing list