Show More
@@ -1,336 +1,339 b'' | |||||
1 | # The following variables can be passed in as parameters: |
|
1 | # The following variables can be passed in as parameters: | |
2 | # |
|
2 | # | |
3 | # VERSION |
|
3 | # VERSION | |
4 | # Version string of program being produced. |
|
4 | # Version string of program being produced. | |
5 | # |
|
5 | # | |
6 | # MSI_NAME |
|
6 | # MSI_NAME | |
7 | # Root name of MSI installer. |
|
7 | # Root name of MSI installer. | |
8 | # |
|
8 | # | |
9 | # EXTRA_MSI_FEATURES |
|
9 | # EXTRA_MSI_FEATURES | |
10 | # ; delimited string of extra features to advertise in the built MSA. |
|
10 | # ; delimited string of extra features to advertise in the built MSA. | |
11 | # |
|
11 | # | |
12 | # SIGNING_PFX_PATH |
|
12 | # SIGNING_PFX_PATH | |
13 | # Path to code signing certificate to use. |
|
13 | # Path to code signing certificate to use. | |
14 | # |
|
14 | # | |
15 | # SIGNING_PFX_PASSWORD |
|
15 | # SIGNING_PFX_PASSWORD | |
16 | # Password to code signing PFX file defined by SIGNING_PFX_PATH. |
|
16 | # Password to code signing PFX file defined by SIGNING_PFX_PATH. | |
17 | # |
|
17 | # | |
18 | # SIGNING_SUBJECT_NAME |
|
18 | # SIGNING_SUBJECT_NAME | |
19 | # String fragment in code signing certificate subject name used to find |
|
19 | # String fragment in code signing certificate subject name used to find | |
20 | # code signing certificate in Windows certificate store. |
|
20 | # code signing certificate in Windows certificate store. | |
21 | # |
|
21 | # | |
22 | # TIME_STAMP_SERVER_URL |
|
22 | # TIME_STAMP_SERVER_URL | |
23 | # URL of time-stamp token authority (RFC 3161) servers to stamp code signatures. |
|
23 | # URL of time-stamp token authority (RFC 3161) servers to stamp code signatures. | |
24 |
|
24 | |||
25 | ROOT = CWD + "/../.." |
|
25 | ROOT = CWD + "/../.." | |
26 |
|
26 | |||
27 | VERSION = VARS.get("VERSION", "0.0") |
|
27 | VERSION = VARS.get("VERSION", "0.0") | |
28 | MSI_NAME = VARS.get("MSI_NAME", "mercurial") |
|
28 | MSI_NAME = VARS.get("MSI_NAME", "mercurial") | |
29 | EXTRA_MSI_FEATURES = VARS.get("EXTRA_MSI_FEATURES") |
|
29 | EXTRA_MSI_FEATURES = VARS.get("EXTRA_MSI_FEATURES") | |
30 | SIGNING_PFX_PATH = VARS.get("SIGNING_PFX_PATH") |
|
30 | SIGNING_PFX_PATH = VARS.get("SIGNING_PFX_PATH") | |
31 | SIGNING_PFX_PASSWORD = VARS.get("SIGNING_PFX_PASSWORD", "") |
|
31 | SIGNING_PFX_PASSWORD = VARS.get("SIGNING_PFX_PASSWORD", "") | |
32 | SIGNING_SUBJECT_NAME = VARS.get("SIGNING_SUBJECT_NAME") |
|
32 | SIGNING_SUBJECT_NAME = VARS.get("SIGNING_SUBJECT_NAME") | |
33 | TIME_STAMP_SERVER_URL = VARS.get("TIME_STAMP_SERVER_URL", "http://timestamp.digicert.com") |
|
33 | TIME_STAMP_SERVER_URL = VARS.get("TIME_STAMP_SERVER_URL", "http://timestamp.digicert.com") | |
34 |
|
34 | |||
35 | IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE |
|
35 | IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE | |
36 |
|
36 | |||
37 | USE_IN_MEMORY_RESOURCES = False |
|
37 | # Use in-memory resources for all resources. If false, most of the Python | |
|
38 | # stdlib will be in memory, but other things such as Mercurial itself will not | |||
|
39 | # be. See the comment in resource_callback, below. | |||
|
40 | USE_IN_MEMORY_RESOURCES = not IS_WINDOWS | |||
38 |
|
41 | |||
39 | # Code to run in Python interpreter. |
|
42 | # Code to run in Python interpreter. | |
40 | RUN_CODE = """ |
|
43 | RUN_CODE = """ | |
41 | import os |
|
44 | import os | |
42 | import sys |
|
45 | import sys | |
43 | extra_path = os.environ.get('PYTHONPATH') |
|
46 | extra_path = os.environ.get('PYTHONPATH') | |
44 | if extra_path is not None: |
|
47 | if extra_path is not None: | |
45 | # extensions and hooks expect a working python environment |
|
48 | # extensions and hooks expect a working python environment | |
46 | # We do not prepend the values because the Mercurial library wants to be in |
|
49 | # We do not prepend the values because the Mercurial library wants to be in | |
47 | # the front of the sys.path to avoid picking up other installations. |
|
50 | # the front of the sys.path to avoid picking up other installations. | |
48 | sys.path.extend(extra_path.split(os.pathsep)) |
|
51 | sys.path.extend(extra_path.split(os.pathsep)) | |
49 | # Add user site to sys.path to load extensions without the full path |
|
52 | # Add user site to sys.path to load extensions without the full path | |
50 | if os.name == 'nt': |
|
53 | if os.name == 'nt': | |
51 | vi = sys.version_info |
|
54 | vi = sys.version_info | |
52 | appdata = os.environ.get('APPDATA') |
|
55 | appdata = os.environ.get('APPDATA') | |
53 | if appdata: |
|
56 | if appdata: | |
54 | sys.path.append( |
|
57 | sys.path.append( | |
55 | os.path.join( |
|
58 | os.path.join( | |
56 | appdata, |
|
59 | appdata, | |
57 | 'Python', |
|
60 | 'Python', | |
58 | 'Python%d%d' % (vi[0], vi[1]), |
|
61 | 'Python%d%d' % (vi[0], vi[1]), | |
59 | 'site-packages', |
|
62 | 'site-packages', | |
60 | ) |
|
63 | ) | |
61 | ) |
|
64 | ) | |
62 | elif sys.platform == "darwin": |
|
65 | elif sys.platform == "darwin": | |
63 | vi = sys.version_info |
|
66 | vi = sys.version_info | |
64 |
|
67 | |||
65 | def joinuser(*args): |
|
68 | def joinuser(*args): | |
66 | return os.path.expanduser(os.path.join(*args)) |
|
69 | return os.path.expanduser(os.path.join(*args)) | |
67 |
|
70 | |||
68 | # Note: site.py uses `sys._framework` instead of hardcoding "Python" as the |
|
71 | # Note: site.py uses `sys._framework` instead of hardcoding "Python" as the | |
69 | # 3rd arg, but that is set to an empty string in an oxidized binary. It |
|
72 | # 3rd arg, but that is set to an empty string in an oxidized binary. It | |
70 | # has a fallback to ~/.local when `sys._framework` isn't set, but we want |
|
73 | # has a fallback to ~/.local when `sys._framework` isn't set, but we want | |
71 | # to match what the system python uses, so it sees pip installed stuff. |
|
74 | # to match what the system python uses, so it sees pip installed stuff. | |
72 | usersite = joinuser("~", "Library", "Python", |
|
75 | usersite = joinuser("~", "Library", "Python", | |
73 | "%d.%d" % vi[:2], "lib/python/site-packages") |
|
76 | "%d.%d" % vi[:2], "lib/python/site-packages") | |
74 |
|
77 | |||
75 | sys.path.append(usersite) |
|
78 | sys.path.append(usersite) | |
76 | import hgdemandimport; |
|
79 | import hgdemandimport; | |
77 | hgdemandimport.enable(); |
|
80 | hgdemandimport.enable(); | |
78 | from mercurial import dispatch; |
|
81 | from mercurial import dispatch; | |
79 | dispatch.run(); |
|
82 | dispatch.run(); | |
80 | """ |
|
83 | """ | |
81 |
|
84 | |||
82 | set_build_path(ROOT + "/build/pyoxidizer") |
|
85 | set_build_path(ROOT + "/build/pyoxidizer") | |
83 |
|
86 | |||
84 | def make_distribution(): |
|
87 | def make_distribution(): | |
85 | return default_python_distribution(python_version = "3.9") |
|
88 | return default_python_distribution(python_version = "3.9") | |
86 |
|
89 | |||
87 | def resource_callback(policy, resource): |
|
90 | def resource_callback(policy, resource): | |
88 | if USE_IN_MEMORY_RESOURCES: |
|
91 | if USE_IN_MEMORY_RESOURCES: | |
89 | resource.add_location = "in-memory" |
|
92 | resource.add_location = "in-memory" | |
90 | return |
|
93 | return | |
91 |
|
94 | |||
92 | # We use a custom resource routing policy to influence where things are loaded |
|
95 | # We use a custom resource routing policy to influence where things are loaded | |
93 | # from. |
|
96 | # from. | |
94 | # |
|
97 | # | |
95 | # For Python modules and resources, we load from memory if they are in |
|
98 | # For Python modules and resources, we load from memory if they are in | |
96 | # the standard library and from the filesystem if not. This is because |
|
99 | # the standard library and from the filesystem if not. This is because | |
97 | # parts of Mercurial and some 3rd party packages aren't yet compatible |
|
100 | # parts of Mercurial and some 3rd party packages aren't yet compatible | |
98 | # with memory loading. |
|
101 | # with memory loading. | |
99 | # |
|
102 | # | |
100 | # For Python extension modules, we load from the filesystem because |
|
103 | # For Python extension modules, we load from the filesystem because | |
101 | # this yields greatest compatibility. |
|
104 | # this yields greatest compatibility. | |
102 | if type(resource) in ("PythonModuleSource", "PythonPackageResource", "PythonPackageDistributionResource"): |
|
105 | if type(resource) in ("PythonModuleSource", "PythonPackageResource", "PythonPackageDistributionResource"): | |
103 | if resource.is_stdlib: |
|
106 | if resource.is_stdlib: | |
104 | resource.add_location = "in-memory" |
|
107 | resource.add_location = "in-memory" | |
105 | else: |
|
108 | else: | |
106 | resource.add_location = "filesystem-relative:lib" |
|
109 | resource.add_location = "filesystem-relative:lib" | |
107 |
|
110 | |||
108 | elif type(resource) == "PythonExtensionModule": |
|
111 | elif type(resource) == "PythonExtensionModule": | |
109 | resource.add_location = "filesystem-relative:lib" |
|
112 | resource.add_location = "filesystem-relative:lib" | |
110 |
|
113 | |||
111 | def make_exe(dist): |
|
114 | def make_exe(dist): | |
112 | """Builds a Rust-wrapped Mercurial binary.""" |
|
115 | """Builds a Rust-wrapped Mercurial binary.""" | |
113 | packaging_policy = dist.make_python_packaging_policy() |
|
116 | packaging_policy = dist.make_python_packaging_policy() | |
114 |
|
117 | |||
115 | # Extension may depend on any Python functionality. Include all |
|
118 | # Extension may depend on any Python functionality. Include all | |
116 | # extensions. |
|
119 | # extensions. | |
117 | packaging_policy.extension_module_filter = "all" |
|
120 | packaging_policy.extension_module_filter = "all" | |
118 | packaging_policy.resources_location = "in-memory" |
|
121 | packaging_policy.resources_location = "in-memory" | |
119 | if not USE_IN_MEMORY_RESOURCES: |
|
122 | if not USE_IN_MEMORY_RESOURCES: | |
120 | packaging_policy.resources_location_fallback = "filesystem-relative:lib" |
|
123 | packaging_policy.resources_location_fallback = "filesystem-relative:lib" | |
121 | packaging_policy.register_resource_callback(resource_callback) |
|
124 | packaging_policy.register_resource_callback(resource_callback) | |
122 |
|
125 | |||
123 | config = dist.make_python_interpreter_config() |
|
126 | config = dist.make_python_interpreter_config() | |
124 | config.allocator_backend = "default" |
|
127 | config.allocator_backend = "default" | |
125 | config.run_command = RUN_CODE |
|
128 | config.run_command = RUN_CODE | |
126 |
|
129 | |||
127 | # We want to let the user load extensions from the file system |
|
130 | # We want to let the user load extensions from the file system | |
128 | config.filesystem_importer = True |
|
131 | config.filesystem_importer = True | |
129 |
|
132 | |||
130 | # We need this to make resourceutil happy, since it looks for sys.frozen. |
|
133 | # We need this to make resourceutil happy, since it looks for sys.frozen. | |
131 | config.sys_frozen = True |
|
134 | config.sys_frozen = True | |
132 | config.legacy_windows_stdio = True |
|
135 | config.legacy_windows_stdio = True | |
133 |
|
136 | |||
134 | exe = dist.to_python_executable( |
|
137 | exe = dist.to_python_executable( | |
135 | name = "hg", |
|
138 | name = "hg", | |
136 | packaging_policy = packaging_policy, |
|
139 | packaging_policy = packaging_policy, | |
137 | config = config, |
|
140 | config = config, | |
138 | ) |
|
141 | ) | |
139 |
|
142 | |||
140 | # Add Mercurial to resources. |
|
143 | # Add Mercurial to resources. | |
141 | exe.add_python_resources(exe.pip_install(["--verbose", "--no-use-pep517", ROOT])) |
|
144 | exe.add_python_resources(exe.pip_install(["--verbose", "--no-use-pep517", ROOT])) | |
142 |
|
145 | |||
143 | # On Windows, we install extra packages for convenience. |
|
146 | # On Windows, we install extra packages for convenience. | |
144 | if IS_WINDOWS: |
|
147 | if IS_WINDOWS: | |
145 | exe.add_python_resources( |
|
148 | exe.add_python_resources( | |
146 | exe.pip_install(["-r", ROOT + "/contrib/packaging/requirements-windows-py3.txt"]), |
|
149 | exe.pip_install(["-r", ROOT + "/contrib/packaging/requirements-windows-py3.txt"]), | |
147 | ) |
|
150 | ) | |
148 | extra_packages = VARS.get("extra_py_packages", "") |
|
151 | extra_packages = VARS.get("extra_py_packages", "") | |
149 | if extra_packages: |
|
152 | if extra_packages: | |
150 | for extra in extra_packages.split(","): |
|
153 | for extra in extra_packages.split(","): | |
151 | extra_src, pkgs = extra.split("=") |
|
154 | extra_src, pkgs = extra.split("=") | |
152 | pkgs = pkgs.split(":") |
|
155 | pkgs = pkgs.split(":") | |
153 | exe.add_python_resources(exe.read_package_root(extra_src, pkgs)) |
|
156 | exe.add_python_resources(exe.read_package_root(extra_src, pkgs)) | |
154 |
|
157 | |||
155 | return exe |
|
158 | return exe | |
156 |
|
159 | |||
157 | def make_manifest(dist, exe): |
|
160 | def make_manifest(dist, exe): | |
158 | m = FileManifest() |
|
161 | m = FileManifest() | |
159 | m.add_python_resource(".", exe) |
|
162 | m.add_python_resource(".", exe) | |
160 |
|
163 | |||
161 | return m |
|
164 | return m | |
162 |
|
165 | |||
163 |
|
166 | |||
164 | # This adjusts the InstallManifest produced from exe generation to provide |
|
167 | # This adjusts the InstallManifest produced from exe generation to provide | |
165 | # additional files found in a Windows install layout. |
|
168 | # additional files found in a Windows install layout. | |
166 | def make_windows_install_layout(manifest): |
|
169 | def make_windows_install_layout(manifest): | |
167 | # Copy various files to new install locations. This can go away once |
|
170 | # Copy various files to new install locations. This can go away once | |
168 | # we're using the importlib resource reader. |
|
171 | # we're using the importlib resource reader. | |
169 | RECURSIVE_COPIES = { |
|
172 | RECURSIVE_COPIES = { | |
170 | "lib/mercurial/locale/": "locale/", |
|
173 | "lib/mercurial/locale/": "locale/", | |
171 | "lib/mercurial/templates/": "templates/", |
|
174 | "lib/mercurial/templates/": "templates/", | |
172 | } |
|
175 | } | |
173 | for (search, replace) in RECURSIVE_COPIES.items(): |
|
176 | for (search, replace) in RECURSIVE_COPIES.items(): | |
174 | for path in manifest.paths(): |
|
177 | for path in manifest.paths(): | |
175 | if path.startswith(search): |
|
178 | if path.startswith(search): | |
176 | new_path = path.replace(search, replace) |
|
179 | new_path = path.replace(search, replace) | |
177 | print("copy %s to %s" % (path, new_path)) |
|
180 | print("copy %s to %s" % (path, new_path)) | |
178 | file = manifest.get_file(path) |
|
181 | file = manifest.get_file(path) | |
179 | manifest.add_file(file, path = new_path) |
|
182 | manifest.add_file(file, path = new_path) | |
180 |
|
183 | |||
181 | # Similar to above, but with filename pattern matching. |
|
184 | # Similar to above, but with filename pattern matching. | |
182 | # lib/mercurial/helptext/**/*.txt -> helptext/ |
|
185 | # lib/mercurial/helptext/**/*.txt -> helptext/ | |
183 | # lib/mercurial/defaultrc/*.rc -> defaultrc/ |
|
186 | # lib/mercurial/defaultrc/*.rc -> defaultrc/ | |
184 | for path in manifest.paths(): |
|
187 | for path in manifest.paths(): | |
185 | if path.startswith("lib/mercurial/helptext/") and path.endswith(".txt"): |
|
188 | if path.startswith("lib/mercurial/helptext/") and path.endswith(".txt"): | |
186 | new_path = path[len("lib/mercurial/"):] |
|
189 | new_path = path[len("lib/mercurial/"):] | |
187 | elif path.startswith("lib/mercurial/defaultrc/") and path.endswith(".rc"): |
|
190 | elif path.startswith("lib/mercurial/defaultrc/") and path.endswith(".rc"): | |
188 | new_path = path[len("lib/mercurial/"):] |
|
191 | new_path = path[len("lib/mercurial/"):] | |
189 | else: |
|
192 | else: | |
190 | continue |
|
193 | continue | |
191 |
|
194 | |||
192 | print("copying %s to %s" % (path, new_path)) |
|
195 | print("copying %s to %s" % (path, new_path)) | |
193 | manifest.add_file(manifest.get_file(path), path = new_path) |
|
196 | manifest.add_file(manifest.get_file(path), path = new_path) | |
194 |
|
197 | |||
195 | extra_install_files = VARS.get("extra_install_files", "") |
|
198 | extra_install_files = VARS.get("extra_install_files", "") | |
196 | if extra_install_files: |
|
199 | if extra_install_files: | |
197 | for extra in extra_install_files.split(","): |
|
200 | for extra in extra_install_files.split(","): | |
198 | print("adding extra files from %s" % extra) |
|
201 | print("adding extra files from %s" % extra) | |
199 | # TODO: I expected a ** glob to work, but it didn't. |
|
202 | # TODO: I expected a ** glob to work, but it didn't. | |
200 | # |
|
203 | # | |
201 | # TODO: I know this has forward-slash paths. As far as I can tell, |
|
204 | # TODO: I know this has forward-slash paths. As far as I can tell, | |
202 | # backslashes don't ever match glob() expansions in |
|
205 | # backslashes don't ever match glob() expansions in | |
203 | # tugger-starlark, even on Windows. |
|
206 | # tugger-starlark, even on Windows. | |
204 | manifest.add_manifest(glob(include=[extra + "/*/*"], strip_prefix=extra+"/")) |
|
207 | manifest.add_manifest(glob(include=[extra + "/*/*"], strip_prefix=extra+"/")) | |
205 |
|
208 | |||
206 | # We also install a handful of additional files. |
|
209 | # We also install a handful of additional files. | |
207 | EXTRA_CONTRIB_FILES = [ |
|
210 | EXTRA_CONTRIB_FILES = [ | |
208 | "bash_completion", |
|
211 | "bash_completion", | |
209 | "hgweb.fcgi", |
|
212 | "hgweb.fcgi", | |
210 | "hgweb.wsgi", |
|
213 | "hgweb.wsgi", | |
211 | "logo-droplets.svg", |
|
214 | "logo-droplets.svg", | |
212 | "mercurial.el", |
|
215 | "mercurial.el", | |
213 | "mq.el", |
|
216 | "mq.el", | |
214 | "tcsh_completion", |
|
217 | "tcsh_completion", | |
215 | "tcsh_completion_build.sh", |
|
218 | "tcsh_completion_build.sh", | |
216 | "xml.rnc", |
|
219 | "xml.rnc", | |
217 | "zsh_completion", |
|
220 | "zsh_completion", | |
218 | ] |
|
221 | ] | |
219 |
|
222 | |||
220 | for f in EXTRA_CONTRIB_FILES: |
|
223 | for f in EXTRA_CONTRIB_FILES: | |
221 | manifest.add_file(FileContent(path = ROOT + "/contrib/" + f), directory = "contrib") |
|
224 | manifest.add_file(FileContent(path = ROOT + "/contrib/" + f), directory = "contrib") | |
222 |
|
225 | |||
223 | # Individual files with full source to destination path mapping. |
|
226 | # Individual files with full source to destination path mapping. | |
224 | EXTRA_FILES = { |
|
227 | EXTRA_FILES = { | |
225 | "contrib/hgk": "contrib/hgk.tcl", |
|
228 | "contrib/hgk": "contrib/hgk.tcl", | |
226 | "contrib/win32/postinstall.txt": "ReleaseNotes.txt", |
|
229 | "contrib/win32/postinstall.txt": "ReleaseNotes.txt", | |
227 | "contrib/win32/ReadMe.html": "ReadMe.html", |
|
230 | "contrib/win32/ReadMe.html": "ReadMe.html", | |
228 | "doc/style.css": "doc/style.css", |
|
231 | "doc/style.css": "doc/style.css", | |
229 | "COPYING": "Copying.txt", |
|
232 | "COPYING": "Copying.txt", | |
230 | } |
|
233 | } | |
231 |
|
234 | |||
232 | for source, dest in EXTRA_FILES.items(): |
|
235 | for source, dest in EXTRA_FILES.items(): | |
233 | print("adding extra file %s" % dest) |
|
236 | print("adding extra file %s" % dest) | |
234 | manifest.add_file(FileContent(path = ROOT + "/" + source), path = dest) |
|
237 | manifest.add_file(FileContent(path = ROOT + "/" + source), path = dest) | |
235 |
|
238 | |||
236 | # And finally some wildcard matches. |
|
239 | # And finally some wildcard matches. | |
237 | manifest.add_manifest(glob( |
|
240 | manifest.add_manifest(glob( | |
238 | include = [ROOT + "/contrib/vim/*"], |
|
241 | include = [ROOT + "/contrib/vim/*"], | |
239 | strip_prefix = ROOT + "/" |
|
242 | strip_prefix = ROOT + "/" | |
240 | )) |
|
243 | )) | |
241 | manifest.add_manifest(glob( |
|
244 | manifest.add_manifest(glob( | |
242 | include = [ROOT + "/doc/*.html"], |
|
245 | include = [ROOT + "/doc/*.html"], | |
243 | strip_prefix = ROOT + "/" |
|
246 | strip_prefix = ROOT + "/" | |
244 | )) |
|
247 | )) | |
245 |
|
248 | |||
246 | # But we don't ship hg-ssh on Windows, so exclude its documentation. |
|
249 | # But we don't ship hg-ssh on Windows, so exclude its documentation. | |
247 | manifest.remove("doc/hg-ssh.8.html") |
|
250 | manifest.remove("doc/hg-ssh.8.html") | |
248 |
|
251 | |||
249 | return manifest |
|
252 | return manifest | |
250 |
|
253 | |||
251 |
|
254 | |||
252 | def make_msi(manifest): |
|
255 | def make_msi(manifest): | |
253 | manifest = make_windows_install_layout(manifest) |
|
256 | manifest = make_windows_install_layout(manifest) | |
254 |
|
257 | |||
255 | if "x86_64" in BUILD_TARGET_TRIPLE: |
|
258 | if "x86_64" in BUILD_TARGET_TRIPLE: | |
256 | platform = "x64" |
|
259 | platform = "x64" | |
257 | else: |
|
260 | else: | |
258 | platform = "x86" |
|
261 | platform = "x86" | |
259 |
|
262 | |||
260 | manifest.add_file( |
|
263 | manifest.add_file( | |
261 | FileContent(path = ROOT + "/contrib/packaging/wix/COPYING.rtf"), |
|
264 | FileContent(path = ROOT + "/contrib/packaging/wix/COPYING.rtf"), | |
262 | path = "COPYING.rtf", |
|
265 | path = "COPYING.rtf", | |
263 | ) |
|
266 | ) | |
264 | manifest.remove("Copying.txt") |
|
267 | manifest.remove("Copying.txt") | |
265 | manifest.add_file( |
|
268 | manifest.add_file( | |
266 | FileContent(path = ROOT + "/contrib/win32/mercurial.ini"), |
|
269 | FileContent(path = ROOT + "/contrib/win32/mercurial.ini"), | |
267 | path = "defaultrc/mercurial.rc", |
|
270 | path = "defaultrc/mercurial.rc", | |
268 | ) |
|
271 | ) | |
269 | manifest.add_file( |
|
272 | manifest.add_file( | |
270 | FileContent(filename = "editor.rc", content = "[ui]\neditor = notepad\n"), |
|
273 | FileContent(filename = "editor.rc", content = "[ui]\neditor = notepad\n"), | |
271 | path = "defaultrc/editor.rc", |
|
274 | path = "defaultrc/editor.rc", | |
272 | ) |
|
275 | ) | |
273 |
|
276 | |||
274 | wix = WiXInstaller( |
|
277 | wix = WiXInstaller( | |
275 | "hg", |
|
278 | "hg", | |
276 | "%s-%s-%s.msi" % (MSI_NAME, VERSION, platform), |
|
279 | "%s-%s-%s.msi" % (MSI_NAME, VERSION, platform), | |
277 | arch = platform, |
|
280 | arch = platform, | |
278 | ) |
|
281 | ) | |
279 |
|
282 | |||
280 | # Materialize files in the manifest to the install layout. |
|
283 | # Materialize files in the manifest to the install layout. | |
281 | wix.add_install_files(manifest) |
|
284 | wix.add_install_files(manifest) | |
282 |
|
285 | |||
283 | # From mercurial.wxs. |
|
286 | # From mercurial.wxs. | |
284 | wix.install_files_root_directory_id = "INSTALLDIR" |
|
287 | wix.install_files_root_directory_id = "INSTALLDIR" | |
285 |
|
288 | |||
286 | # Pull in our custom .wxs files. |
|
289 | # Pull in our custom .wxs files. | |
287 | defines = { |
|
290 | defines = { | |
288 | "PyOxidizer": "1", |
|
291 | "PyOxidizer": "1", | |
289 | "Platform": platform, |
|
292 | "Platform": platform, | |
290 | "Version": VERSION, |
|
293 | "Version": VERSION, | |
291 | "Comments": "Installs Mercurial version %s" % VERSION, |
|
294 | "Comments": "Installs Mercurial version %s" % VERSION, | |
292 | "PythonVersion": "3", |
|
295 | "PythonVersion": "3", | |
293 | "MercurialHasLib": "1", |
|
296 | "MercurialHasLib": "1", | |
294 | } |
|
297 | } | |
295 |
|
298 | |||
296 | if EXTRA_MSI_FEATURES: |
|
299 | if EXTRA_MSI_FEATURES: | |
297 | defines["MercurialExtraFeatures"] = EXTRA_MSI_FEATURES |
|
300 | defines["MercurialExtraFeatures"] = EXTRA_MSI_FEATURES | |
298 |
|
301 | |||
299 | wix.add_wxs_file( |
|
302 | wix.add_wxs_file( | |
300 | ROOT + "/contrib/packaging/wix/mercurial.wxs", |
|
303 | ROOT + "/contrib/packaging/wix/mercurial.wxs", | |
301 | preprocessor_parameters=defines, |
|
304 | preprocessor_parameters=defines, | |
302 | ) |
|
305 | ) | |
303 |
|
306 | |||
304 | # Our .wxs references to other files. Pull those into the build environment. |
|
307 | # Our .wxs references to other files. Pull those into the build environment. | |
305 | for f in ("defines.wxi", "guids.wxi", "COPYING.rtf"): |
|
308 | for f in ("defines.wxi", "guids.wxi", "COPYING.rtf"): | |
306 | wix.add_build_file(f, ROOT + "/contrib/packaging/wix/" + f) |
|
309 | wix.add_build_file(f, ROOT + "/contrib/packaging/wix/" + f) | |
307 |
|
310 | |||
308 | wix.add_build_file("mercurial.ico", ROOT + "/contrib/win32/mercurial.ico") |
|
311 | wix.add_build_file("mercurial.ico", ROOT + "/contrib/win32/mercurial.ico") | |
309 |
|
312 | |||
310 | return wix |
|
313 | return wix | |
311 |
|
314 | |||
312 |
|
315 | |||
313 | def register_code_signers(): |
|
316 | def register_code_signers(): | |
314 | if not IS_WINDOWS: |
|
317 | if not IS_WINDOWS: | |
315 | return |
|
318 | return | |
316 |
|
319 | |||
317 | if SIGNING_PFX_PATH: |
|
320 | if SIGNING_PFX_PATH: | |
318 | signer = code_signer_from_pfx_file(SIGNING_PFX_PATH, SIGNING_PFX_PASSWORD) |
|
321 | signer = code_signer_from_pfx_file(SIGNING_PFX_PATH, SIGNING_PFX_PASSWORD) | |
319 | elif SIGNING_SUBJECT_NAME: |
|
322 | elif SIGNING_SUBJECT_NAME: | |
320 | signer = code_signer_from_windows_store_subject(SIGNING_SUBJECT_NAME) |
|
323 | signer = code_signer_from_windows_store_subject(SIGNING_SUBJECT_NAME) | |
321 | else: |
|
324 | else: | |
322 | signer = None |
|
325 | signer = None | |
323 |
|
326 | |||
324 | if signer: |
|
327 | if signer: | |
325 | signer.set_time_stamp_server(TIME_STAMP_SERVER_URL) |
|
328 | signer.set_time_stamp_server(TIME_STAMP_SERVER_URL) | |
326 | signer.activate() |
|
329 | signer.activate() | |
327 |
|
330 | |||
328 |
|
331 | |||
329 | register_code_signers() |
|
332 | register_code_signers() | |
330 |
|
333 | |||
331 | register_target("distribution", make_distribution) |
|
334 | register_target("distribution", make_distribution) | |
332 | register_target("exe", make_exe, depends = ["distribution"]) |
|
335 | register_target("exe", make_exe, depends = ["distribution"]) | |
333 | register_target("app", make_manifest, depends = ["distribution", "exe"], default = True) |
|
336 | register_target("app", make_manifest, depends = ["distribution", "exe"], default = True) | |
334 | register_target("msi", make_msi, depends = ["app"]) |
|
337 | register_target("msi", make_msi, depends = ["app"]) | |
335 |
|
338 | |||
336 | resolve_targets() |
|
339 | resolve_targets() |
General Comments 0
You need to be logged in to leave comments.
Login now