Mercurial > hg
annotate rust/hgcli/pyoxidizer.bzl @ 47848:5f2b0d34f24d stable
pyoxidizer: wrap the pyoxidizer script on multiple line
This is clearer and will help with future edition of the script.
Differential Revision: https://phab.mercurial-scm.org/D11300
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 18 Aug 2021 16:02:46 +0200 |
parents | 11f834e7177d |
children | b962a913ee3b |
rev | line source |
---|---|
47205
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
1 # The following variables can be passed in as parameters: |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
2 # |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
3 # VERSION |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
4 # Version string of program being produced. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
5 # |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
6 # MSI_NAME |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
7 # Root name of MSI installer. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
8 # |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
9 # EXTRA_MSI_FEATURES |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
10 # ; delimited string of extra features to advertise in the built MSA. |
47206
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
11 # |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
12 # SIGNING_PFX_PATH |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
13 # Path to code signing certificate to use. |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
14 # |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
15 # SIGNING_PFX_PASSWORD |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
16 # Password to code signing PFX file defined by SIGNING_PFX_PATH. |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
17 # |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
18 # SIGNING_SUBJECT_NAME |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
19 # String fragment in code signing certificate subject name used to find |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
20 # code signing certificate in Windows certificate store. |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
21 # |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
22 # TIME_STAMP_SERVER_URL |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
23 # URL of time-stamp token authority (RFC 3161) servers to stamp code signatures. |
47205
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
24 |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44638
diff
changeset
|
25 ROOT = CWD + "/../.." |
44638
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
26 |
47205
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
27 VERSION = VARS.get("VERSION", "5.8") |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
28 MSI_NAME = VARS.get("MSI_NAME", "mercurial") |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
29 EXTRA_MSI_FEATURES = VARS.get("EXTRA_MSI_FEATURES") |
47206
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
30 SIGNING_PFX_PATH = VARS.get("SIGNING_PFX_PATH") |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
31 SIGNING_PFX_PASSWORD = VARS.get("SIGNING_PFX_PASSWORD", "") |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
32 SIGNING_SUBJECT_NAME = VARS.get("SIGNING_SUBJECT_NAME") |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
33 TIME_STAMP_SERVER_URL = VARS.get("TIME_STAMP_SERVER_URL", "http://timestamp.digicert.com") |
47205
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
34 |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
35 IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
36 |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
37 # Code to run in Python interpreter. |
47848
5f2b0d34f24d
pyoxidizer: wrap the pyoxidizer script on multiple line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47643
diff
changeset
|
38 RUN_CODE = """ |
5f2b0d34f24d
pyoxidizer: wrap the pyoxidizer script on multiple line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47643
diff
changeset
|
39 import hgdemandimport; |
5f2b0d34f24d
pyoxidizer: wrap the pyoxidizer script on multiple line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47643
diff
changeset
|
40 hgdemandimport.enable(); |
5f2b0d34f24d
pyoxidizer: wrap the pyoxidizer script on multiple line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47643
diff
changeset
|
41 from mercurial import dispatch; |
5f2b0d34f24d
pyoxidizer: wrap the pyoxidizer script on multiple line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47643
diff
changeset
|
42 dispatch.run(); |
5f2b0d34f24d
pyoxidizer: wrap the pyoxidizer script on multiple line
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47643
diff
changeset
|
43 """ |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
44 |
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
45 set_build_path(ROOT + "/build/pyoxidizer") |
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
46 |
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
47 def make_distribution(): |
47211
159d2de3286c
pyoxidizer: use Python 3.9 (BC)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47206
diff
changeset
|
48 return default_python_distribution(python_version = "3.9") |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
49 |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
50 def resource_callback(policy, resource): |
45831
f14c33b2e497
pyoxidizer: default to one-file binary on non-Windows platforms
Augie Fackler <augie@google.com>
parents:
45752
diff
changeset
|
51 if not IS_WINDOWS: |
f14c33b2e497
pyoxidizer: default to one-file binary on non-Windows platforms
Augie Fackler <augie@google.com>
parents:
45752
diff
changeset
|
52 resource.add_location = "in-memory" |
f14c33b2e497
pyoxidizer: default to one-file binary on non-Windows platforms
Augie Fackler <augie@google.com>
parents:
45752
diff
changeset
|
53 return |
45879
5d73d3053d92
pyoxidizer: run buildifier
Augie Fackler <augie@google.com>
parents:
45832
diff
changeset
|
54 |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
55 # We use a custom resource routing policy to influence where things are loaded |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
56 # from. |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
57 # |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
58 # For Python modules and resources, we load from memory if they are in |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
59 # the standard library and from the filesystem if not. This is because |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
60 # parts of Mercurial and some 3rd party packages aren't yet compatible |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
61 # with memory loading. |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
62 # |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
63 # For Python extension modules, we load from the filesystem because |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
64 # this yields greatest compatibility. |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
65 if type(resource) in ("PythonModuleSource", "PythonPackageResource", "PythonPackageDistributionResource"): |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
66 if resource.is_stdlib: |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
67 resource.add_location = "in-memory" |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
68 else: |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
69 resource.add_location = "filesystem-relative:lib" |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
70 |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
71 elif type(resource) == "PythonExtensionModule": |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
72 resource.add_location = "filesystem-relative:lib" |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
73 |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
74 def make_exe(dist): |
44822
118f067f6bd1
pyoxidizer: formatting bazel definitions
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
44763
diff
changeset
|
75 """Builds a Rust-wrapped Mercurial binary.""" |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
76 packaging_policy = dist.make_python_packaging_policy() |
45879
5d73d3053d92
pyoxidizer: run buildifier
Augie Fackler <augie@google.com>
parents:
45832
diff
changeset
|
77 |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
78 # Extension may depend on any Python functionality. Include all |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
79 # extensions. |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
80 packaging_policy.extension_module_filter = "all" |
45749
f95b16796688
pyoxidizer: update to PyOxidizer 0.9
Gregory Szorc <gregory.szorc@gmail.com>
parents:
45685
diff
changeset
|
81 packaging_policy.resources_location = "in-memory" |
45831
f14c33b2e497
pyoxidizer: default to one-file binary on non-Windows platforms
Augie Fackler <augie@google.com>
parents:
45752
diff
changeset
|
82 if IS_WINDOWS: |
f14c33b2e497
pyoxidizer: default to one-file binary on non-Windows platforms
Augie Fackler <augie@google.com>
parents:
45752
diff
changeset
|
83 packaging_policy.resources_location_fallback = "filesystem-relative:lib" |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
84 packaging_policy.register_resource_callback(resource_callback) |
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
85 |
45749
f95b16796688
pyoxidizer: update to PyOxidizer 0.9
Gregory Szorc <gregory.szorc@gmail.com>
parents:
45685
diff
changeset
|
86 config = dist.make_python_interpreter_config() |
47204
3380848c6e04
pyoxidizer: use allocator_backend instead of raw_allocator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47203
diff
changeset
|
87 config.allocator_backend = "default" |
45832
867385f45559
pyoxidizer: switch to modern config using run_command instead of run_mode
Augie Fackler <augie@google.com>
parents:
45831
diff
changeset
|
88 config.run_command = RUN_CODE |
45879
5d73d3053d92
pyoxidizer: run buildifier
Augie Fackler <augie@google.com>
parents:
45832
diff
changeset
|
89 |
45749
f95b16796688
pyoxidizer: update to PyOxidizer 0.9
Gregory Szorc <gregory.szorc@gmail.com>
parents:
45685
diff
changeset
|
90 # We want to let the user load extensions from the file system |
f95b16796688
pyoxidizer: update to PyOxidizer 0.9
Gregory Szorc <gregory.szorc@gmail.com>
parents:
45685
diff
changeset
|
91 config.filesystem_importer = True |
45879
5d73d3053d92
pyoxidizer: run buildifier
Augie Fackler <augie@google.com>
parents:
45832
diff
changeset
|
92 |
45749
f95b16796688
pyoxidizer: update to PyOxidizer 0.9
Gregory Szorc <gregory.szorc@gmail.com>
parents:
45685
diff
changeset
|
93 # We need this to make resourceutil happy, since it looks for sys.frozen. |
f95b16796688
pyoxidizer: update to PyOxidizer 0.9
Gregory Szorc <gregory.szorc@gmail.com>
parents:
45685
diff
changeset
|
94 config.sys_frozen = True |
f95b16796688
pyoxidizer: update to PyOxidizer 0.9
Gregory Szorc <gregory.szorc@gmail.com>
parents:
45685
diff
changeset
|
95 config.legacy_windows_stdio = True |
44638
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
96 |
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
97 exe = dist.to_python_executable( |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44638
diff
changeset
|
98 name = "hg", |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
99 packaging_policy = packaging_policy, |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44638
diff
changeset
|
100 config = config, |
44638
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
101 ) |
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
102 |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
103 # Add Mercurial to resources. |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
104 exe.add_python_resources(exe.pip_install(["--verbose", ROOT])) |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
105 |
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
106 # On Windows, we install extra packages for convenience. |
45685
57b5452a55d5
pyoxidizer: produce working Python 3 Windows installers (issue6366)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44822
diff
changeset
|
107 if IS_WINDOWS: |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
108 exe.add_python_resources( |
46022
cd7f36337741
pyoxidizer: point to the py3 requirements instead of py2 on Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
45752
diff
changeset
|
109 exe.pip_install(["-r", ROOT + "/contrib/packaging/requirements-windows-py3.txt"]), |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
110 ) |
47643
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
111 extra_packages = VARS.get("extra_py_packages", "") |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
112 if extra_packages: |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
113 for extra in extra_packages.split(","): |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
114 extra_src, pkgs = extra.split("=") |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
115 pkgs = pkgs.split(":") |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
116 exe.add_python_resources(exe.read_package_root(extra_src, pkgs)) |
44638
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
117 |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44638
diff
changeset
|
118 return exe |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44638
diff
changeset
|
119 |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
120 def make_manifest(dist, exe): |
44639
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44638
diff
changeset
|
121 m = FileManifest() |
bc847878f4c0
hgcli: customize for Mercurial
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44638
diff
changeset
|
122 m.add_python_resource(".", exe) |
44638
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
123 |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
124 return m |
44638
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
125 |
47205
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
126 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
127 # This adjusts the InstallManifest produced from exe generation to provide |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
128 # additional files found in a Windows install layout. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
129 def make_windows_install_layout(manifest): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
130 # Copy various files to new install locations. This can go away once |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
131 # we're using the importlib resource reader. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
132 RECURSIVE_COPIES = { |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
133 "lib/mercurial/locale/": "locale/", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
134 "lib/mercurial/templates/": "templates/", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
135 } |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
136 for (search, replace) in RECURSIVE_COPIES.items(): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
137 for path in manifest.paths(): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
138 if path.startswith(search): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
139 new_path = path.replace(search, replace) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
140 print("copy %s to %s" % (path, new_path)) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
141 file = manifest.get_file(path) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
142 manifest.add_file(file, path = new_path) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
143 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
144 # Similar to above, but with filename pattern matching. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
145 # lib/mercurial/helptext/**/*.txt -> helptext/ |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
146 # lib/mercurial/defaultrc/*.rc -> defaultrc/ |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
147 for path in manifest.paths(): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
148 if path.startswith("lib/mercurial/helptext/") and path.endswith(".txt"): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
149 new_path = path[len("lib/mercurial/"):] |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
150 elif path.startswith("lib/mercurial/defaultrc/") and path.endswith(".rc"): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
151 new_path = path[len("lib/mercurial/"):] |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
152 else: |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
153 continue |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
154 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
155 print("copying %s to %s" % (path, new_path)) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
156 manifest.add_file(manifest.get_file(path), path = new_path) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
157 |
47643
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
158 extra_install_files = VARS.get("extra_install_files", "") |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
159 if extra_install_files: |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
160 for extra in extra_install_files.split(","): |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
161 print("adding extra files from %s" % extra) |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
162 # TODO: I expected a ** glob to work, but it didn't. |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
163 # |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
164 # TODO: I know this has forward-slash paths. As far as I can tell, |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
165 # backslashes don't ever match glob() expansions in |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
166 # tugger-starlark, even on Windows. |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
167 manifest.add_manifest(glob(include=[extra + "/*/*"], strip_prefix=extra+"/")) |
11f834e7177d
pyoxidizer: add hooks to inject extra python packages and install files
Augie Fackler <augie@google.com>
parents:
47211
diff
changeset
|
168 |
47205
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
169 # We also install a handful of additional files. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
170 EXTRA_CONTRIB_FILES = [ |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
171 "bash_completion", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
172 "hgweb.fcgi", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
173 "hgweb.wsgi", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
174 "logo-droplets.svg", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
175 "mercurial.el", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
176 "mq.el", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
177 "tcsh_completion", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
178 "tcsh_completion_build.sh", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
179 "xml.rnc", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
180 "zsh_completion", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
181 ] |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
182 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
183 for f in EXTRA_CONTRIB_FILES: |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
184 manifest.add_file(FileContent(path = ROOT + "/contrib/" + f), directory = "contrib") |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
185 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
186 # Individual files with full source to destination path mapping. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
187 EXTRA_FILES = { |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
188 "contrib/hgk": "contrib/hgk.tcl", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
189 "contrib/win32/postinstall.txt": "ReleaseNotes.txt", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
190 "contrib/win32/ReadMe.html": "ReadMe.html", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
191 "doc/style.css": "doc/style.css", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
192 "COPYING": "Copying.txt", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
193 } |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
194 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
195 for source, dest in EXTRA_FILES.items(): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
196 print("adding extra file %s" % dest) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
197 manifest.add_file(FileContent(path = ROOT + "/" + source), path = dest) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
198 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
199 # And finally some wildcard matches. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
200 manifest.add_manifest(glob( |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
201 include = [ROOT + "/contrib/vim/*"], |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
202 strip_prefix = ROOT + "/" |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
203 )) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
204 manifest.add_manifest(glob( |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
205 include = [ROOT + "/doc/*.html"], |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
206 strip_prefix = ROOT + "/" |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
207 )) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
208 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
209 # But we don't ship hg-ssh on Windows, so exclude its documentation. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
210 manifest.remove("doc/hg-ssh.8.html") |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
211 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
212 return manifest |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
213 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
214 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
215 def make_msi(manifest): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
216 manifest = make_windows_install_layout(manifest) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
217 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
218 if "x86_64" in BUILD_TARGET_TRIPLE: |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
219 platform = "x64" |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
220 else: |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
221 platform = "x86" |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
222 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
223 manifest.add_file( |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
224 FileContent(path = ROOT + "/contrib/packaging/wix/COPYING.rtf"), |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
225 path = "COPYING.rtf", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
226 ) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
227 manifest.remove("Copying.txt") |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
228 manifest.add_file( |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
229 FileContent(path = ROOT + "/contrib/win32/mercurial.ini"), |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
230 path = "defaultrc/mercurial.rc", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
231 ) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
232 manifest.add_file( |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
233 FileContent(filename = "editor.rc", content = "[ui]\neditor = notepad\n"), |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
234 path = "defaultrc/editor.rc", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
235 ) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
236 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
237 wix = WiXInstaller("hg", "%s-%s.msi" % (MSI_NAME, VERSION)) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
238 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
239 # Materialize files in the manifest to the install layout. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
240 wix.add_install_files(manifest) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
241 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
242 # From mercurial.wxs. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
243 wix.install_files_root_directory_id = "INSTALLDIR" |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
244 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
245 # Pull in our custom .wxs files. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
246 defines = { |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
247 "PyOxidizer": "1", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
248 "Platform": platform, |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
249 "Version": VERSION, |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
250 "Comments": "Installs Mercurial version %s" % VERSION, |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
251 "PythonVersion": "3", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
252 "MercurialHasLib": "1", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
253 } |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
254 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
255 if EXTRA_MSI_FEATURES: |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
256 defines["MercurialExtraFeatures"] = EXTRA_MSI_FEATURES |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
257 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
258 wix.add_wxs_file( |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
259 ROOT + "/contrib/packaging/wix/mercurial.wxs", |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
260 preprocessor_parameters=defines, |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
261 ) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
262 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
263 # Our .wxs references to other files. Pull those into the build environment. |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
264 for f in ("defines.wxi", "guids.wxi", "COPYING.rtf"): |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
265 wix.add_build_file(f, ROOT + "/contrib/packaging/wix/" + f) |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
266 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
267 wix.add_build_file("mercurial.ico", ROOT + "/contrib/win32/mercurial.ico") |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
268 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
269 return wix |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
270 |
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
271 |
47206
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
272 def register_code_signers(): |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
273 if not IS_WINDOWS: |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
274 return |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
275 |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
276 if SIGNING_PFX_PATH: |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
277 signer = code_signer_from_pfx_file(SIGNING_PFX_PATH, SIGNING_PFX_PASSWORD) |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
278 elif SIGNING_SUBJECT_NAME: |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
279 signer = code_signer_from_windows_store_subject(SIGNING_SUBJECT_NAME) |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
280 else: |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
281 signer = None |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
282 |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
283 if signer: |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
284 signer.set_time_stamp_server(TIME_STAMP_SERVER_URL) |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
285 signer.activate() |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
286 |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
287 |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
288 register_code_signers() |
c8001d9c26f5
pyoxidizer: support code signing
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47205
diff
changeset
|
289 |
47203
9438e9b7321a
pyoxidizer: simplify targets
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47201
diff
changeset
|
290 register_target("distribution", make_distribution) |
9438e9b7321a
pyoxidizer: simplify targets
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47201
diff
changeset
|
291 register_target("exe", make_exe, depends = ["distribution"]) |
9438e9b7321a
pyoxidizer: simplify targets
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47201
diff
changeset
|
292 register_target("app", make_manifest, depends = ["distribution", "exe"], default = True) |
47205
603efb3845ba
pyoxidizer: support producing MSI installers
Gregory Szorc <gregory.szorc@gmail.com>
parents:
47204
diff
changeset
|
293 register_target("msi", make_msi, depends = ["app"]) |
44763
94f4f2ec7dee
packaging: support building Inno installer with PyOxidizer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44639
diff
changeset
|
294 |
44638
af739894a4c1
hgcli: add stub PyOxidizer project
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff
changeset
|
295 resolve_targets() |