Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1 | # Python MSI Generator |
| 2 | # (C) 2003 Martin v. Loewis |
| 3 | # See "FOO" in comments refers to MSDN sections with the title FOO. |
| 4 | import msilib, schema, sequence, os, glob, time |
| 5 | from msilib import Feature, CAB, Directory, Dialog, Binary, add_data |
| 6 | import uisample |
| 7 | from win32com.client import constants |
| 8 | |
| 9 | # Settings can be overridden in config.py below |
| 10 | # 1 for Itanium build |
| 11 | msilib.Win64 = 0 |
| 12 | # 0 for official python.org releases |
| 13 | # 1 for intermediate releases by anybody, with |
| 14 | # a new product code for every package. |
| 15 | snapshot = 1 |
| 16 | # 1 means that file extension is px, not py, |
| 17 | # and binaries start with x |
| 18 | testpackage = 0 |
| 19 | # Location of build tree |
| 20 | srcdir = os.path.abspath("../..") |
| 21 | # Text to be displayed as the version in dialogs etc. |
| 22 | # goes into file name and ProductCode. Defaults to |
| 23 | # current_version.day for Snapshot, current_version otherwise |
| 24 | full_current_version = None |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 25 | # Is Tcl available at all? |
| 26 | have_tcl = True |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 27 | |
| 28 | try: |
| 29 | from config import * |
| 30 | except ImportError: |
| 31 | pass |
| 32 | |
| 33 | # Extract current version from Include/patchlevel.h |
| 34 | lines = open(srcdir + "/Include/patchlevel.h").readlines() |
| 35 | major = minor = micro = level = serial = None |
| 36 | levels = { |
| 37 | 'PY_RELEASE_LEVEL_ALPHA':0xA, |
| 38 | 'PY_RELEASE_LEVEL_BETA': 0xB, |
| 39 | 'PY_RELEASE_LEVEL_GAMMA':0xC, |
| 40 | 'PY_RELEASE_LEVEL_FINAL':0xF |
| 41 | } |
| 42 | for l in lines: |
| 43 | if not l.startswith("#define"): |
| 44 | continue |
| 45 | l = l.split() |
| 46 | if len(l) != 3: |
| 47 | continue |
| 48 | _, name, value = l |
| 49 | if name == 'PY_MAJOR_VERSION': major = value |
| 50 | if name == 'PY_MINOR_VERSION': minor = value |
| 51 | if name == 'PY_MICRO_VERSION': micro = value |
| 52 | if name == 'PY_RELEASE_LEVEL': level = levels[value] |
| 53 | if name == 'PY_RELEASE_SERIAL': serial = value |
| 54 | |
| 55 | short_version = major+"."+minor |
| 56 | # See PC/make_versioninfo.c |
| 57 | FIELD3 = 1000*int(micro) + 10*level + int(serial) |
| 58 | current_version = "%s.%d" % (short_version, FIELD3) |
| 59 | |
| 60 | # This should never change. The UpgradeCode of this package can be |
| 61 | # used in the Upgrade table of future packages to make the future |
| 62 | # package replace this one. See "UpgradeCode Property". |
| 63 | upgrade_code_snapshot='{92A24481-3ECB-40FC-8836-04B7966EC0D5}' |
| 64 | upgrade_code='{65E6DE48-A358-434D-AA4F-4AF72DB4718F}' |
| 65 | |
| 66 | # This should be extended for each Python release. |
| 67 | # The product code must change whenever the name of the MSI file |
| 68 | # changes, and when new component codes are issued for existing |
| 69 | # components. See "Changing the Product Code". As we change the |
| 70 | # component codes with every build, we need a new product code |
| 71 | # each time. For intermediate (snapshot) releases, they are automatically |
| 72 | # generated. For official releases, we record the product codes, |
| 73 | # so people can refer to them. |
| 74 | product_codes = { |
| 75 | '2.4.101': '{0e9b4d8e-6cda-446e-a208-7b92f3ddffa0}', # 2.4a1, released as a snapshot |
| 76 | '2.4.102': '{1b998745-4901-4edb-bc52-213689e1b922}', # 2.4a2 |
| 77 | '2.4.103': '{33fc8bd2-1e8f-4add-a40a-ade2728d5942}', # 2.4a3 |
| 78 | '2.4.111': '{51a7e2a8-2025-4ef0-86ff-e6aab742d1fa}', # 2.4b1 |
| 79 | '2.4.112': '{4a5e7c1d-c659-4fe3-b8c9-7c65bd9c95a5}', # 2.4b2 |
| 80 | '2.4.121': '{75508821-a8e9-40a8-95bd-dbe6033ddbea}', # 2.4c1 |
| 81 | '2.4.122': '{83a9118b-4bdd-473b-afc3-bcb142feca9e}', # 2.4c2 |
| 82 | '2.4.150': '{82d9302e-f209-4805-b548-52087047483a}', # 2.4.0 |
| 83 | } |
| 84 | |
| 85 | if snapshot: |
| 86 | current_version = "%s.%s.%s" % (major, minor, int(time.time()/3600/24)) |
| 87 | product_code = msilib.gen_uuid() |
| 88 | else: |
| 89 | product_code = product_codes[current_version] |
| 90 | |
| 91 | if full_current_version is None: |
| 92 | full_current_version = current_version |
| 93 | |
| 94 | extensions = [ |
| 95 | 'bz2.pyd', |
| 96 | 'pyexpat.pyd', |
| 97 | 'select.pyd', |
| 98 | 'unicodedata.pyd', |
| 99 | 'winsound.pyd', |
| 100 | 'zlib.pyd', |
| 101 | '_bsddb.pyd', |
| 102 | '_socket.pyd', |
| 103 | '_ssl.pyd', |
| 104 | '_testcapi.pyd', |
| 105 | '_tkinter.pyd', |
| 106 | ] |
| 107 | |
| 108 | if major+minor <= "23": |
| 109 | extensions.extend([ |
| 110 | '_csv.pyd', |
| 111 | '_sre.pyd', |
| 112 | '_symtable.pyd', |
| 113 | '_winreg.pyd', |
| 114 | 'datetime.pyd' |
| 115 | 'mmap.pyd', |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 116 | 'parser.pyd', |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 117 | ]) |
| 118 | |
| 119 | if testpackage: |
| 120 | ext = 'px' |
| 121 | testprefix = 'x' |
| 122 | else: |
| 123 | ext = 'py' |
| 124 | testprefix = '' |
| 125 | |
| 126 | if msilib.Win64: |
| 127 | SystemFolderName = "[SystemFolder64]" |
| 128 | else: |
| 129 | SystemFolderName = "[SystemFolder]" |
| 130 | |
| 131 | msilib.reset() |
| 132 | |
| 133 | # condition in which to install pythonxy.dll in system32: |
| 134 | # a) it is Windows 9x or |
| 135 | # b) it is NT, the user is privileged, and has chosen per-machine installation |
| 136 | sys32cond = "(Windows9x or (Privileged and ALLUSERS))" |
| 137 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 138 | def build_database(): |
| 139 | """Generate an empty database, with just the schema and the |
| 140 | Summary information stream.""" |
| 141 | if snapshot: |
| 142 | uc = upgrade_code_snapshot |
| 143 | else: |
| 144 | uc = upgrade_code |
| 145 | # schema represents the installer 2.0 database schema. |
| 146 | # sequence is the set of standard sequences |
| 147 | # (ui/execute, admin/advt/install) |
| 148 | if msilib.Win64: |
| 149 | w64 = ".ia64" |
| 150 | else: |
| 151 | w64 = "" |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 152 | db = msilib.init_database("python-%s%s.msi" % (full_current_version, w64), |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 153 | schema, ProductName="Python "+full_current_version, |
| 154 | ProductCode=product_code, |
| 155 | ProductVersion=current_version, |
| 156 | Manufacturer=u"Martin v. L\xf6wis") |
| 157 | # The default sequencing of the RemoveExistingProducts action causes |
| 158 | # removal of files that got just installed. Place it after |
| 159 | # InstallInitialize, so we first uninstall everything, but still roll |
| 160 | # back in case the installation is interrupted |
| 161 | msilib.change_sequence(sequence.InstallExecuteSequence, |
| 162 | "RemoveExistingProducts", 1510) |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 163 | msilib.add_tables(db, sequence) |
| 164 | # We cannot set ALLUSERS in the property table, as this cannot be |
| 165 | # reset if the user choses a per-user installation. Instead, we |
| 166 | # maintain WhichUsers, which can be "ALL" or "JUSTME". The UI manages |
| 167 | # this property, and when the execution starts, ALLUSERS is set |
| 168 | # accordingly. |
| 169 | add_data(db, "Property", [("UpgradeCode", uc), |
| 170 | ("WhichUsers", "ALL"), |
| 171 | ]) |
| 172 | db.Commit() |
| 173 | return db |
| 174 | |
| 175 | def remove_old_versions(db): |
| 176 | "Fill the upgrade table." |
| 177 | start = "%s.%s.0" % (major, minor) |
| 178 | # This requests that feature selection states of an older |
| 179 | # installation should be forwarded into this one. Upgrading |
| 180 | # requires that both the old and the new installation are |
| 181 | # either both per-machine or per-user. |
| 182 | migrate_features = 1 |
| 183 | # See "Upgrade Table". We remove releases with the same major and |
| 184 | # minor version. For an snapshot, we remove all earlier snapshots. For |
| 185 | # a release, we remove all snapshots, and all earlier releases. |
| 186 | if snapshot: |
| 187 | add_data(db, "Upgrade", |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 188 | [(upgrade_code_snapshot, start, |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 189 | current_version, |
| 190 | None, # Ignore language |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 191 | migrate_features, |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 192 | None, # Migrate ALL features |
| 193 | "REMOVEOLDSNAPSHOT")]) |
| 194 | props = "REMOVEOLDSNAPSHOT" |
| 195 | else: |
| 196 | add_data(db, "Upgrade", |
| 197 | [(upgrade_code, start, current_version, |
| 198 | None, migrate_features, None, "REMOVEOLDVERSION"), |
| 199 | (upgrade_code_snapshot, start, "%s.%d.0" % (major, int(minor)+1), |
| 200 | None, migrate_features, None, "REMOVEOLDSNAPSHOT")]) |
| 201 | props = "REMOVEOLDSNAPSHOT;REMOVEOLDVERSION" |
| 202 | # Installer collects the product codes of the earlier releases in |
| 203 | # these properties. In order to allow modification of the properties, |
| 204 | # they must be declared as secure. See "SecureCustomProperties Property" |
| 205 | add_data(db, "Property", [("SecureCustomProperties", props)]) |
| 206 | |
| 207 | class PyDialog(Dialog): |
| 208 | """Dialog class with a fixed layout: controls at the top, then a ruler, |
| 209 | then a list of buttons: back, next, cancel. Optionally a bitmap at the |
| 210 | left.""" |
| 211 | def __init__(self, *args, **kw): |
| 212 | """Dialog(database, name, x, y, w, h, attributes, title, first, |
| 213 | default, cancel, bitmap=true)""" |
| 214 | Dialog.__init__(self, *args) |
| 215 | ruler = self.h - 36 |
| 216 | bmwidth = 152*ruler/328 |
| 217 | if kw.get("bitmap", True): |
| 218 | self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin") |
| 219 | self.line("BottomLine", 0, ruler, self.w, 0) |
| 220 | |
| 221 | def title(self, title): |
| 222 | "Set the title text of the dialog at the top." |
| 223 | # name, x, y, w, h, flags=Visible|Enabled|Transparent|NoPrefix, |
| 224 | # text, in VerdanaBold10 |
| 225 | self.text("Title", 135, 10, 220, 60, 0x30003, |
| 226 | r"{\VerdanaBold10}%s" % title) |
| 227 | |
| 228 | def back(self, title, next, name = "Back", active = 1): |
| 229 | """Add a back button with a given title, the tab-next button, |
| 230 | its name in the Control table, possibly initially disabled. |
| 231 | |
| 232 | Return the button, so that events can be associated""" |
| 233 | if active: |
| 234 | flags = 3 # Visible|Enabled |
| 235 | else: |
| 236 | flags = 1 # Visible |
| 237 | return self.pushbutton(name, 180, self.h-27 , 56, 17, flags, title, next) |
| 238 | |
| 239 | def cancel(self, title, next, name = "Cancel", active = 1): |
| 240 | """Add a cancel button with a given title, the tab-next button, |
| 241 | its name in the Control table, possibly initially disabled. |
| 242 | |
| 243 | Return the button, so that events can be associated""" |
| 244 | if active: |
| 245 | flags = 3 # Visible|Enabled |
| 246 | else: |
| 247 | flags = 1 # Visible |
| 248 | return self.pushbutton(name, 304, self.h-27, 56, 17, flags, title, next) |
| 249 | |
| 250 | def next(self, title, next, name = "Next", active = 1): |
| 251 | """Add a Next button with a given title, the tab-next button, |
| 252 | its name in the Control table, possibly initially disabled. |
| 253 | |
| 254 | Return the button, so that events can be associated""" |
| 255 | if active: |
| 256 | flags = 3 # Visible|Enabled |
| 257 | else: |
| 258 | flags = 1 # Visible |
| 259 | return self.pushbutton(name, 236, self.h-27, 56, 17, flags, title, next) |
| 260 | |
| 261 | def xbutton(self, name, title, next, xpos): |
| 262 | """Add a button with a given title, the tab-next button, |
| 263 | its name in the Control table, giving its x position; the |
| 264 | y-position is aligned with the other buttons. |
| 265 | |
| 266 | Return the button, so that events can be associated""" |
| 267 | return self.pushbutton(name, int(self.w*xpos - 28), self.h-27, 56, 17, 3, title, next) |
| 268 | |
| 269 | def add_ui(db): |
| 270 | x = y = 50 |
| 271 | w = 370 |
| 272 | h = 300 |
| 273 | title = "[ProductName] Setup" |
| 274 | |
| 275 | # see "Dialog Style Bits" |
| 276 | modal = 3 # visible | modal |
| 277 | modeless = 1 # visible |
| 278 | track_disk_space = 32 |
| 279 | |
| 280 | add_data(db, 'ActionText', uisample.ActionText) |
| 281 | add_data(db, 'UIText', uisample.UIText) |
| 282 | |
| 283 | # Bitmaps |
| 284 | if not os.path.exists(srcdir+r"\PC\python_icon.exe"): |
| 285 | raise "Run icons.mak in PC directory" |
| 286 | add_data(db, "Binary", |
| 287 | [("PythonWin", msilib.Binary(srcdir+r"\PCbuild\installer.bmp")), # 152x328 pixels |
| 288 | ("py.ico",msilib.Binary(srcdir+r"\PC\py.ico")), |
| 289 | ]) |
| 290 | add_data(db, "Icon", |
| 291 | [("python_icon.exe", msilib.Binary(srcdir+r"\PC\python_icon.exe"))]) |
| 292 | |
| 293 | # Scripts |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 294 | # CheckDir sets TargetExists if TARGETDIR exists. |
| 295 | # UpdateEditIDLE sets the REGISTRY.tcl component into |
| 296 | # the installed/uninstalled state according to both the |
| 297 | # Extensions and TclTk features. |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 298 | open("inst.vbs","w").write(""" |
| 299 | Function CheckDir() |
| 300 | Set FSO = CreateObject("Scripting.FileSystemObject") |
| 301 | if FSO.FolderExists(Session.Property("TARGETDIR")) then |
| 302 | Session.Property("TargetExists") = "1" |
| 303 | else |
| 304 | Session.Property("TargetExists") = "0" |
| 305 | end if |
| 306 | End Function |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 307 | Function UpdateEditIDLE() |
| 308 | Dim ext_new, tcl_new, regtcl_old |
| 309 | ext_new = Session.FeatureRequestState("Extensions") |
| 310 | tcl_new = Session.FeatureRequestState("TclTk") |
| 311 | if ext_new=-1 then |
| 312 | ext_new = Session.FeatureCurrentState("Extensions") |
| 313 | end if |
| 314 | if tcl_new=-1 then |
| 315 | tcl_new = Session.FeatureCurrentState("TclTk") |
| 316 | end if |
| 317 | regtcl_old = Session.ComponentCurrentState("REGISTRY.tcl") |
| 318 | if ext_new=3 and (tcl_new=3 or tcl_new=4) and regtcl_old<>3 then |
| 319 | Session.ComponentRequestState("REGISTRY.tcl")=3 |
| 320 | end if |
| 321 | if (ext_new=2 or tcl_new=2) and regtcl_old<>2 then |
| 322 | Session.ComponentRequestState("REGISTRY.tcl")=2 |
Tim Peters | 0e9980f | 2004-09-12 03:49:31 +0000 | [diff] [blame] | 323 | end if |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 324 | End Function |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 325 | """) |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 326 | # To add debug messages into scripts, the following fragment can be used |
| 327 | # set objRec = Session.Installer.CreateRecord(1) |
| 328 | # objRec.StringData(1) = "Debug message" |
| 329 | # Session.message &H04000000, objRec |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 330 | add_data(db, "Binary", [("Script", msilib.Binary("inst.vbs"))]) |
| 331 | # See "Custom Action Type 6" |
Tim Peters | 0e9980f | 2004-09-12 03:49:31 +0000 | [diff] [blame] | 332 | add_data(db, "CustomAction", |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 333 | [("CheckDir", 6, "Script", "CheckDir"), |
| 334 | ("UpdateEditIDLE", 6, "Script", "UpdateEditIDLE")]) |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 335 | os.unlink("inst.vbs") |
| 336 | |
| 337 | |
| 338 | # UI customization properties |
| 339 | add_data(db, "Property", |
| 340 | # See "DefaultUIFont Property" |
| 341 | [("DefaultUIFont", "DlgFont8"), |
| 342 | # See "ErrorDialog Style Bit" |
| 343 | ("ErrorDialog", "ErrorDlg"), |
| 344 | ("Progress1", "Install"), # modified in maintenance type dlg |
| 345 | ("Progress2", "installs"), |
| 346 | ("MaintenanceForm_Action", "Repair")]) |
| 347 | |
| 348 | # Fonts, see "TextStyle Table" |
| 349 | add_data(db, "TextStyle", |
| 350 | [("DlgFont8", "Tahoma", 9, None, 0), |
| 351 | ("DlgFontBold8", "Tahoma", 8, None, 1), #bold |
| 352 | ("VerdanaBold10", "Verdana", 10, None, 1), |
| 353 | ]) |
| 354 | |
Martin v. Löwis | 7b2563b | 2004-11-02 22:59:56 +0000 | [diff] [blame^] | 355 | compileargs = r"-Wi [TARGETDIR]Lib\compileall.py -f -x badsyntax [TARGETDIR]Lib" |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 356 | # See "CustomAction Table" |
| 357 | add_data(db, "CustomAction", [ |
| 358 | # msidbCustomActionTypeFirstSequence + msidbCustomActionTypeTextData + msidbCustomActionTypeProperty |
| 359 | # See "Custom Action Type 51", |
| 360 | # "Custom Action Execution Scheduling Options" |
| 361 | ("InitialTargetDir", 307, "TARGETDIR", |
| 362 | "[WindowsVolume]Python%s%s" % (major, minor)), |
| 363 | ("SetDLLDirToTarget", 307, "DLLDIR", "[TARGETDIR]"), |
| 364 | ("SetDLLDirToSystem32", 307, "DLLDIR", SystemFolderName), |
| 365 | # msidbCustomActionTypeExe + msidbCustomActionTypeSourceFile |
| 366 | # See "Custom Action Type 18" |
Martin v. Löwis | 7b2563b | 2004-11-02 22:59:56 +0000 | [diff] [blame^] | 367 | ("CompilePyc", 18, "python.exe", compileargs), |
| 368 | ("CompilePyo", 18, "python.exe", "-O "+compileargs), |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 369 | ]) |
| 370 | |
| 371 | # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table" |
| 372 | # Numbers indicate sequence; see sequence.py for how these action integrate |
| 373 | add_data(db, "InstallUISequence", |
| 374 | [("PrepareDlg", "Not Privileged or Windows9x or Installed", 140), |
| 375 | ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141), |
| 376 | ("InitialTargetDir", 'TARGETDIR=""', 750), |
| 377 | # In the user interface, assume all-users installation if privileged. |
| 378 | ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), |
| 379 | ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), |
| 380 | ("SelectDirectoryDlg", "Not Installed", 1230), |
| 381 | # XXX no support for resume installations yet |
| 382 | #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240), |
| 383 | ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250), |
| 384 | ("ProgressDlg", None, 1280)]) |
| 385 | add_data(db, "AdminUISequence", |
| 386 | [("InitialTargetDir", 'TARGETDIR=""', 750), |
| 387 | ("SetDLLDirToTarget", 'DLLDIR=""', 751), |
| 388 | ]) |
| 389 | |
| 390 | # Execute Sequences |
| 391 | add_data(db, "InstallExecuteSequence", |
| 392 | [("InitialTargetDir", 'TARGETDIR=""', 750), |
| 393 | ("SetDLLDirToSystem32", 'DLLDIR="" and ' + sys32cond, 751), |
| 394 | ("SetDLLDirToTarget", 'DLLDIR="" and not ' + sys32cond, 752), |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 395 | ("UpdateEditIDLE", None, 1050), |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 396 | ("CompilePyc", "COMPILEALL", 6800), |
| 397 | ("CompilePyo", "COMPILEALL", 6801), |
| 398 | ]) |
| 399 | add_data(db, "AdminExecuteSequence", |
| 400 | [("InitialTargetDir", 'TARGETDIR=""', 750), |
| 401 | ("SetDLLDirToTarget", 'DLLDIR=""', 751), |
| 402 | ("CompilePyc", "COMPILEALL", 6800), |
| 403 | ("CompilePyo", "COMPILEALL", 6801), |
| 404 | ]) |
| 405 | |
| 406 | ##################################################################### |
| 407 | # Standard dialogs: FatalError, UserExit, ExitDialog |
| 408 | fatal=PyDialog(db, "FatalError", x, y, w, h, modal, title, |
| 409 | "Finish", "Finish", "Finish") |
| 410 | fatal.title("[ProductName] Installer ended prematurely") |
| 411 | fatal.back("< Back", "Finish", active = 0) |
| 412 | fatal.cancel("Cancel", "Back", active = 0) |
| 413 | fatal.text("Description1", 135, 70, 220, 80, 0x30003, |
| 414 | "[ProductName] setup ended prematurely because of an error. Your system has not been modified. To install this program at a later time, please run the installation again.") |
| 415 | fatal.text("Description2", 135, 155, 220, 20, 0x30003, |
| 416 | "Click the Finish button to exit the Installer.") |
| 417 | c=fatal.next("Finish", "Cancel", name="Finish") |
| 418 | # See "ControlEvent Table". Parameters are the event, the parameter |
| 419 | # to the action, and optionally the condition for the event, and the order |
| 420 | # of events. |
| 421 | c.event("EndDialog", "Exit") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 422 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 423 | user_exit=PyDialog(db, "UserExit", x, y, w, h, modal, title, |
| 424 | "Finish", "Finish", "Finish") |
| 425 | user_exit.title("[ProductName] Installer was interrupted") |
| 426 | user_exit.back("< Back", "Finish", active = 0) |
| 427 | user_exit.cancel("Cancel", "Back", active = 0) |
| 428 | user_exit.text("Description1", 135, 70, 220, 80, 0x30003, |
| 429 | "[ProductName] setup was interrupted. Your system has not been modified. " |
| 430 | "To install this program at a later time, please run the installation again.") |
| 431 | user_exit.text("Description2", 135, 155, 220, 20, 0x30003, |
| 432 | "Click the Finish button to exit the Installer.") |
| 433 | c = user_exit.next("Finish", "Cancel", name="Finish") |
| 434 | c.event("EndDialog", "Exit") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 435 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 436 | exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title, |
| 437 | "Finish", "Finish", "Finish") |
| 438 | exit_dialog.title("Completing the [ProductName] Installer") |
| 439 | exit_dialog.back("< Back", "Finish", active = 0) |
| 440 | exit_dialog.cancel("Cancel", "Back", active = 0) |
Martin v. Löwis | 2dd2a28 | 2004-08-22 17:10:12 +0000 | [diff] [blame] | 441 | exit_dialog.text("Acknowledgements", 135, 95, 220, 120, 0x30003, |
| 442 | "Special Windows thanks to:\n" |
Martin v. Löwis | d3f61a2 | 2004-08-30 09:22:30 +0000 | [diff] [blame] | 443 | " LettError, Erik van Blokland, for the \n" |
| 444 | " Python for Windows graphic.\n" |
Martin v. Löwis | 2dd2a28 | 2004-08-22 17:10:12 +0000 | [diff] [blame] | 445 | " http://www.letterror.com/\n" |
| 446 | "\n" |
Martin v. Löwis | d3f61a2 | 2004-08-30 09:22:30 +0000 | [diff] [blame] | 447 | " Mark Hammond, without whose years of freely \n" |
| 448 | " shared Windows expertise, Python for Windows \n" |
| 449 | " would still be Python for DOS.") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 450 | |
Martin v. Löwis | 2dd2a28 | 2004-08-22 17:10:12 +0000 | [diff] [blame] | 451 | exit_dialog.text("Description", 135, 235, 220, 20, 0x30003, |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 452 | "Click the Finish button to exit the Installer.") |
| 453 | c = exit_dialog.next("Finish", "Cancel", name="Finish") |
| 454 | c.event("EndDialog", "Return") |
| 455 | |
| 456 | ##################################################################### |
| 457 | # Required dialog: FilesInUse, ErrorDlg |
| 458 | inuse = PyDialog(db, "FilesInUse", |
| 459 | x, y, w, h, |
| 460 | 19, # KeepModeless|Modal|Visible |
| 461 | title, |
| 462 | "Retry", "Retry", "Retry", bitmap=False) |
| 463 | inuse.text("Title", 15, 6, 200, 15, 0x30003, |
| 464 | r"{\DlgFontBold8}Files in Use") |
| 465 | inuse.text("Description", 20, 23, 280, 20, 0x30003, |
| 466 | "Some files that need to be updated are currently in use.") |
| 467 | inuse.text("Text", 20, 55, 330, 50, 3, |
| 468 | "The following applications are using files that need to be updated by this setup. Close these applications and then click Retry to continue the installation or Cancel to exit it.") |
| 469 | inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess", |
| 470 | None, None, None) |
| 471 | c=inuse.back("Exit", "Ignore", name="Exit") |
| 472 | c.event("EndDialog", "Exit") |
| 473 | c=inuse.next("Ignore", "Retry", name="Ignore") |
| 474 | c.event("EndDialog", "Ignore") |
| 475 | c=inuse.cancel("Retry", "Exit", name="Retry") |
| 476 | c.event("EndDialog","Retry") |
| 477 | |
| 478 | |
| 479 | # See "Error Dialog". See "ICE20" for the required names of the controls. |
| 480 | error = Dialog(db, "ErrorDlg", |
| 481 | 50, 10, 330, 101, |
| 482 | 65543, # Error|Minimize|Modal|Visible |
| 483 | title, |
| 484 | "ErrorText", None, None) |
| 485 | error.text("ErrorText", 50,9,280,48,3, "") |
| 486 | error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None) |
| 487 | error.pushbutton("N",120,72,81,21,3,"No",None).event("EndDialog","ErrorNo") |
| 488 | error.pushbutton("Y",240,72,81,21,3,"Yes",None).event("EndDialog","ErrorYes") |
| 489 | error.pushbutton("A",0,72,81,21,3,"Abort",None).event("EndDialog","ErrorAbort") |
| 490 | error.pushbutton("C",42,72,81,21,3,"Cancel",None).event("EndDialog","ErrorCancel") |
| 491 | error.pushbutton("I",81,72,81,21,3,"Ignore",None).event("EndDialog","ErrorIgnore") |
| 492 | error.pushbutton("O",159,72,81,21,3,"Ok",None).event("EndDialog","ErrorOk") |
| 493 | error.pushbutton("R",198,72,81,21,3,"Retry",None).event("EndDialog","ErrorRetry") |
| 494 | |
| 495 | ##################################################################### |
| 496 | # Global "Query Cancel" dialog |
| 497 | cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title, |
| 498 | "No", "No", "No") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 499 | cancel.text("Text", 48, 15, 194, 30, 3, |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 500 | "Are you sure you want to cancel [ProductName] installation?") |
| 501 | cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, |
| 502 | "py.ico", None, None) |
| 503 | c=cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No") |
| 504 | c.event("EndDialog", "Exit") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 505 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 506 | c=cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes") |
| 507 | c.event("EndDialog", "Return") |
| 508 | |
| 509 | ##################################################################### |
| 510 | # Global "Wait for costing" dialog |
| 511 | costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title, |
| 512 | "Return", "Return", "Return") |
| 513 | costing.text("Text", 48, 15, 194, 30, 3, |
| 514 | "Please wait while the installer finishes determining your disk space requirements.") |
| 515 | costing.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None, |
| 516 | "py.ico", None, None) |
| 517 | c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None) |
| 518 | c.event("EndDialog", "Exit") |
| 519 | |
| 520 | ##################################################################### |
| 521 | # Preparation dialog: no user input except cancellation |
| 522 | prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title, |
| 523 | "Cancel", "Cancel", "Cancel") |
| 524 | prep.text("Description", 135, 70, 220, 40, 0x30003, |
| 525 | "Please wait while the Installer prepares to guide you through the installation.") |
| 526 | prep.title("Welcome to the [ProductName] Installer") |
| 527 | c=prep.text("ActionText", 135, 110, 220, 20, 0x30003, "Pondering...") |
| 528 | c.mapping("ActionText", "Text") |
| 529 | c=prep.text("ActionData", 135, 135, 220, 30, 0x30003, None) |
| 530 | c.mapping("ActionData", "Text") |
| 531 | prep.back("Back", None, active=0) |
| 532 | prep.next("Next", None, active=0) |
| 533 | c=prep.cancel("Cancel", None) |
| 534 | c.event("SpawnDialog", "CancelDlg") |
| 535 | |
| 536 | ##################################################################### |
| 537 | # Target directory selection |
| 538 | seldlg = PyDialog(db, "SelectDirectoryDlg", x, y, w, h, modal, title, |
| 539 | "Next", "Next", "Cancel") |
| 540 | seldlg.title("Select Destination Directory") |
| 541 | seldlg.text("Description", 135, 50, 220, 40, 0x30003, |
| 542 | "Please select a directory for the [ProductName] files.") |
| 543 | |
| 544 | seldlg.back("< Back", None, active=0) |
| 545 | c = seldlg.next("Next >", "Cancel") |
| 546 | c.event("DoAction", "CheckDir", "TargetExistsOk<>1", order=1) |
| 547 | # If the target exists, but we found that we are going to remove old versions, don't bother |
| 548 | # confirming that the target directory exists. Strictly speaking, we should determine that |
| 549 | # the target directory is indeed the target of the product that we are going to remove, but |
| 550 | # I don't know how to do that. |
| 551 | c.event("SpawnDialog", "ExistingDirectoryDlg", 'TargetExists=1 and REMOVEOLDVERSION="" and REMOVEOLDSNAPSHOT=""', 2) |
| 552 | c.event("SetTargetPath", "TARGETDIR", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 3) |
| 553 | c.event("SpawnWaitDialog", "WaitForCostingDlg", "CostingComplete=1", 4) |
| 554 | c.event("NewDialog", "SelectFeaturesDlg", 'TargetExists=0 or REMOVEOLDVERSION<>"" or REMOVEOLDSNAPSHOT<>""', 5) |
| 555 | |
| 556 | c = seldlg.cancel("Cancel", "DirectoryCombo") |
| 557 | c.event("SpawnDialog", "CancelDlg") |
| 558 | |
| 559 | seldlg.control("DirectoryCombo", "DirectoryCombo", 135, 70, 172, 80, 393219, |
| 560 | "TARGETDIR", None, "DirectoryList", None) |
| 561 | seldlg.control("DirectoryList", "DirectoryList", 135, 90, 208, 136, 3, "TARGETDIR", |
| 562 | None, "PathEdit", None) |
| 563 | seldlg.control("PathEdit", "PathEdit", 135, 230, 206, 16, 3, "TARGETDIR", None, "Next", None) |
| 564 | c = seldlg.pushbutton("Up", 306, 70, 18, 18, 3, "Up", None) |
| 565 | c.event("DirectoryListUp", "0") |
| 566 | c = seldlg.pushbutton("NewDir", 324, 70, 30, 18, 3, "New", None) |
| 567 | c.event("DirectoryListNew", "0") |
| 568 | |
| 569 | ##################################################################### |
| 570 | # SelectFeaturesDlg |
| 571 | features = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal|track_disk_space, |
| 572 | title, "Tree", "Next", "Cancel") |
| 573 | features.title("Customize [ProductName]") |
| 574 | features.text("Description", 135, 35, 220, 15, 0x30003, |
| 575 | "Select the way you want features to be installed.") |
| 576 | features.text("Text", 135,45,220,30, 3, |
| 577 | "Click on the icons in the tree below to change the way features will be installed.") |
| 578 | |
| 579 | c=features.back("< Back", "Next") |
| 580 | c.event("NewDialog", "SelectDirectoryDlg") |
| 581 | |
| 582 | c=features.next("Next >", "Cancel") |
| 583 | c.mapping("SelectionNoItems", "Enabled") |
| 584 | c.event("SpawnDialog", "DiskCostDlg", "OutOfDiskSpace=1", order=1) |
| 585 | c.event("EndDialog", "Return", "OutOfDiskSpace<>1", order=2) |
| 586 | |
| 587 | c=features.cancel("Cancel", "Tree") |
| 588 | c.event("SpawnDialog", "CancelDlg") |
| 589 | |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 590 | # The browse property is not used, since we have only a single target path (selected already) |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 591 | features.control("Tree", "SelectionTree", 135, 75, 220, 95, 7, "_BrowseProperty", |
| 592 | "Tree of selections", "Back", None) |
| 593 | |
| 594 | #c=features.pushbutton("Reset", 42, 243, 56, 17, 3, "Reset", "DiskCost") |
| 595 | #c.mapping("SelectionNoItems", "Enabled") |
| 596 | #c.event("Reset", "0") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 597 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 598 | features.control("Box", "GroupBox", 135, 170, 225, 90, 1, None, None, None, None) |
| 599 | |
| 600 | c=features.xbutton("DiskCost", "Disk &Usage", None, 0.10) |
| 601 | c.mapping("SelectionNoItems","Enabled") |
| 602 | c.event("SpawnDialog", "DiskCostDlg") |
| 603 | |
| 604 | c=features.xbutton("Advanced", "Advanced", None, 0.30) |
| 605 | c.event("SpawnDialog", "AdvancedDlg") |
| 606 | |
| 607 | c=features.text("ItemDescription", 140, 180, 210, 30, 3, |
| 608 | "Multiline description of the currently selected item.") |
| 609 | c.mapping("SelectionDescription","Text") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 610 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 611 | c=features.text("ItemSize", 140, 210, 210, 45, 3, |
| 612 | "The size of the currently selected item.") |
| 613 | c.mapping("SelectionSize", "Text") |
| 614 | |
| 615 | ##################################################################### |
| 616 | # Disk cost |
| 617 | cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title, |
| 618 | "OK", "OK", "OK", bitmap=False) |
| 619 | cost.text("Title", 15, 6, 200, 15, 0x30003, |
| 620 | "{\DlgFontBold8}Disk Space Requirements") |
| 621 | cost.text("Description", 20, 20, 280, 20, 0x30003, |
| 622 | "The disk space required for the installation of the selected features.") |
| 623 | cost.text("Text", 20, 53, 330, 60, 3, |
| 624 | "The highlighted volumes (if any) do not have enough disk space " |
| 625 | "available for the currently selected features. You can either " |
| 626 | "remove some files from the highlighted volumes, or choose to " |
| 627 | "install less features onto local drive(s), or select different " |
| 628 | "destination drive(s).") |
| 629 | cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223, |
| 630 | None, "{120}{70}{70}{70}{70}", None, None) |
| 631 | cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return") |
| 632 | |
| 633 | ##################################################################### |
| 634 | # WhichUsers Dialog. Only available on NT, and for privileged users. |
| 635 | # This must be run before FindRelatedProducts, because that will |
| 636 | # take into account whether the previous installation was per-user |
| 637 | # or per-machine. We currently don't support going back to this |
| 638 | # dialog after "Next" was selected; to support this, we would need to |
| 639 | # find how to reset the ALLUSERS property, and how to re-run |
| 640 | # FindRelatedProducts. |
| 641 | # On Windows9x, the ALLUSERS property is ignored on the command line |
| 642 | # and in the Property table, but installer fails according to the documentation |
| 643 | # if a dialog attempts to set ALLUSERS. |
| 644 | whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title, |
| 645 | "AdminInstall", "Next", "Cancel") |
| 646 | whichusers.title("Select whether to install [ProductName] for all users of this computer.") |
| 647 | # A radio group with two options: allusers, justme |
| 648 | g = whichusers.radiogroup("AdminInstall", 135, 60, 160, 50, 3, |
| 649 | "WhichUsers", "", "Next") |
| 650 | g.add("ALL", 0, 5, 150, 20, "Install for all users") |
| 651 | g.add("JUSTME", 0, 25, 150, 20, "Install just for me") |
| 652 | |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 653 | whichusers.back("Back", None, active=0) |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 654 | |
| 655 | c = whichusers.next("Next >", "Cancel") |
| 656 | c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1) |
| 657 | c.event("EndDialog", "Return", order = 2) |
| 658 | |
| 659 | c = whichusers.cancel("Cancel", "AdminInstall") |
| 660 | c.event("SpawnDialog", "CancelDlg") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 661 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 662 | ##################################################################### |
| 663 | # Advanced Dialog. |
| 664 | advanced = PyDialog(db, "AdvancedDlg", x, y, w, h, modal, title, |
| 665 | "CompilePyc", "Next", "Cancel") |
| 666 | advanced.title("Advanced Options for [ProductName]") |
| 667 | # A radio group with two options: allusers, justme |
| 668 | advanced.checkbox("CompilePyc", 135, 60, 230, 50, 3, |
| 669 | "COMPILEALL", "Compile .py files to byte code after installation", "Next") |
| 670 | |
| 671 | c = advanced.next("Finish", "Cancel") |
| 672 | c.event("EndDialog", "Return") |
| 673 | |
| 674 | c = advanced.cancel("Cancel", "CompilePyc") |
| 675 | c.event("SpawnDialog", "CancelDlg") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 676 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 677 | ##################################################################### |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 678 | # Existing Directory dialog |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 679 | dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title, |
| 680 | "No", "No", "No") |
| 681 | dlg.text("Title", 10, 20, 180, 40, 3, |
| 682 | "[TARGETDIR] exists. Are you sure you want to overwrite existing files?") |
| 683 | c=dlg.pushbutton("Yes", 30, 60, 55, 17, 3, "Yes", "No") |
| 684 | c.event("[TargetExists]", "0", order=1) |
| 685 | c.event("[TargetExistsOk]", "1", order=2) |
| 686 | c.event("EndDialog", "Return", order=3) |
| 687 | c=dlg.pushbutton("No", 115, 60, 55, 17, 3, "No", "Yes") |
| 688 | c.event("EndDialog", "Return") |
| 689 | |
| 690 | ##################################################################### |
| 691 | # Installation Progress dialog (modeless) |
| 692 | progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title, |
| 693 | "Cancel", "Cancel", "Cancel", bitmap=False) |
| 694 | progress.text("Title", 20, 15, 200, 15, 0x30003, |
| 695 | "{\DlgFontBold8}[Progress1] [ProductName]") |
| 696 | progress.text("Text", 35, 65, 300, 30, 3, |
| 697 | "Please wait while the Installer [Progress2] [ProductName]. " |
| 698 | "This may take several minutes.") |
| 699 | progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:") |
| 700 | |
| 701 | c=progress.text("ActionText", 70, 100, w-70, 20, 3, "Pondering...") |
| 702 | c.mapping("ActionText", "Text") |
| 703 | |
| 704 | #c=progress.text("ActionData", 35, 140, 300, 20, 3, None) |
| 705 | #c.mapping("ActionData", "Text") |
| 706 | |
| 707 | c=progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537, |
| 708 | None, "Progress done", None, None) |
| 709 | c.mapping("SetProgress", "Progress") |
| 710 | |
| 711 | progress.back("< Back", "Next", active=False) |
| 712 | progress.next("Next >", "Cancel", active=False) |
| 713 | progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg") |
| 714 | |
| 715 | # Maintenance type: repair/uninstall |
| 716 | maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title, |
| 717 | "Next", "Next", "Cancel") |
| 718 | maint.title("Welcome to the [ProductName] Setup Wizard") |
| 719 | maint.text("BodyText", 135, 63, 230, 42, 3, |
| 720 | "Select whether you want to repair or remove [ProductName].") |
| 721 | g=maint.radiogroup("RepairRadioGroup", 135, 108, 230, 60, 3, |
| 722 | "MaintenanceForm_Action", "", "Next") |
| 723 | g.add("Change", 0, 0, 200, 17, "&Change [ProductName]") |
| 724 | g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]") |
| 725 | g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 726 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 727 | maint.back("< Back", None, active=False) |
| 728 | c=maint.next("Finish", "Cancel") |
| 729 | # Change installation: Change progress dialog to "Change", then ask |
| 730 | # for feature selection |
| 731 | c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1) |
| 732 | c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2) |
| 733 | |
| 734 | # Reinstall: Change progress dialog to "Repair", then invoke reinstall |
| 735 | # Also set list of reinstalled features to "ALL" |
| 736 | c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5) |
| 737 | c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6) |
| 738 | c.event("[Progress2]", "repaires", 'MaintenanceForm_Action="Repair"', 7) |
| 739 | c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8) |
| 740 | |
| 741 | # Uninstall: Change progress to "Remove", then invoke uninstall |
| 742 | # Also set list of removed features to "ALL" |
| 743 | c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11) |
| 744 | c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12) |
| 745 | c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13) |
| 746 | c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14) |
| 747 | |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 748 | # Close dialog when maintenance action scheduled |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 749 | c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20) |
| 750 | c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21) |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 751 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 752 | maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 753 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 754 | |
| 755 | # See "Feature Table". The feature level is 1 for all features, |
| 756 | # and the feature attributes are 0 for the DefaultFeature, and |
| 757 | # FollowParent for all other features. The numbers are the Display |
| 758 | # column. |
| 759 | def add_features(db): |
| 760 | # feature attributes: |
| 761 | # msidbFeatureAttributesFollowParent == 2 |
| 762 | # msidbFeatureAttributesDisallowAdvertise == 8 |
| 763 | # Features that need to be installed with together with the main feature |
| 764 | # (i.e. additional Python libraries) need to follow the parent feature. |
| 765 | # Features that have no advertisement trigger (e.g. the test suite) |
| 766 | # must not support advertisement |
| 767 | global default_feature, tcltk, htmlfiles, tools, testsuite, ext_feature |
| 768 | default_feature = Feature(db, "DefaultFeature", "Python", |
| 769 | "Python Interpreter and Libraries", |
| 770 | 1, directory = "TARGETDIR") |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 771 | # We don't support advertisement of extensions |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 772 | ext_feature = Feature(db, "Extensions", "Register Extensions", |
| 773 | "Make this Python installation the default Python installation", 3, |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 774 | parent = default_feature, attributes=2|8) |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 775 | if have_tcl: |
| 776 | tcltk = Feature(db, "TclTk", "Tcl/Tk", "Tkinter, IDLE, pydoc", 5, |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 777 | parent = default_feature, attributes=2) |
| 778 | htmlfiles = Feature(db, "Documentation", "Documentation", |
| 779 | "Python HTMLHelp File", 7, parent = default_feature) |
| 780 | tools = Feature(db, "Tools", "Utility Scripts", |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 781 | "Python utility scripts (Tools/", 9, |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 782 | parent = default_feature, attributes=2) |
| 783 | testsuite = Feature(db, "Testsuite", "Test suite", |
| 784 | "Python test suite (Lib/test/)", 11, |
| 785 | parent = default_feature, attributes=2|8) |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 786 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 787 | def extract_msvcr71(): |
| 788 | import _winreg |
| 789 | # Find the location of the merge modules |
| 790 | k = _winreg.OpenKey( |
| 791 | _winreg.HKEY_LOCAL_MACHINE, |
| 792 | r"Software\Microsoft\VisualStudio\7.1\Setup\VS") |
| 793 | dir = _winreg.QueryValueEx(k, "MSMDir")[0] |
| 794 | _winreg.CloseKey(k) |
| 795 | files = glob.glob1(dir, "*CRT71*") |
| 796 | assert len(files) == 1 |
| 797 | file = os.path.join(dir, files[0]) |
| 798 | # Extract msvcr71.dll |
| 799 | m = msilib.MakeMerge2() |
| 800 | m.OpenModule(file, 0) |
| 801 | m.ExtractFiles(".") |
| 802 | m.CloseModule() |
| 803 | # Find the version/language of msvcr71.dll |
| 804 | installer = msilib.MakeInstaller() |
| 805 | return installer.FileVersion("msvcr71.dll", 0), \ |
| 806 | installer.FileVersion("msvcr71.dll", 1) |
| 807 | |
| 808 | class PyDirectory(Directory): |
| 809 | """By default, all components in the Python installer |
| 810 | can run from source.""" |
| 811 | def __init__(self, *args, **kw): |
| 812 | if not kw.has_key("componentflags"): |
| 813 | kw['componentflags'] = 2 #msidbComponentAttributesOptional |
| 814 | Directory.__init__(self, *args, **kw) |
| 815 | |
| 816 | # See "File Table", "Component Table", "Directory Table", |
| 817 | # "FeatureComponents Table" |
| 818 | def add_files(db): |
| 819 | cab = CAB("python") |
| 820 | tmpfiles = [] |
| 821 | # Add all executables, icons, text files into the TARGETDIR component |
| 822 | root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir") |
| 823 | default_feature.set_current() |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 824 | if not msilib.Win64: |
| 825 | root.add_file("PCBuild/w9xpopen.exe") |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 826 | root.add_file("PC/py.ico") |
| 827 | root.add_file("PC/pyc.ico") |
| 828 | root.add_file("README.txt", src="README") |
| 829 | root.add_file("NEWS.txt", src="Misc/NEWS") |
| 830 | root.add_file("LICENSE.txt", src="LICENSE") |
| 831 | root.start_component("python.exe", keyfile="python.exe") |
| 832 | root.add_file("PCBuild/python.exe") |
| 833 | root.start_component("pythonw.exe", keyfile="pythonw.exe") |
| 834 | root.add_file("PCBuild/pythonw.exe") |
| 835 | |
| 836 | # msidbComponentAttributesSharedDllRefCount = 8, see "Component Table" |
| 837 | dlldir = PyDirectory(db, cab, root, srcdir, "DLLDIR", ".") |
| 838 | pydll = "python%s%s.dll" % (major, minor) |
| 839 | pydllsrc = srcdir + "/PCBuild/" + pydll |
| 840 | dlldir.start_component("DLLDIR", flags = 8, keyfile = pydll) |
| 841 | installer = msilib.MakeInstaller() |
| 842 | pyversion = installer.FileVersion(pydllsrc, 0) |
| 843 | if not snapshot: |
| 844 | # For releases, the Python DLL has the same version as the |
| 845 | # installer package. |
| 846 | assert pyversion.split(".")[:3] == current_version.split(".") |
| 847 | dlldir.add_file("PCBuild/python%s%s.dll" % (major, minor), |
| 848 | version=pyversion, |
| 849 | language=installer.FileVersion(pydllsrc, 1)) |
| 850 | # XXX determine dependencies |
| 851 | version, lang = extract_msvcr71() |
| 852 | dlldir.start_component("msvcr71", flags=8, keyfile="msvcr71.dll") |
| 853 | dlldir.add_file("msvcr71.dll", src=os.path.abspath("msvcr71.dll"), |
| 854 | version=version, language=lang) |
| 855 | tmpfiles.append("msvcr71.dll") |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 856 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 857 | # Add all .py files in Lib, except lib-tk, test |
| 858 | dirs={} |
| 859 | pydirs = [(root,"Lib")] |
| 860 | while pydirs: |
| 861 | parent, dir = pydirs.pop() |
| 862 | if dir == "CVS" or dir.startswith("plat-"): |
| 863 | continue |
| 864 | elif dir in ["lib-tk", "idlelib", "Icons"]: |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 865 | if not have_tcl: |
| 866 | continue |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 867 | tcltk.set_current() |
| 868 | elif dir in ['test', 'output']: |
| 869 | testsuite.set_current() |
| 870 | else: |
| 871 | default_feature.set_current() |
| 872 | lib = PyDirectory(db, cab, parent, dir, dir, "%s|%s" % (parent.make_short(dir), dir)) |
| 873 | # Add additional files |
| 874 | dirs[dir]=lib |
| 875 | lib.glob("*.txt") |
| 876 | if dir=='site-packages': |
| 877 | continue |
| 878 | files = lib.glob("*.py") |
| 879 | files += lib.glob("*.pyw") |
| 880 | if files: |
| 881 | # Add an entry to the RemoveFile table to remove bytecode files. |
| 882 | lib.remove_pyc() |
| 883 | if dir=='test' and parent.physical=='Lib': |
| 884 | lib.add_file("185test.db") |
| 885 | lib.add_file("audiotest.au") |
| 886 | lib.add_file("cfgparser.1") |
| 887 | lib.add_file("test.xml") |
| 888 | lib.add_file("test.xml.out") |
| 889 | lib.add_file("testtar.tar") |
Martin v. Löwis | 7d3755d | 2004-09-06 06:31:12 +0000 | [diff] [blame] | 890 | lib.add_file("test_difflib_expect.html") |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 891 | lib.glob("*.uue") |
| 892 | lib.add_file("readme.txt", src="README") |
| 893 | if dir=='decimaltestdata': |
| 894 | lib.glob("*.decTest") |
| 895 | if dir=='output': |
| 896 | lib.glob("test_*") |
| 897 | if dir=='idlelib': |
| 898 | lib.glob("*.def") |
| 899 | lib.add_file("idle.bat") |
| 900 | if dir=="Icons": |
| 901 | lib.glob("*.gif") |
| 902 | lib.add_file("idle.icns") |
| 903 | if dir=="command": |
| 904 | lib.add_file("wininst-6.exe") |
| 905 | lib.add_file("wininst-7.1.exe") |
| 906 | if dir=="data" and parent.physical=="test" and parent.basedir.physical=="email": |
| 907 | # This should contain all non-CVS files listed in CVS |
| 908 | for f in os.listdir(lib.absolute): |
| 909 | if f.endswith(".txt") or f=="CVS":continue |
| 910 | if f.endswith(".au") or f.endswith(".gif"): |
| 911 | lib.add_file(f) |
| 912 | else: |
| 913 | print "WARNING: New file %s in email/test/data" % f |
| 914 | for f in os.listdir(lib.absolute): |
| 915 | if os.path.isdir(os.path.join(lib.absolute, f)): |
| 916 | pydirs.append((lib, f)) |
| 917 | # Add DLLs |
| 918 | default_feature.set_current() |
| 919 | lib = PyDirectory(db, cab, root, srcdir+"/PCBuild", "DLLs", "DLLS|DLLs") |
| 920 | dlls = [] |
| 921 | tclfiles = [] |
| 922 | for f in extensions: |
| 923 | if f=="_tkinter.pyd": |
| 924 | continue |
| 925 | if not os.path.exists(srcdir+"/PCBuild/"+f): |
| 926 | print "WARNING: Missing extension", f |
| 927 | continue |
| 928 | dlls.append(f) |
| 929 | lib.add_file(f) |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 930 | if have_tcl: |
| 931 | if not os.path.exists(srcdir+"/PCBuild/_tkinter.pyd"): |
| 932 | print "WARNING: Missing _tkinter.pyd" |
| 933 | else: |
| 934 | lib.start_component("TkDLLs", tcltk) |
| 935 | lib.add_file("_tkinter.pyd") |
| 936 | dlls.append("_tkinter.pyd") |
| 937 | tcldir = os.path.normpath(srcdir+"/../tcltk/bin") |
| 938 | for f in glob.glob1(tcldir, "*.dll"): |
| 939 | lib.add_file(f, src=os.path.join(tcldir, f)) |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 940 | # check whether there are any unknown extensions |
| 941 | for f in glob.glob1(srcdir+"/PCBuild", "*.pyd"): |
| 942 | if f.endswith("_d.pyd"): continue # debug version |
| 943 | if f in dlls: continue |
| 944 | print "WARNING: Unknown extension", f |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 945 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 946 | # Add headers |
| 947 | default_feature.set_current() |
| 948 | lib = PyDirectory(db, cab, root, "include", "include", "INCLUDE|include") |
| 949 | lib.glob("*.h") |
| 950 | lib.add_file("pyconfig.h", src="../PC/pyconfig.h") |
| 951 | # Add import libraries |
| 952 | lib = PyDirectory(db, cab, root, "PCBuild", "libs", "LIBS|libs") |
| 953 | for f in dlls: |
| 954 | lib.add_file(f.replace('pyd','lib')) |
| 955 | lib.add_file('python%s%s.lib' % (major, minor)) |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 956 | if have_tcl: |
| 957 | # Add Tcl/Tk |
| 958 | tcldirs = [(root, '../tcltk/lib', 'tcl')] |
| 959 | tcltk.set_current() |
| 960 | while tcldirs: |
| 961 | parent, phys, dir = tcldirs.pop() |
| 962 | lib = PyDirectory(db, cab, parent, phys, dir, "%s|%s" % (parent.make_short(dir), dir)) |
| 963 | if not os.path.exists(lib.absolute): |
| 964 | continue |
| 965 | for f in os.listdir(lib.absolute): |
| 966 | if os.path.isdir(os.path.join(lib.absolute, f)): |
| 967 | tcldirs.append((lib, f, f)) |
| 968 | else: |
| 969 | lib.add_file(f) |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 970 | # Add tools |
| 971 | tools.set_current() |
| 972 | tooldir = PyDirectory(db, cab, root, "Tools", "Tools", "TOOLS|Tools") |
| 973 | for f in ['i18n', 'pynche', 'Scripts', 'versioncheck', 'webchecker']: |
| 974 | lib = PyDirectory(db, cab, tooldir, f, f, "%s|%s" % (tooldir.make_short(f), f)) |
| 975 | lib.glob("*.py") |
| 976 | lib.glob("*.pyw", exclude=['pydocgui.pyw']) |
| 977 | lib.remove_pyc() |
| 978 | lib.glob("*.txt") |
| 979 | if f == "pynche": |
| 980 | x = PyDirectory(db, cab, lib, "X", "X", "X|X") |
| 981 | x.glob("*.txt") |
| 982 | if f == 'Scripts': |
| 983 | lib.add_file("README.txt", src="README") |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 984 | if have_tcl: |
| 985 | lib.start_component("pydocgui.pyw", tcltk, keyfile="pydocgui.pyw") |
| 986 | lib.add_file("pydocgui.pyw") |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 987 | # Add documentation |
| 988 | htmlfiles.set_current() |
| 989 | lib = PyDirectory(db, cab, root, "Doc", "Doc", "DOC|Doc") |
| 990 | lib.start_component("documentation", keyfile="Python%s%s.chm" % (major,minor)) |
| 991 | lib.add_file("Python%s%s.chm" % (major, minor)) |
| 992 | |
| 993 | cab.commit(db) |
| 994 | |
| 995 | for f in tmpfiles: |
| 996 | os.unlink(f) |
| 997 | |
| 998 | # See "Registry Table", "Component Table" |
| 999 | def add_registry(db): |
| 1000 | # File extensions, associated with the REGISTRY.def component |
| 1001 | # IDLE verbs depend on the tcltk feature. |
| 1002 | # msidbComponentAttributesRegistryKeyPath = 4 |
| 1003 | # -1 for Root specifies "dependent on ALLUSERS property" |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 1004 | tcldata = [] |
| 1005 | if have_tcl: |
| 1006 | tcldata = [ |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 1007 | ("REGISTRY.tcl", msilib.gen_uuid(), "TARGETDIR", 4, None, |
| 1008 | "py.IDLE")] |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1009 | add_data(db, "Component", |
| 1010 | # msidbComponentAttributesRegistryKeyPath = 4 |
| 1011 | [("REGISTRY", msilib.gen_uuid(), "TARGETDIR", 4, None, |
| 1012 | "InstallPath"), |
| 1013 | ("REGISTRY.def", msilib.gen_uuid(), "TARGETDIR", 4, |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 1014 | None, None)] + tcldata) |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1015 | # See "FeatureComponents Table". |
| 1016 | # The association between TclTk and pythonw.exe is necessary to make ICE59 |
| 1017 | # happy, because the installer otherwise believes that the IDLE and PyDoc |
| 1018 | # shortcuts might get installed without pythonw.exe being install. This |
| 1019 | # is not true, since installing TclTk will install the default feature, which |
| 1020 | # will cause pythonw.exe to be installed. |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 1021 | # REGISTRY.tcl is not associated with any feature, as it will be requested |
| 1022 | # through a custom action |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 1023 | tcldata = [] |
| 1024 | if have_tcl: |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 1025 | tcldata = [(tcltk.id, "pythonw.exe")] |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1026 | add_data(db, "FeatureComponents", |
| 1027 | [(default_feature.id, "REGISTRY"), |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 1028 | (ext_feature.id, "REGISTRY.def")] + |
| 1029 | tcldata |
| 1030 | ) |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 1031 | # Extensions are not advertised. For advertised extensions, |
| 1032 | # we would need separate binaries that install along with the |
| 1033 | # extension. |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1034 | pat = r"Software\Classes\%sPython.%sFile\shell\%s\command" |
| 1035 | ewi = "Edit with IDLE" |
| 1036 | pat2 = r"Software\Classes\%sPython.%sFile\DefaultIcon" |
| 1037 | pat3 = r"Software\Classes\%sPython.%sFile" |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 1038 | add_data(db, "Registry", |
| 1039 | [# Extensions |
| 1040 | ("py.ext", -1, r"Software\Classes\."+ext, "", |
| 1041 | "Python.File", "REGISTRY.def"), |
| 1042 | ("pyw.ext", -1, r"Software\Classes\."+ext+'w', "", |
| 1043 | "Python.NoConFile", "REGISTRY.def"), |
| 1044 | ("pyc.ext", -1, r"Software\Classes\."+ext+'c', "", |
| 1045 | "Python.CompiledFile", "REGISTRY.def"), |
| 1046 | ("pyo.ext", -1, r"Software\Classes\."+ext+'o', "", |
| 1047 | "Python.CompiledFile", "REGISTRY.def"), |
| 1048 | # MIME types |
| 1049 | ("py.mime", -1, r"Software\Classes\."+ext, "Content Type", |
| 1050 | "text/plain", "REGISTRY.def"), |
| 1051 | ("pyw.mime", -1, r"Software\Classes\."+ext+'w', "Content Type", |
| 1052 | "text/plain", "REGISTRY.def"), |
| 1053 | #Verbs |
| 1054 | ("py.open", -1, pat % (testprefix, "", "open"), "", |
| 1055 | r'"[TARGETDIR]python.exe" "%1" %*', "REGISTRY.def"), |
| 1056 | ("pyw.open", -1, pat % (testprefix, "NoCon", "open"), "", |
| 1057 | r'"[TARGETDIR]pythonw.exe" "%1" %*', "REGISTRY.def"), |
| 1058 | ("pyc.open", -1, pat % (testprefix, "Compiled", "open"), "", |
| 1059 | r'"[TARGETDIR]python.exe" "%1" %*', "REGISTRY.def"), |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1060 | ("py.IDLE", -1, pat % (testprefix, "", ewi), "", |
| 1061 | r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" -n -e "%1"', |
| 1062 | "REGISTRY.tcl"), |
| 1063 | ("pyw.IDLE", -1, pat % (testprefix, "NoCon", ewi), "", |
| 1064 | r'"[TARGETDIR]pythonw.exe" "[TARGETDIR]Lib\idlelib\idle.pyw" -n -e "%1"', |
| 1065 | "REGISTRY.tcl"), |
Martin v. Löwis | dff68d0 | 2004-09-10 09:20:10 +0000 | [diff] [blame] | 1066 | #Icons |
| 1067 | ("py.icon", -1, pat2 % (testprefix, ""), "", |
| 1068 | r'[TARGETDIR]py.ico', "REGISTRY.def"), |
| 1069 | ("pyw.icon", -1, pat2 % (testprefix, "NoCon"), "", |
| 1070 | r'[TARGETDIR]py.ico', "REGISTRY.def"), |
| 1071 | ("pyc.icon", -1, pat2 % (testprefix, "Compiled"), "", |
| 1072 | r'[TARGETDIR]pyc.ico', "REGISTRY.def"), |
| 1073 | # Descriptions |
| 1074 | ("py.txt", -1, pat3 % (testprefix, ""), "", |
| 1075 | "Python File", "REGISTRY.def"), |
| 1076 | ("pyw.txt", -1, pat3 % (testprefix, "NoCon"), "", |
| 1077 | "Python File (no console)", "REGISTRY.def"), |
| 1078 | ("pyc.txt", -1, pat3 % (testprefix, "Compiled"), "", |
| 1079 | "Compiled Python File", "REGISTRY.def"), |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1080 | ]) |
Tim Peters | 66cb018 | 2004-08-26 05:23:19 +0000 | [diff] [blame] | 1081 | |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1082 | # Registry keys |
| 1083 | prefix = r"Software\%sPython\PythonCore\%s" % (testprefix, short_version) |
| 1084 | add_data(db, "Registry", |
| 1085 | [("InstallPath", -1, prefix+r"\InstallPath", "", "[TARGETDIR]", "REGISTRY"), |
| 1086 | ("InstallGroup", -1, prefix+r"\InstallPath\InstallGroup", "", |
| 1087 | "Python %s" % short_version, "REGISTRY"), |
| 1088 | ("PythonPath", -1, prefix+r"\PythonPath", "", |
Martin v. Löwis | f13337d | 2004-09-19 18:36:45 +0000 | [diff] [blame] | 1089 | r"[TARGETDIR]Lib;[TARGETDIR]DLLs;[TARGETDIR]Lib\lib-tk", "REGISTRY"), |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1090 | ("Documentation", -1, prefix+r"\Help\Main Python Documentation", "", |
| 1091 | r"[TARGETDIR]Doc\Python%s%s.chm" % (major, minor), "REGISTRY"), |
| 1092 | ("Modules", -1, prefix+r"\Modules", "+", None, "REGISTRY"), |
| 1093 | ("AppPaths", -1, r"Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe", |
| 1094 | "", r"[TARGETDIR]Python.exe", "REGISTRY.def") |
| 1095 | ]) |
| 1096 | # Shortcuts, see "Shortcut Table" |
| 1097 | add_data(db, "Directory", |
| 1098 | [("ProgramMenuFolder", "TARGETDIR", "."), |
| 1099 | ("MenuDir", "ProgramMenuFolder", "PY%s%s|%sPython %s.%s" % (major,minor,testprefix,major,minor))]) |
| 1100 | add_data(db, "RemoveFile", |
| 1101 | [("MenuDir", "TARGETDIR", None, "MenuDir", 2)]) |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 1102 | tcltkshortcuts = [] |
| 1103 | if have_tcl: |
| 1104 | tcltkshortcuts = [ |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1105 | ("IDLE", "MenuDir", "IDLE|IDLE (Python GUI)", "pythonw.exe", |
| 1106 | tcltk.id, r"[TARGETDIR]Lib\idlelib\idle.pyw", None, None, "python_icon.exe", 0, None, "TARGETDIR"), |
| 1107 | ("PyDoc", "MenuDir", "MODDOCS|Module Docs", "pythonw.exe", |
| 1108 | tcltk.id, r"[TARGETDIR]Tools\scripts\pydocgui.pyw", None, None, "python_icon.exe", 0, None, "TARGETDIR"), |
Martin v. Löwis | e0f780d | 2004-09-01 14:51:06 +0000 | [diff] [blame] | 1109 | ] |
| 1110 | add_data(db, "Shortcut", |
| 1111 | tcltkshortcuts + |
| 1112 | [# Advertised shortcuts: targets are features, not files |
Martin v. Löwis | 8ffe9ab | 2004-08-22 13:34:34 +0000 | [diff] [blame] | 1113 | ("Python", "MenuDir", "PYTHON|Python (command line)", "python.exe", |
| 1114 | default_feature.id, None, None, None, "python_icon.exe", 2, None, "TARGETDIR"), |
| 1115 | ("Manual", "MenuDir", "MANUAL|Python Manuals", "documentation", |
| 1116 | htmlfiles.id, None, None, None, None, None, None, None), |
| 1117 | ## Non-advertised shortcuts: must be associated with a registry component |
| 1118 | ("Uninstall", "MenuDir", "UNINST|Uninstall Python", "REGISTRY", |
| 1119 | SystemFolderName+"msiexec", "/x%s" % product_code, |
| 1120 | None, None, None, None, None, None), |
| 1121 | ]) |
| 1122 | db.Commit() |
| 1123 | |
| 1124 | db = build_database() |
| 1125 | try: |
| 1126 | add_features(db) |
| 1127 | add_ui(db) |
| 1128 | add_files(db) |
| 1129 | add_registry(db) |
| 1130 | remove_old_versions(db) |
| 1131 | db.Commit() |
| 1132 | finally: |
| 1133 | del db |