annotate Lib/distutils/command/bdist_msi.py @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents c83a172ee931
children 9c744dfcf4de
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
54245
c83a172ee931 fixed encoding
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 53763
diff changeset
1 # -*- coding: utf-8 -*-
c83a172ee931 fixed encoding
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 53763
diff changeset
2 # Copyright (C) 2005, 2006 Martin von Löwis
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
3 # Licensed to PSF under a Contributor Agreement.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
4 # The bdist_wininst command proper
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
5 # based on bdist_wininst
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
6 """
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
7 Implements the bdist_msi command.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
8 """
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
9
45468
1d84bf5f9478 Patch #2167 from calvin: Remove unused imports
Christian Heimes <christian@cheimes.de>
parents: 42684
diff changeset
10 import sys, os
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
11 from distutils.core import Command
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
12 from distutils.dir_util import remove_tree
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
13 from distutils.sysconfig import get_python_version
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
14 from distutils.version import StrictVersion
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
15 from distutils.errors import DistutilsOptionError
46331
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
16 from distutils.util import get_platform
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
17 from distutils import log
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
18 import msilib
38072
ee98ecf05773 Rename parameters to match the documentation (which
Martin v. Löwis <martin@v.loewis.de>
parents: 36905
diff changeset
19 from msilib import schema, sequence, text
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
20 from msilib import Directory, Feature, Dialog, add_data
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
21
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
22 class PyDialog(Dialog):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
23 """Dialog class with a fixed layout: controls at the top, then a ruler,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
24 then a list of buttons: back, next, cancel. Optionally a bitmap at the
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
25 left."""
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
26 def __init__(self, *args, **kw):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
27 """Dialog(database, name, x, y, w, h, attributes, title, first,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
28 default, cancel, bitmap=true)"""
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
29 Dialog.__init__(self, *args)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
30 ruler = self.h - 36
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
31 bmwidth = 152*ruler/328
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
32 #if kw.get("bitmap", True):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
33 # self.bitmap("Bitmap", 0, 0, bmwidth, ruler, "PythonWin")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
34 self.line("BottomLine", 0, ruler, self.w, 0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
35
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
36 def title(self, title):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
37 "Set the title text of the dialog at the top."
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
38 # name, x, y, w, h, flags=Visible|Enabled|Transparent|NoPrefix,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
39 # text, in VerdanaBold10
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
40 self.text("Title", 15, 10, 320, 60, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
41 r"{\VerdanaBold10}%s" % title)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
42
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
43 def back(self, title, next, name = "Back", active = 1):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
44 """Add a back button with a given title, the tab-next button,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
45 its name in the Control table, possibly initially disabled.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
46
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
47 Return the button, so that events can be associated"""
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
48 if active:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
49 flags = 3 # Visible|Enabled
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
50 else:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
51 flags = 1 # Visible
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
52 return self.pushbutton(name, 180, self.h-27 , 56, 17, flags, title, next)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
53
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
54 def cancel(self, title, next, name = "Cancel", active = 1):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
55 """Add a cancel button with a given title, the tab-next button,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
56 its name in the Control table, possibly initially disabled.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
57
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
58 Return the button, so that events can be associated"""
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
59 if active:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
60 flags = 3 # Visible|Enabled
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
61 else:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
62 flags = 1 # Visible
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
63 return self.pushbutton(name, 304, self.h-27, 56, 17, flags, title, next)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
64
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
65 def next(self, title, next, name = "Next", active = 1):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
66 """Add a Next button with a given title, the tab-next button,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
67 its name in the Control table, possibly initially disabled.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
68
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
69 Return the button, so that events can be associated"""
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
70 if active:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
71 flags = 3 # Visible|Enabled
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
72 else:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
73 flags = 1 # Visible
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
74 return self.pushbutton(name, 236, self.h-27, 56, 17, flags, title, next)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
75
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
76 def xbutton(self, name, title, next, xpos):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
77 """Add a button with a given title, the tab-next button,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
78 its name in the Control table, giving its x position; the
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
79 y-position is aligned with the other buttons.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
80
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
81 Return the button, so that events can be associated"""
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
82 return self.pushbutton(name, int(self.w*xpos - 28), self.h-27, 56, 17, 3, title, next)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
83
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
84 class bdist_msi (Command):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
85
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
86 description = "create a Microsoft Installer (.msi) binary distribution"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
87
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
88 user_options = [('bdist-dir=', None,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
89 "temporary directory for creating the distribution"),
46331
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
90 ('plat-name=', 'p',
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
91 "platform name to embed in generated filenames "
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
92 "(default: %s)" % get_platform()),
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
93 ('keep-temp', 'k',
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
94 "keep the pseudo-installation tree around after " +
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
95 "creating the distribution archive"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
96 ('target-version=', None,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
97 "require a specific python version" +
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
98 " on the target system"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
99 ('no-target-compile', 'c',
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
100 "do not compile .py to .pyc on the target system"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
101 ('no-target-optimize', 'o',
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
102 "do not compile .py to .pyo (optimized)"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
103 "on the target system"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
104 ('dist-dir=', 'd',
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
105 "directory to put final built distributions in"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
106 ('skip-build', None,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
107 "skip rebuilding everything (for testing/debugging)"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
108 ('install-script=', None,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
109 "basename of installation script to be run after"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
110 "installation or before deinstallation"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
111 ('pre-install-script=', None,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
112 "Fully qualified filename of a script to be run before "
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
113 "any files are installed. This script need not be in the "
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
114 "distribution"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
115 ]
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
116
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
117 boolean_options = ['keep-temp', 'no-target-compile', 'no-target-optimize',
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
118 'skip-build']
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
119
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
120 all_versions = ['2.0', '2.1', '2.2', '2.3', '2.4',
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
121 '2.5', '2.6', '2.7', '2.8', '2.9',
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
122 '3.0', '3.1', '3.2', '3.3', '3.4',
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
123 '3.5', '3.6', '3.7', '3.8', '3.9']
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
124 other_version = 'X'
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
125
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
126 def initialize_options (self):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
127 self.bdist_dir = None
46331
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
128 self.plat_name = None
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
129 self.keep_temp = 0
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
130 self.no_target_compile = 0
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
131 self.no_target_optimize = 0
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
132 self.target_version = None
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
133 self.dist_dir = None
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
134 self.skip_build = 0
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
135 self.install_script = None
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
136 self.pre_install_script = None
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
137 self.versions = None
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
138
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
139 def finalize_options (self):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
140 if self.bdist_dir is None:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
141 bdist_base = self.get_finalized_command('bdist').bdist_base
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
142 self.bdist_dir = os.path.join(bdist_base, 'msi')
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
143 short_version = get_python_version()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
144 if self.target_version:
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
145 self.versions = [self.target_version]
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
146 if not self.skip_build and self.distribution.has_ext_modules()\
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
147 and self.target_version != short_version:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
148 raise DistutilsOptionError, \
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
149 "target version can only be %s, or the '--skip_build'" \
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
150 " option must be specified" % (short_version,)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
151 else:
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
152 self.versions = list(self.all_versions)
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
153
46331
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
154 self.set_undefined_options('bdist',
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
155 ('dist_dir', 'dist_dir'),
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
156 ('plat_name', 'plat_name'),
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
157 )
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
158
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
159 if self.pre_install_script:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
160 raise DistutilsOptionError, "the pre-install-script feature is not yet implemented"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
161
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
162 if self.install_script:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
163 for script in self.distribution.scripts:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
164 if self.install_script == os.path.basename(script):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
165 break
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
166 else:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
167 raise DistutilsOptionError, \
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
168 "install_script '%s' not found in scripts" % \
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
169 self.install_script
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
170 self.install_script_key = None
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
171 # finalize_options()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
172
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
173
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
174 def run (self):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
175 if not self.skip_build:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
176 self.run_command('build')
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
177
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
178 install = self.reinitialize_command('install', reinit_subcommands=1)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
179 install.prefix = self.bdist_dir
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
180 install.skip_build = self.skip_build
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
181 install.warn_dir = 0
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
182
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
183 install_lib = self.reinitialize_command('install_lib')
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
184 # we do not want to include pyc or pyo files
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
185 install_lib.compile = 0
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
186 install_lib.optimize = 0
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
187
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
188 if self.distribution.has_ext_modules():
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
189 # If we are building an installer for a Python version other
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
190 # than the one we are currently running, then we need to ensure
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
191 # our build_lib reflects the other Python version rather than ours.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
192 # Note that for target_version!=sys.version, we must have skipped the
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
193 # build step, so there is no issue with enforcing the build of this
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
194 # version.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
195 target_version = self.target_version
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
196 if not target_version:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
197 assert self.skip_build, "Should have already checked this"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
198 target_version = sys.version[0:3]
46331
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
199 plat_specifier = ".%s-%s" % (self.plat_name, target_version)
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
200 build = self.get_finalized_command('build')
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
201 build.build_lib = os.path.join(build.build_base,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
202 'lib' + plat_specifier)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
203
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
204 log.info("installing to %s", self.bdist_dir)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
205 install.ensure_finalized()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
206
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
207 # avoid warning of 'install_lib' about installing
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
208 # into a directory not in sys.path
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
209 sys.path.insert(0, os.path.join(self.bdist_dir, 'PURELIB'))
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
210
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
211 install.run()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
212
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
213 del sys.path[0]
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
214
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
215 self.mkpath(self.dist_dir)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
216 fullname = self.distribution.get_fullname()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
217 installer_name = self.get_installer_filename(fullname)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
218 installer_name = os.path.abspath(installer_name)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
219 if os.path.exists(installer_name): os.unlink(installer_name)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
220
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
221 metadata = self.distribution.metadata
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
222 author = metadata.author
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
223 if not author:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
224 author = metadata.maintainer
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
225 if not author:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
226 author = "UNKNOWN"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
227 version = metadata.get_version()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
228 # ProductVersion must be strictly numeric
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
229 # XXX need to deal with prerelease versions
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
230 sversion = "%d.%d.%d" % StrictVersion(version).version
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
231 # Prefix ProductName with Python x.y, so that
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
232 # it sorts together with the other Python packages
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
233 # in Add-Remove-Programs (APR)
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
234 fullname = self.distribution.get_fullname()
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
235 if self.target_version:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
236 product_name = "Python %s %s" % (self.target_version, fullname)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
237 else:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
238 product_name = "Python %s" % (fullname)
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
239 self.db = msilib.init_database(installer_name, schema,
36905
ca29dda563b7 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 36845
diff changeset
240 product_name, msilib.gen_uuid(),
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
241 sversion, author)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
242 msilib.add_tables(self.db, sequence)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
243 props = [('DistVersion', version)]
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
244 email = metadata.author_email or metadata.maintainer_email
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
245 if email:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
246 props.append(("ARPCONTACT", email))
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
247 if metadata.url:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
248 props.append(("ARPURLINFOABOUT", metadata.url))
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
249 if props:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
250 add_data(self.db, 'Property', props)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
251
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
252 self.add_find_python()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
253 self.add_files()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
254 self.add_scripts()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
255 self.add_ui()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
256 self.db.Commit()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
257
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
258 if hasattr(self.distribution, 'dist_files'):
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
259 tup = 'bdist_msi', self.target_version or 'any', fullname
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
260 self.distribution.dist_files.append(tup)
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
261
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
262 if not self.keep_temp:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
263 remove_tree(self.bdist_dir, dry_run=self.dry_run)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
264
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
265 def add_files(self):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
266 db = self.db
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
267 cab = msilib.CAB("distfiles")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
268 rootdir = os.path.abspath(self.bdist_dir)
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
269
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
270 root = Directory(db, cab, None, rootdir, "TARGETDIR", "SourceDir")
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
271 f = Feature(db, "Python", "Python", "Everything",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
272 0, 1, directory="TARGETDIR")
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
273
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
274 items = [(f, root, '')]
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
275 for version in self.versions + [self.other_version]:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
276 target = "TARGETDIR" + version
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
277 name = default = "Python" + version
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
278 desc = "Everything"
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
279 if version is self.other_version:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
280 title = "Python from another location"
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
281 level = 2
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
282 else:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
283 title = "Python %s from registry" % version
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
284 level = 1
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
285 f = Feature(db, name, title, desc, 1, level, directory=target)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
286 dir = Directory(db, cab, root, rootdir, target, default)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
287 items.append((f, dir, version))
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
288 db.Commit()
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
289
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
290 seen = {}
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
291 for feature, dir, version in items:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
292 todo = [dir]
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
293 while todo:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
294 dir = todo.pop()
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
295 for file in os.listdir(dir.absolute):
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
296 afile = os.path.join(dir.absolute, file)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
297 if os.path.isdir(afile):
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
298 short = "%s|%s" % (dir.make_short(file), file)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
299 default = file + version
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
300 newdir = Directory(db, cab, dir, file, default, short)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
301 todo.append(newdir)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
302 else:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
303 if not dir.component:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
304 dir.start_component(dir.logical, feature, 0)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
305 if afile not in seen:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
306 key = seen[afile] = dir.add_file(file)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
307 if file==self.install_script:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
308 if self.install_script_key:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
309 raise DistutilsOptionError(
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
310 "Multiple files with name %s" % file)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
311 self.install_script_key = '[#%s]' % key
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
312 else:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
313 key = seen[afile]
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
314 add_data(self.db, "DuplicateFile",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
315 [(key + version, dir.component, key, None, dir.logical)])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
316
36905
ca29dda563b7 Whitespace normalization.
Tim Peters <tim.peters@gmail.com>
parents: 36845
diff changeset
317
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
318 cab.commit(db)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
319
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
320 def add_find_python(self):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
321 """Adds code to the installer to compute the location of Python.
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
322
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
323 Properties PYTHON.MACHINE.X.Y and PYTHON.USER.X.Y will be set from the
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
324 registry for each version of Python.
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
325
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
326 Properties TARGETDIRX.Y will be set from PYTHON.USER.X.Y if defined,
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
327 else from PYTHON.MACHINE.X.Y.
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
328
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
329 Properties PYTHONX.Y will be set to TARGETDIRX.Y\\python.exe"""
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
330
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
331 start = 402
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
332 for ver in self.versions:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
333 install_path = r"SOFTWARE\Python\PythonCore\%s\InstallPath" % ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
334 machine_reg = "python.machine." + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
335 user_reg = "python.user." + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
336 machine_prop = "PYTHON.MACHINE." + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
337 user_prop = "PYTHON.USER." + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
338 machine_action = "PythonFromMachine" + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
339 user_action = "PythonFromUser" + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
340 exe_action = "PythonExe" + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
341 target_dir_prop = "TARGETDIR" + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
342 exe_prop = "PYTHON" + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
343 add_data(self.db, "RegLocator",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
344 [(machine_reg, 2, install_path, None, 2),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
345 (user_reg, 1, install_path, None, 2)])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
346 add_data(self.db, "AppSearch",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
347 [(machine_prop, machine_reg),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
348 (user_prop, user_reg)])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
349 add_data(self.db, "CustomAction",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
350 [(machine_action, 51+256, target_dir_prop, "[" + machine_prop + "]"),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
351 (user_action, 51+256, target_dir_prop, "[" + user_prop + "]"),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
352 (exe_action, 51+256, exe_prop, "[" + target_dir_prop + "]\\python.exe"),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
353 ])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
354 add_data(self.db, "InstallExecuteSequence",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
355 [(machine_action, machine_prop, start),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
356 (user_action, user_prop, start + 1),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
357 (exe_action, None, start + 2),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
358 ])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
359 add_data(self.db, "InstallUISequence",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
360 [(machine_action, machine_prop, start),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
361 (user_action, user_prop, start + 1),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
362 (exe_action, None, start + 2),
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
363 ])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
364 add_data(self.db, "Condition",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
365 [("Python" + ver, 0, "NOT TARGETDIR" + ver)])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
366 start += 4
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
367 assert start < 500
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
368
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
369 def add_scripts(self):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
370 if self.install_script:
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
371 start = 6800
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
372 for ver in self.versions + [self.other_version]:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
373 install_action = "install_script." + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
374 exe_prop = "PYTHON" + ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
375 add_data(self.db, "CustomAction",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
376 [(install_action, 50, exe_prop, self.install_script_key)])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
377 add_data(self.db, "InstallExecuteSequence",
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
378 [(install_action, "&Python%s=3" % ver, start)])
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
379 start += 1
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
380 # XXX pre-install scripts are currently refused in finalize_options()
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
381 # but if this feature is completed, it will also need to add
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
382 # entries for each version as the above code does
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
383 if self.pre_install_script:
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
384 scriptfn = os.path.join(self.bdist_dir, "preinstall.bat")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
385 f = open(scriptfn, "w")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
386 # The batch file will be executed with [PYTHON], so that %1
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
387 # is the path to the Python interpreter; %0 will be the path
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
388 # of the batch file.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
389 # rem ="""
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
390 # %1 %0
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
391 # exit
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
392 # """
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
393 # <actual script>
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
394 f.write('rem ="""\n%1 %0\nexit\n"""\n')
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
395 f.write(open(self.pre_install_script).read())
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
396 f.close()
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
397 add_data(self.db, "Binary",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
398 [("PreInstall", msilib.Binary(scriptfn))
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
399 ])
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
400 add_data(self.db, "CustomAction",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
401 [("PreInstall", 2, "PreInstall", None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
402 ])
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
403 add_data(self.db, "InstallExecuteSequence",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
404 [("PreInstall", "NOT Installed", 450)])
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
405
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
406
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
407 def add_ui(self):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
408 db = self.db
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
409 x = y = 50
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
410 w = 370
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
411 h = 300
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
412 title = "[ProductName] Setup"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
413
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
414 # see "Dialog Style Bits"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
415 modal = 3 # visible | modal
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
416 modeless = 1 # visible
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
417 track_disk_space = 32
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
418
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
419 # UI customization properties
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
420 add_data(db, "Property",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
421 # See "DefaultUIFont Property"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
422 [("DefaultUIFont", "DlgFont8"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
423 # See "ErrorDialog Style Bit"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
424 ("ErrorDialog", "ErrorDlg"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
425 ("Progress1", "Install"), # modified in maintenance type dlg
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
426 ("Progress2", "installs"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
427 ("MaintenanceForm_Action", "Repair"),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
428 # possible values: ALL, JUSTME
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
429 ("WhichUsers", "ALL")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
430 ])
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
431
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
432 # Fonts, see "TextStyle Table"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
433 add_data(db, "TextStyle",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
434 [("DlgFont8", "Tahoma", 9, None, 0),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
435 ("DlgFontBold8", "Tahoma", 8, None, 1), #bold
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
436 ("VerdanaBold10", "Verdana", 10, None, 1),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
437 ("VerdanaRed9", "Verdana", 9, 255, 0),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
438 ])
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
439
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
440 # UI Sequences, see "InstallUISequence Table", "Using a Sequence Table"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
441 # Numbers indicate sequence; see sequence.py for how these action integrate
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
442 add_data(db, "InstallUISequence",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
443 [("PrepareDlg", "Not Privileged or Windows9x or Installed", 140),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
444 ("WhichUsersDlg", "Privileged and not Windows9x and not Installed", 141),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
445 # In the user interface, assume all-users installation if privileged.
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
446 ("SelectFeaturesDlg", "Not Installed", 1230),
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
447 # XXX no support for resume installations yet
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
448 #("ResumeDlg", "Installed AND (RESUME OR Preselected)", 1240),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
449 ("MaintenanceTypeDlg", "Installed AND NOT RESUME AND NOT Preselected", 1250),
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
450 ("ProgressDlg", None, 1280)])
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
451
38072
ee98ecf05773 Rename parameters to match the documentation (which
Martin v. Löwis <martin@v.loewis.de>
parents: 36905
diff changeset
452 add_data(db, 'ActionText', text.ActionText)
ee98ecf05773 Rename parameters to match the documentation (which
Martin v. Löwis <martin@v.loewis.de>
parents: 36905
diff changeset
453 add_data(db, 'UIText', text.UIText)
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
454 #####################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
455 # Standard dialogs: FatalError, UserExit, ExitDialog
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
456 fatal=PyDialog(db, "FatalError", x, y, w, h, modal, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
457 "Finish", "Finish", "Finish")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
458 fatal.title("[ProductName] Installer ended prematurely")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
459 fatal.back("< Back", "Finish", active = 0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
460 fatal.cancel("Cancel", "Back", active = 0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
461 fatal.text("Description1", 15, 70, 320, 80, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
462 "[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.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
463 fatal.text("Description2", 15, 155, 320, 20, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
464 "Click the Finish button to exit the Installer.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
465 c=fatal.next("Finish", "Cancel", name="Finish")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
466 c.event("EndDialog", "Exit")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
467
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
468 user_exit=PyDialog(db, "UserExit", x, y, w, h, modal, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
469 "Finish", "Finish", "Finish")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
470 user_exit.title("[ProductName] Installer was interrupted")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
471 user_exit.back("< Back", "Finish", active = 0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
472 user_exit.cancel("Cancel", "Back", active = 0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
473 user_exit.text("Description1", 15, 70, 320, 80, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
474 "[ProductName] setup was interrupted. Your system has not been modified. "
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
475 "To install this program at a later time, please run the installation again.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
476 user_exit.text("Description2", 15, 155, 320, 20, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
477 "Click the Finish button to exit the Installer.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
478 c = user_exit.next("Finish", "Cancel", name="Finish")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
479 c.event("EndDialog", "Exit")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
480
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
481 exit_dialog = PyDialog(db, "ExitDialog", x, y, w, h, modal, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
482 "Finish", "Finish", "Finish")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
483 exit_dialog.title("Completing the [ProductName] Installer")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
484 exit_dialog.back("< Back", "Finish", active = 0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
485 exit_dialog.cancel("Cancel", "Back", active = 0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
486 exit_dialog.text("Description", 15, 235, 320, 20, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
487 "Click the Finish button to exit the Installer.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
488 c = exit_dialog.next("Finish", "Cancel", name="Finish")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
489 c.event("EndDialog", "Return")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
490
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
491 #####################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
492 # Required dialog: FilesInUse, ErrorDlg
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
493 inuse = PyDialog(db, "FilesInUse",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
494 x, y, w, h,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
495 19, # KeepModeless|Modal|Visible
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
496 title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
497 "Retry", "Retry", "Retry", bitmap=False)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
498 inuse.text("Title", 15, 6, 200, 15, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
499 r"{\DlgFontBold8}Files in Use")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
500 inuse.text("Description", 20, 23, 280, 20, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
501 "Some files that need to be updated are currently in use.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
502 inuse.text("Text", 20, 55, 330, 50, 3,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
503 "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.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
504 inuse.control("List", "ListBox", 20, 107, 330, 130, 7, "FileInUseProcess",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
505 None, None, None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
506 c=inuse.back("Exit", "Ignore", name="Exit")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
507 c.event("EndDialog", "Exit")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
508 c=inuse.next("Ignore", "Retry", name="Ignore")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
509 c.event("EndDialog", "Ignore")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
510 c=inuse.cancel("Retry", "Exit", name="Retry")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
511 c.event("EndDialog","Retry")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
512
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
513 # See "Error Dialog". See "ICE20" for the required names of the controls.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
514 error = Dialog(db, "ErrorDlg",
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
515 50, 10, 330, 101,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
516 65543, # Error|Minimize|Modal|Visible
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
517 title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
518 "ErrorText", None, None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
519 error.text("ErrorText", 50,9,280,48,3, "")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
520 #error.control("ErrorIcon", "Icon", 15, 9, 24, 24, 5242881, None, "py.ico", None, None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
521 error.pushbutton("N",120,72,81,21,3,"No",None).event("EndDialog","ErrorNo")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
522 error.pushbutton("Y",240,72,81,21,3,"Yes",None).event("EndDialog","ErrorYes")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
523 error.pushbutton("A",0,72,81,21,3,"Abort",None).event("EndDialog","ErrorAbort")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
524 error.pushbutton("C",42,72,81,21,3,"Cancel",None).event("EndDialog","ErrorCancel")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
525 error.pushbutton("I",81,72,81,21,3,"Ignore",None).event("EndDialog","ErrorIgnore")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
526 error.pushbutton("O",159,72,81,21,3,"Ok",None).event("EndDialog","ErrorOk")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
527 error.pushbutton("R",198,72,81,21,3,"Retry",None).event("EndDialog","ErrorRetry")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
528
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
529 #####################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
530 # Global "Query Cancel" dialog
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
531 cancel = Dialog(db, "CancelDlg", 50, 10, 260, 85, 3, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
532 "No", "No", "No")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
533 cancel.text("Text", 48, 15, 194, 30, 3,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
534 "Are you sure you want to cancel [ProductName] installation?")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
535 #cancel.control("Icon", "Icon", 15, 15, 24, 24, 5242881, None,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
536 # "py.ico", None, None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
537 c=cancel.pushbutton("Yes", 72, 57, 56, 17, 3, "Yes", "No")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
538 c.event("EndDialog", "Exit")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
539
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
540 c=cancel.pushbutton("No", 132, 57, 56, 17, 3, "No", "Yes")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
541 c.event("EndDialog", "Return")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
542
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
543 #####################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
544 # Global "Wait for costing" dialog
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
545 costing = Dialog(db, "WaitForCostingDlg", 50, 10, 260, 85, modal, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
546 "Return", "Return", "Return")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
547 costing.text("Text", 48, 15, 194, 30, 3,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
548 "Please wait while the installer finishes determining your disk space requirements.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
549 c = costing.pushbutton("Return", 102, 57, 56, 17, 3, "Return", None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
550 c.event("EndDialog", "Exit")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
551
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
552 #####################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
553 # Preparation dialog: no user input except cancellation
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
554 prep = PyDialog(db, "PrepareDlg", x, y, w, h, modeless, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
555 "Cancel", "Cancel", "Cancel")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
556 prep.text("Description", 15, 70, 320, 40, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
557 "Please wait while the Installer prepares to guide you through the installation.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
558 prep.title("Welcome to the [ProductName] Installer")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
559 c=prep.text("ActionText", 15, 110, 320, 20, 0x30003, "Pondering...")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
560 c.mapping("ActionText", "Text")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
561 c=prep.text("ActionData", 15, 135, 320, 30, 0x30003, None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
562 c.mapping("ActionData", "Text")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
563 prep.back("Back", None, active=0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
564 prep.next("Next", None, active=0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
565 c=prep.cancel("Cancel", None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
566 c.event("SpawnDialog", "CancelDlg")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
567
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
568 #####################################################################
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
569 # Feature (Python directory) selection
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
570 seldlg = PyDialog(db, "SelectFeaturesDlg", x, y, w, h, modal, title,
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
571 "Next", "Next", "Cancel")
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
572 seldlg.title("Select Python Installations")
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
573
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
574 seldlg.text("Hint", 15, 30, 300, 20, 3,
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
575 "Select the Python locations where %s should be installed."
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
576 % self.distribution.get_fullname())
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
577
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
578 seldlg.back("< Back", None, active=0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
579 c = seldlg.next("Next >", "Cancel")
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
580 order = 1
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
581 c.event("[TARGETDIR]", "[SourceDir]", ordering=order)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
582 for version in self.versions + [self.other_version]:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
583 order += 1
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
584 c.event("[TARGETDIR]", "[TARGETDIR%s]" % version,
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
585 "FEATURE_SELECTED AND &Python%s=3" % version,
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
586 ordering=order)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
587 c.event("SpawnWaitDialog", "WaitForCostingDlg", ordering=order + 1)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
588 c.event("EndDialog", "Return", ordering=order + 2)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
589 c = seldlg.cancel("Cancel", "Features")
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
590 c.event("SpawnDialog", "CancelDlg")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
591
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
592 c = seldlg.control("Features", "SelectionTree", 15, 60, 300, 120, 3,
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
593 "FEATURE", None, "PathEdit", None)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
594 c.event("[FEATURE_SELECTED]", "1")
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
595 ver = self.other_version
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
596 install_other_cond = "FEATURE_SELECTED AND &Python%s=3" % ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
597 dont_install_other_cond = "FEATURE_SELECTED AND &Python%s<>3" % ver
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
598
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
599 c = seldlg.text("Other", 15, 200, 300, 15, 3,
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
600 "Provide an alternate Python location")
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
601 c.condition("Enable", install_other_cond)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
602 c.condition("Show", install_other_cond)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
603 c.condition("Disable", dont_install_other_cond)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
604 c.condition("Hide", dont_install_other_cond)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
605
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
606 c = seldlg.control("PathEdit", "PathEdit", 15, 215, 300, 16, 1,
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
607 "TARGETDIR" + ver, None, "Next", None)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
608 c.condition("Enable", install_other_cond)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
609 c.condition("Show", install_other_cond)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
610 c.condition("Disable", dont_install_other_cond)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
611 c.condition("Hide", dont_install_other_cond)
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
612
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
613 #####################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
614 # Disk cost
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
615 cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
616 "OK", "OK", "OK", bitmap=False)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
617 cost.text("Title", 15, 6, 200, 15, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
618 "{\DlgFontBold8}Disk Space Requirements")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
619 cost.text("Description", 20, 20, 280, 20, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
620 "The disk space required for the installation of the selected features.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
621 cost.text("Text", 20, 53, 330, 60, 3,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
622 "The highlighted volumes (if any) do not have enough disk space "
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
623 "available for the currently selected features. You can either "
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
624 "remove some files from the highlighted volumes, or choose to "
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
625 "install less features onto local drive(s), or select different "
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
626 "destination drive(s).")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
627 cost.control("VolumeList", "VolumeCostList", 20, 100, 330, 150, 393223,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
628 None, "{120}{70}{70}{70}{70}", None, None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
629 cost.xbutton("OK", "Ok", None, 0.5).event("EndDialog", "Return")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
630
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
631 #####################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
632 # WhichUsers Dialog. Only available on NT, and for privileged users.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
633 # This must be run before FindRelatedProducts, because that will
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
634 # take into account whether the previous installation was per-user
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
635 # or per-machine. We currently don't support going back to this
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
636 # dialog after "Next" was selected; to support this, we would need to
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
637 # find how to reset the ALLUSERS property, and how to re-run
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
638 # FindRelatedProducts.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
639 # On Windows9x, the ALLUSERS property is ignored on the command line
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
640 # and in the Property table, but installer fails according to the documentation
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
641 # if a dialog attempts to set ALLUSERS.
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
642 whichusers = PyDialog(db, "WhichUsersDlg", x, y, w, h, modal, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
643 "AdminInstall", "Next", "Cancel")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
644 whichusers.title("Select whether to install [ProductName] for all users of this computer.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
645 # A radio group with two options: allusers, justme
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
646 g = whichusers.radiogroup("AdminInstall", 15, 60, 260, 50, 3,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
647 "WhichUsers", "", "Next")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
648 g.add("ALL", 0, 5, 150, 20, "Install for all users")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
649 g.add("JUSTME", 0, 25, 150, 20, "Install just for me")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
650
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
651 whichusers.back("Back", None, active=0)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
652
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
653 c = whichusers.next("Next >", "Cancel")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
654 c.event("[ALLUSERS]", "1", 'WhichUsers="ALL"', 1)
38072
ee98ecf05773 Rename parameters to match the documentation (which
Martin v. Löwis <martin@v.loewis.de>
parents: 36905
diff changeset
655 c.event("EndDialog", "Return", ordering = 2)
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
656
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
657 c = whichusers.cancel("Cancel", "AdminInstall")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
658 c.event("SpawnDialog", "CancelDlg")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
659
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
660 #####################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
661 # Installation Progress dialog (modeless)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
662 progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
663 "Cancel", "Cancel", "Cancel", bitmap=False)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
664 progress.text("Title", 20, 15, 200, 15, 0x30003,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
665 "{\DlgFontBold8}[Progress1] [ProductName]")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
666 progress.text("Text", 35, 65, 300, 30, 3,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
667 "Please wait while the Installer [Progress2] [ProductName]. "
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
668 "This may take several minutes.")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
669 progress.text("StatusLabel", 35, 100, 35, 20, 3, "Status:")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
670
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
671 c=progress.text("ActionText", 70, 100, w-70, 20, 3, "Pondering...")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
672 c.mapping("ActionText", "Text")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
673
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
674 #c=progress.text("ActionData", 35, 140, 300, 20, 3, None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
675 #c.mapping("ActionData", "Text")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
676
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
677 c=progress.control("ProgressBar", "ProgressBar", 35, 120, 300, 10, 65537,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
678 None, "Progress done", None, None)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
679 c.mapping("SetProgress", "Progress")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
680
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
681 progress.back("< Back", "Next", active=False)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
682 progress.next("Next >", "Cancel", active=False)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
683 progress.cancel("Cancel", "Back").event("SpawnDialog", "CancelDlg")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
684
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
685 ###################################################################
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
686 # Maintenance type: repair/uninstall
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
687 maint = PyDialog(db, "MaintenanceTypeDlg", x, y, w, h, modal, title,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
688 "Next", "Next", "Cancel")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
689 maint.title("Welcome to the [ProductName] Setup Wizard")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
690 maint.text("BodyText", 15, 63, 330, 42, 3,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
691 "Select whether you want to repair or remove [ProductName].")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
692 g=maint.radiogroup("RepairRadioGroup", 15, 108, 330, 60, 3,
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
693 "MaintenanceForm_Action", "", "Next")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
694 #g.add("Change", 0, 0, 200, 17, "&Change [ProductName]")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
695 g.add("Repair", 0, 18, 200, 17, "&Repair [ProductName]")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
696 g.add("Remove", 0, 36, 200, 17, "Re&move [ProductName]")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
697
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
698 maint.back("< Back", None, active=False)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
699 c=maint.next("Finish", "Cancel")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
700 # Change installation: Change progress dialog to "Change", then ask
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
701 # for feature selection
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
702 #c.event("[Progress1]", "Change", 'MaintenanceForm_Action="Change"', 1)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
703 #c.event("[Progress2]", "changes", 'MaintenanceForm_Action="Change"', 2)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
704
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
705 # Reinstall: Change progress dialog to "Repair", then invoke reinstall
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
706 # Also set list of reinstalled features to "ALL"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
707 c.event("[REINSTALL]", "ALL", 'MaintenanceForm_Action="Repair"', 5)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
708 c.event("[Progress1]", "Repairing", 'MaintenanceForm_Action="Repair"', 6)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
709 c.event("[Progress2]", "repairs", 'MaintenanceForm_Action="Repair"', 7)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
710 c.event("Reinstall", "ALL", 'MaintenanceForm_Action="Repair"', 8)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
711
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
712 # Uninstall: Change progress to "Remove", then invoke uninstall
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
713 # Also set list of removed features to "ALL"
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
714 c.event("[REMOVE]", "ALL", 'MaintenanceForm_Action="Remove"', 11)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
715 c.event("[Progress1]", "Removing", 'MaintenanceForm_Action="Remove"', 12)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
716 c.event("[Progress2]", "removes", 'MaintenanceForm_Action="Remove"', 13)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
717 c.event("Remove", "ALL", 'MaintenanceForm_Action="Remove"', 14)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
718
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
719 # Close dialog when maintenance action scheduled
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
720 c.event("EndDialog", "Return", 'MaintenanceForm_Action<>"Change"', 20)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
721 #c.event("NewDialog", "SelectFeaturesDlg", 'MaintenanceForm_Action="Change"', 21)
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
722
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
723 maint.cancel("Cancel", "RepairRadioGroup").event("SpawnDialog", "CancelDlg")
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
724
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
725 def get_installer_filename(self, fullname):
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
726 # Factored out to allow overriding in subclasses
53763
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
727 if self.target_version:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
728 base_name = "%s.%s-py%s.msi" % (fullname, self.plat_name,
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
729 self.target_version)
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
730 else:
2416f166de4b Update bdist_msi so that the generated MSIs for pure Python modules can install to any version of Python, like the generated EXEs from bdist_wininst. (Previously, you had to create a new MSI for each version of Python.)
Steven Bethard <steven.bethard@gmail.com>
parents: 46331
diff changeset
731 base_name = "%s.%s.msi" % (fullname, self.plat_name)
46331
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
732 installer_name = os.path.join(self.dist_dir, base_name)
36845
391f74c9c263 Import bdist_msi
Martin v. Löwis <martin@v.loewis.de>
parents:
diff changeset
733 return installer_name