Mercurial > hg
annotate contrib/packaging/hgpackaging/wix.py @ 44764:92627c42e7c2 stable
packaging: isolate invocation of WiX to own function
Like we did for Inno, we want to split out the building
of Mercurial from invoking the packaging tool so that we
can introduce an alternate build mechanism.
As part of this refactor, there are inconsequential changes
to file layouts. Before, some shared files such as the
WiX binaries and merge modules would be installed under
build/. Now, they are installed under build/wix-*. This
is to keep implementation simpler. But it also helps keep
build state more isolated.
Differential Revision: https://phab.mercurial-scm.org/D8474
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 20 Apr 2020 17:33:41 -0700 |
parents | 847e582f3cc9 |
children | a39984091380 |
rev | line source |
---|---|
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
1 # wix.py - WiX installer functionality |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
2 # |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
3 # Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com> |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
4 # |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
6 # GNU General Public License version 2 or any later version. |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
7 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
8 # no-check-code because Python 3 native. |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
9 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
10 import collections |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
11 import os |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
12 import pathlib |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
13 import re |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
14 import shutil |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
15 import subprocess |
42048
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
16 import typing |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
17 import uuid |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
18 import xml.dom.minidom |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
19 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
20 from .downloads import download_entry |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
21 from .py2exe import ( |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
22 build_py2exe, |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
23 stage_install, |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
24 ) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
25 from .util import ( |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
26 extract_zip_to_directory, |
44220
a70108a3d7cc
packaging: move the version normalization function to the util module
Matt Harbison <matt_harbison@yahoo.com>
parents:
44173
diff
changeset
|
27 normalize_windows_version, |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
28 process_install_rules, |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
29 sign_with_signtool, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
30 ) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
31 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
32 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
33 EXTRA_PACKAGES = { |
44223
481caa4a2244
packaging: bundle dulwich, keyring, and pywin32-ctypes with WiX too
Matt Harbison <matt_harbison@yahoo.com>
parents:
44220
diff
changeset
|
34 'dulwich', |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
35 'distutils', |
44223
481caa4a2244
packaging: bundle dulwich, keyring, and pywin32-ctypes with WiX too
Matt Harbison <matt_harbison@yahoo.com>
parents:
44220
diff
changeset
|
36 'keyring', |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
37 'pygments', |
44223
481caa4a2244
packaging: bundle dulwich, keyring, and pywin32-ctypes with WiX too
Matt Harbison <matt_harbison@yahoo.com>
parents:
44220
diff
changeset
|
38 'win32ctypes', |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
39 } |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
40 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
41 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
42 EXTRA_INSTALL_RULES = [ |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
43 ('contrib/packaging/wix/COPYING.rtf', 'COPYING.rtf'), |
44153
e4344e463c0c
packaging: rename hgrc.d to defaultrc for Windows config files next to the exe
Matt Harbison <matt_harbison@yahoo.com>
parents:
43623
diff
changeset
|
44 ('contrib/win32/mercurial.ini', 'defaultrc/mercurial.rc'), |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
45 ] |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
46 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
47 STAGING_REMOVE_FILES = [ |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
48 # We use the RTF variant. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
49 'copying.txt', |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
50 ] |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
51 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
52 SHORTCUTS = { |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
53 # hg.1.html' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
54 'hg.file.5d3e441c_28d9_5542_afd0_cdd4234f12d5': { |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
55 'Name': 'Mercurial Command Reference', |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
56 }, |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
57 # hgignore.5.html |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
58 'hg.file.5757d8e0_f207_5e10_a2ec_3ba0a062f431': { |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
59 'Name': 'Mercurial Ignore Files', |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
60 }, |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
61 # hgrc.5.html |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
62 'hg.file.92e605fd_1d1a_5dc6_9fc0_5d2998eb8f5e': { |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
63 'Name': 'Mercurial Configuration Files', |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
64 }, |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
65 } |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
66 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
67 |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
68 def find_version(source_dir: pathlib.Path): |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
69 version_py = source_dir / 'mercurial' / '__version__.py' |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
70 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
71 with version_py.open('r', encoding='utf-8') as fh: |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
72 source = fh.read().strip() |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
73 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
74 m = re.search('version = b"(.*)"', source) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
75 return m.group(1) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
76 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
77 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
78 def ensure_vc90_merge_modules(build_dir): |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
79 x86 = ( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
80 download_entry( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
81 'vc9-crt-x86-msm', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
82 build_dir, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
83 local_name='microsoft.vcxx.crt.x86_msm.msm', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
84 )[0], |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
85 download_entry( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
86 'vc9-crt-x86-msm-policy', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
87 build_dir, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
88 local_name='policy.x.xx.microsoft.vcxx.crt.x86_msm.msm', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
89 )[0], |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
90 ) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
91 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
92 x64 = ( |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
93 download_entry( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
94 'vc9-crt-x64-msm', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
95 build_dir, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
96 local_name='microsoft.vcxx.crt.x64_msm.msm', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
97 )[0], |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
98 download_entry( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
99 'vc9-crt-x64-msm-policy', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
100 build_dir, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
101 local_name='policy.x.xx.microsoft.vcxx.crt.x64_msm.msm', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
102 )[0], |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
103 ) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
104 return { |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
105 'x86': x86, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
106 'x64': x64, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
107 } |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
108 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
109 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
110 def run_candle(wix, cwd, wxs, source_dir, defines=None): |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
111 args = [ |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
112 str(wix / 'candle.exe'), |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
113 '-nologo', |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
114 str(wxs), |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
115 '-dSourceDir=%s' % source_dir, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
116 ] |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
117 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
118 if defines: |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
119 args.extend('-d%s=%s' % define for define in sorted(defines.items())) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
120 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
121 subprocess.run(args, cwd=str(cwd), check=True) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
122 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
123 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
124 def make_post_build_signing_fn( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
125 name, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
126 subject_name=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
127 cert_path=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
128 cert_password=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
129 timestamp_url=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
130 ): |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
131 """Create a callable that will use signtool to sign hg.exe.""" |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
132 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
133 def post_build_sign(source_dir, build_dir, dist_dir, version): |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
134 description = '%s %s' % (name, version) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
135 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
136 sign_with_signtool( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
137 dist_dir / 'hg.exe', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
138 description, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
139 subject_name=subject_name, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
140 cert_path=cert_path, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
141 cert_password=cert_password, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
142 timestamp_url=timestamp_url, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
143 ) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
144 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
145 return post_build_sign |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
146 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
147 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
148 def make_files_xml(staging_dir: pathlib.Path, is_x64) -> str: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
149 """Create XML string listing every file to be installed.""" |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
150 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
151 # We derive GUIDs from a deterministic file path identifier. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
152 # We shoehorn the name into something that looks like a URL because |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
153 # the UUID namespaces are supposed to work that way (even though |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
154 # the input data probably is never validated). |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
155 |
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
156 doc = xml.dom.minidom.parseString( |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
157 '<?xml version="1.0" encoding="utf-8"?>' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
158 '<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
159 '</Wix>' |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
160 ) |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
161 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
162 # Assemble the install layout by directory. This makes it easier to |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
163 # emit XML, since each directory has separate entities. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
164 manifest = collections.defaultdict(dict) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
165 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
166 for root, dirs, files in os.walk(staging_dir): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
167 dirs.sort() |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
168 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
169 root = pathlib.Path(root) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
170 rel_dir = root.relative_to(staging_dir) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
171 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
172 for i in range(len(rel_dir.parts)): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
173 parent = '/'.join(rel_dir.parts[0 : i + 1]) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
174 manifest.setdefault(parent, {}) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
175 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
176 for f in sorted(files): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
177 full = root / f |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
178 manifest[str(rel_dir).replace('\\', '/')][full.name] = full |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
179 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
180 component_groups = collections.defaultdict(list) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
181 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
182 # Now emit a <Fragment> for each directory. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
183 # Each directory is composed of a <DirectoryRef> pointing to its parent |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
184 # and defines child <Directory>'s and a <Component> with all the files. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
185 for dir_name, entries in sorted(manifest.items()): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
186 # The directory id is derived from the path. But the root directory |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
187 # is special. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
188 if dir_name == '.': |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
189 parent_directory_id = 'INSTALLDIR' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
190 else: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
191 parent_directory_id = 'hg.dir.%s' % dir_name.replace('/', '.') |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
192 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
193 fragment = doc.createElement('Fragment') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
194 directory_ref = doc.createElement('DirectoryRef') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
195 directory_ref.setAttribute('Id', parent_directory_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
196 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
197 # Add <Directory> entries for immediate children directories. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
198 for possible_child in sorted(manifest.keys()): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
199 if ( |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
200 dir_name == '.' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
201 and '/' not in possible_child |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
202 and possible_child != '.' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
203 ): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
204 child_directory_id = 'hg.dir.%s' % possible_child |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
205 name = possible_child |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
206 else: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
207 if not possible_child.startswith('%s/' % dir_name): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
208 continue |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
209 name = possible_child[len(dir_name) + 1 :] |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
210 if '/' in name: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
211 continue |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
212 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
213 child_directory_id = 'hg.dir.%s' % possible_child.replace( |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
214 '/', '.' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
215 ) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
216 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
217 directory = doc.createElement('Directory') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
218 directory.setAttribute('Id', child_directory_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
219 directory.setAttribute('Name', name) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
220 directory_ref.appendChild(directory) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
221 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
222 # Add <Component>s for files in this directory. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
223 for rel, source_path in sorted(entries.items()): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
224 if dir_name == '.': |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
225 full_rel = rel |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
226 else: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
227 full_rel = '%s/%s' % (dir_name, rel) |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
228 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
229 component_unique_id = ( |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
230 'https://www.mercurial-scm.org/wix-installer/0/component/%s' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
231 % full_rel |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
232 ) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
233 component_guid = uuid.uuid5(uuid.NAMESPACE_URL, component_unique_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
234 component_id = 'hg.component.%s' % str(component_guid).replace( |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
235 '-', '_' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
236 ) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
237 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
238 component = doc.createElement('Component') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
239 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
240 component.setAttribute('Id', component_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
241 component.setAttribute('Guid', str(component_guid).upper()) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
242 component.setAttribute('Win64', 'yes' if is_x64 else 'no') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
243 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
244 # Assign this component to a top-level group. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
245 if dir_name == '.': |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
246 component_groups['ROOT'].append(component_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
247 elif '/' in dir_name: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
248 component_groups[dir_name[0 : dir_name.index('/')]].append( |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
249 component_id |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
250 ) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
251 else: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
252 component_groups[dir_name].append(component_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
253 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
254 unique_id = ( |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
255 'https://www.mercurial-scm.org/wix-installer/0/%s' % full_rel |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
256 ) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
257 file_guid = uuid.uuid5(uuid.NAMESPACE_URL, unique_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
258 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
259 # IDs have length limits. So use GUID to derive them. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
260 file_guid_normalized = str(file_guid).replace('-', '_') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
261 file_id = 'hg.file.%s' % file_guid_normalized |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
262 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
263 file_element = doc.createElement('File') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
264 file_element.setAttribute('Id', file_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
265 file_element.setAttribute('Source', str(source_path)) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
266 file_element.setAttribute('KeyPath', 'yes') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
267 file_element.setAttribute('ReadOnly', 'yes') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
268 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
269 component.appendChild(file_element) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
270 directory_ref.appendChild(component) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
271 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
272 fragment.appendChild(directory_ref) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
273 doc.documentElement.appendChild(fragment) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
274 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
275 for group, component_ids in sorted(component_groups.items()): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
276 fragment = doc.createElement('Fragment') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
277 component_group = doc.createElement('ComponentGroup') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
278 component_group.setAttribute('Id', 'hg.group.%s' % group) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
279 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
280 for component_id in component_ids: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
281 component_ref = doc.createElement('ComponentRef') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
282 component_ref.setAttribute('Id', component_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
283 component_group.appendChild(component_ref) |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
284 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
285 fragment.appendChild(component_group) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
286 doc.documentElement.appendChild(fragment) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
287 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
288 # Add <Shortcut> to files that have it defined. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
289 for file_id, metadata in sorted(SHORTCUTS.items()): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
290 els = doc.getElementsByTagName('File') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
291 els = [el for el in els if el.getAttribute('Id') == file_id] |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
292 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
293 if not els: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
294 raise Exception('could not find File[Id=%s]' % file_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
295 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
296 for el in els: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
297 shortcut = doc.createElement('Shortcut') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
298 shortcut.setAttribute('Id', 'hg.shortcut.%s' % file_id) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
299 shortcut.setAttribute('Directory', 'ProgramMenuDir') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
300 shortcut.setAttribute('Icon', 'hgIcon.ico') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
301 shortcut.setAttribute('IconIndex', '0') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
302 shortcut.setAttribute('Advertise', 'yes') |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
303 for k, v in sorted(metadata.items()): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
304 shortcut.setAttribute(k, v) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
305 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
306 el.appendChild(shortcut) |
41957
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
307 |
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
308 return doc.toprettyxml() |
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
309 |
131d0b7c3940
wix: autogenerate wxs file for library files
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41956
diff
changeset
|
310 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
311 def build_installer( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
312 source_dir: pathlib.Path, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
313 python_exe: pathlib.Path, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
314 msi_name='mercurial', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
315 version=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
316 post_build_fn=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
317 extra_packages_script=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
318 extra_wxs: typing.Optional[typing.Dict[str, str]] = None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
319 extra_features: typing.Optional[typing.List[str]] = None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
320 ): |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
321 """Build a WiX MSI installer. |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
322 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
323 ``source_dir`` is the path to the Mercurial source tree to use. |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
324 ``arch`` is the target architecture. either ``x86`` or ``x64``. |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
325 ``python_exe`` is the path to the Python executable to use/bundle. |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
326 ``version`` is the Mercurial version string. If not defined, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
327 ``mercurial/__version__.py`` will be consulted. |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
328 ``post_build_fn`` is a callable that will be called after building |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
329 Mercurial but before invoking WiX. It can be used to e.g. facilitate |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
330 signing. It is passed the paths to the Mercurial source, build, and |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
331 dist directories and the resolved Mercurial version. |
42047
715d3220ac4f
wix: add a hook for a prebuild script to inject extra libraries
Augie Fackler <augie@google.com>
parents:
41957
diff
changeset
|
332 ``extra_packages_script`` is a command to be run to inject extra packages |
715d3220ac4f
wix: add a hook for a prebuild script to inject extra libraries
Augie Fackler <augie@google.com>
parents:
41957
diff
changeset
|
333 into the py2exe binary. It should stage packages into the virtualenv and |
715d3220ac4f
wix: add a hook for a prebuild script to inject extra libraries
Augie Fackler <augie@google.com>
parents:
41957
diff
changeset
|
334 print a null byte followed by a newline-separated list of packages that |
715d3220ac4f
wix: add a hook for a prebuild script to inject extra libraries
Augie Fackler <augie@google.com>
parents:
41957
diff
changeset
|
335 should be included in the exe. |
42048
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
336 ``extra_wxs`` is a dict of {wxs_name: working_dir_for_wxs_build}. |
42049
1711f5813a63
wix: add functionality to inject additional Features into installer
Augie Fackler <raf@durin42.com>
parents:
42048
diff
changeset
|
337 ``extra_features`` is a list of additional named Features to include in |
1711f5813a63
wix: add functionality to inject additional Features into installer
Augie Fackler <raf@durin42.com>
parents:
42048
diff
changeset
|
338 the build. These must match Feature names in one of the wxs scripts. |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
339 """ |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
340 arch = 'x64' if r'\x64' in os.environ.get('LIB', '') else 'x86' |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
341 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
342 hg_build_dir = source_dir / 'build' |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
343 dist_dir = source_dir / 'dist' |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
344 |
44242
847e582f3cc9
packaging: make the path to Win32 requirements absolute when building WiX
Matt Harbison <matt_harbison@yahoo.com>
parents:
44224
diff
changeset
|
345 requirements_txt = ( |
847e582f3cc9
packaging: make the path to Win32 requirements absolute when building WiX
Matt Harbison <matt_harbison@yahoo.com>
parents:
44224
diff
changeset
|
346 source_dir / 'contrib' / 'packaging' / 'requirements_win32.txt' |
847e582f3cc9
packaging: make the path to Win32 requirements absolute when building WiX
Matt Harbison <matt_harbison@yahoo.com>
parents:
44224
diff
changeset
|
347 ) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
348 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
349 build_py2exe( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
350 source_dir, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
351 hg_build_dir, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
352 python_exe, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
353 'wix', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
354 requirements_txt, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
355 extra_packages=EXTRA_PACKAGES, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
356 extra_packages_script=extra_packages_script, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
357 ) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
358 |
44172
2251b6cde170
wix: always normalize version string
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44171
diff
changeset
|
359 orig_version = version or find_version(source_dir) |
44220
a70108a3d7cc
packaging: move the version normalization function to the util module
Matt Harbison <matt_harbison@yahoo.com>
parents:
44173
diff
changeset
|
360 version = normalize_windows_version(orig_version) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
361 print('using version string: %s' % version) |
44172
2251b6cde170
wix: always normalize version string
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44171
diff
changeset
|
362 if version != orig_version: |
2251b6cde170
wix: always normalize version string
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44171
diff
changeset
|
363 print('(normalized from: %s)' % orig_version) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
364 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
365 if post_build_fn: |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
366 post_build_fn(source_dir, hg_build_dir, dist_dir, version) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
367 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
368 build_dir = hg_build_dir / ('wix-%s' % arch) |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
369 staging_dir = build_dir / 'stage' |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
370 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
371 build_dir.mkdir(exist_ok=True) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
372 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
373 # Purge the staging directory for every build so packaging is pristine. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
374 if staging_dir.exists(): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
375 print('purging %s' % staging_dir) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
376 shutil.rmtree(staging_dir) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
377 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
378 stage_install(source_dir, staging_dir, lower_case=True) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
379 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
380 # We also install some extra files. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
381 process_install_rules(EXTRA_INSTALL_RULES, source_dir, staging_dir) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
382 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
383 # And remove some files we don't want. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
384 for f in STAGING_REMOVE_FILES: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
385 p = staging_dir / f |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
386 if p.exists(): |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
387 print('removing %s' % p) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
388 p.unlink() |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
389 |
44764
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
390 return run_wix_packaging( |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
391 source_dir, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
392 build_dir, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
393 staging_dir, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
394 arch, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
395 version=version, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
396 orig_version=orig_version, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
397 msi_name=msi_name, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
398 extra_wxs=extra_wxs, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
399 extra_features=extra_features, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
400 ) |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
401 |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
402 |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
403 def run_wix_packaging( |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
404 source_dir: pathlib.Path, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
405 build_dir: pathlib.Path, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
406 staging_dir: pathlib.Path, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
407 arch: str, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
408 version: str, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
409 orig_version: str, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
410 msi_name: typing.Optional[str] = "mercurial", |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
411 extra_wxs: typing.Optional[typing.Dict[str, str]] = None, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
412 extra_features: typing.Optional[typing.List[str]] = None, |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
413 ): |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
414 """Invokes WiX to package up a built Mercurial.""" |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
415 |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
416 wix_dir = source_dir / 'contrib' / 'packaging' / 'wix' |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
417 |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
418 wix_pkg, wix_entry = download_entry('wix', build_dir) |
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
419 wix_path = build_dir / ('wix-%s' % wix_entry['version']) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
420 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
421 if not wix_path.exists(): |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
422 extract_zip_to_directory(wix_pkg, wix_path) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
423 |
44764
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
424 ensure_vc90_merge_modules(build_dir) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
425 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
426 source_build_rel = pathlib.Path(os.path.relpath(source_dir, build_dir)) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
427 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
428 defines = {'Platform': arch} |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
429 |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
430 # Derive a .wxs file with the staged files. |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
431 manifest_wxs = build_dir / 'stage.wxs' |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
432 with manifest_wxs.open('w', encoding='utf-8') as fh: |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
433 fh.write(make_files_xml(staging_dir, is_x64=arch == 'x64')) |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
434 |
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
435 run_candle(wix_path, build_dir, manifest_wxs, staging_dir, defines=defines) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
436 |
42048
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
437 for source, rel_path in sorted((extra_wxs or {}).items()): |
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
438 run_candle(wix_path, build_dir, source, rel_path, defines=defines) |
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
439 |
41956
39f65c506899
wix: introduce variable to hold path to wix packaging directory
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41952
diff
changeset
|
440 source = wix_dir / 'mercurial.wxs' |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
441 defines['Version'] = version |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
442 defines['Comments'] = 'Installs Mercurial version %s' % version |
44764
92627c42e7c2
packaging: isolate invocation of WiX to own function
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44242
diff
changeset
|
443 defines['VCRedistSrcDir'] = str(build_dir) |
42049
1711f5813a63
wix: add functionality to inject additional Features into installer
Augie Fackler <raf@durin42.com>
parents:
42048
diff
changeset
|
444 if extra_features: |
1711f5813a63
wix: add functionality to inject additional Features into installer
Augie Fackler <raf@durin42.com>
parents:
42048
diff
changeset
|
445 assert all(';' not in f for f in extra_features) |
1711f5813a63
wix: add functionality to inject additional Features into installer
Augie Fackler <raf@durin42.com>
parents:
42048
diff
changeset
|
446 defines['MercurialExtraFeatures'] = ';'.join(extra_features) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
447 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
448 run_candle(wix_path, build_dir, source, source_build_rel, defines=defines) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
449 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
450 msi_path = ( |
44173
62111bc5ff87
wix: use original version string for MSI filename
Gregory Szorc <gregory.szorc@gmail.com>
parents:
44172
diff
changeset
|
451 source_dir / 'dist' / ('%s-%s-%s.msi' % (msi_name, orig_version, arch)) |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
452 ) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
453 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
454 args = [ |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
455 str(wix_path / 'light.exe'), |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
456 '-nologo', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
457 '-ext', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
458 'WixUIExtension', |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
459 '-sw1076', |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
460 '-spdb', |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
461 '-o', |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
462 str(msi_path), |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
463 ] |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
464 |
42048
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
465 for source, rel_path in sorted((extra_wxs or {}).items()): |
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
466 assert source.endswith('.wxs') |
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
467 source = os.path.basename(source) |
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
468 args.append(str(build_dir / ('%s.wixobj' % source[:-4]))) |
978b03d5f66e
wix: add support for additional wxs files
Augie Fackler <raf@durin42.com>
parents:
42047
diff
changeset
|
469 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
470 args.extend( |
43623
94eac340d212
packaging: stage files and dynamically generate WiX installer
Gregory Szorc <gregory.szorc@gmail.com>
parents:
43522
diff
changeset
|
471 [str(build_dir / 'stage.wixobj'), str(build_dir / 'mercurial.wixobj'),] |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
472 ) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
473 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
474 subprocess.run(args, cwd=str(source_dir), check=True) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
475 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
476 print('%s created' % msi_path) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
477 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
478 return { |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
479 'msi_path': msi_path, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
480 } |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
481 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
482 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
483 def build_signed_installer( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
484 source_dir: pathlib.Path, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
485 python_exe: pathlib.Path, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
486 name: str, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
487 version=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
488 subject_name=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
489 cert_path=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
490 cert_password=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
491 timestamp_url=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
492 extra_packages_script=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
493 extra_wxs=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
494 extra_features=None, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
495 ): |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
496 """Build an installer with signed executables.""" |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
497 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
498 post_build_fn = make_post_build_signing_fn( |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
499 name, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
500 subject_name=subject_name, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
501 cert_path=cert_path, |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
502 cert_password=cert_password, |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
503 timestamp_url=timestamp_url, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
504 ) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
505 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
506 info = build_installer( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
507 source_dir, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
508 python_exe=python_exe, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
509 msi_name=name.lower(), |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
510 version=version, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
511 post_build_fn=post_build_fn, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
512 extra_packages_script=extra_packages_script, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
513 extra_wxs=extra_wxs, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
514 extra_features=extra_features, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
515 ) |
41952
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
516 |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
517 description = '%s %s' % (name, version) |
b83de9150c1c
packaging: convert files to LF
Gregory Szorc <gregory.szorc@gmail.com>
parents:
41924
diff
changeset
|
518 |
43076
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
519 sign_with_signtool( |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
520 info['msi_path'], |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
521 description, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
522 subject_name=subject_name, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
523 cert_path=cert_path, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
524 cert_password=cert_password, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
525 timestamp_url=timestamp_url, |
2372284d9457
formatting: blacken the codebase
Augie Fackler <augie@google.com>
parents:
42049
diff
changeset
|
526 ) |