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