Show More
@@ -179,8 +179,9 def make_libraries_xml(wix_dir: pathlib. | |||||
179 |
|
179 | |||
180 | def build_installer(source_dir: pathlib.Path, python_exe: pathlib.Path, |
|
180 | def build_installer(source_dir: pathlib.Path, python_exe: pathlib.Path, | |
181 | msi_name='mercurial', version=None, post_build_fn=None, |
|
181 | msi_name='mercurial', version=None, post_build_fn=None, | |
182 |
extra_packages_script |
|
182 | extra_packages_script=None, | |
183 |
extra_wxs:typing.Optional[typing.Dict[str,str]]=None |
|
183 | extra_wxs:typing.Optional[typing.Dict[str,str]]=None, | |
|
184 | extra_features:typing.Optional[typing.List[str]]=None): | |||
184 | """Build a WiX MSI installer. |
|
185 | """Build a WiX MSI installer. | |
185 |
|
186 | |||
186 | ``source_dir`` is the path to the Mercurial source tree to use. |
|
187 | ``source_dir`` is the path to the Mercurial source tree to use. | |
@@ -197,6 +198,8 def build_installer(source_dir: pathlib. | |||||
197 | print a null byte followed by a newline-separated list of packages that |
|
198 | print a null byte followed by a newline-separated list of packages that | |
198 | should be included in the exe. |
|
199 | should be included in the exe. | |
199 | ``extra_wxs`` is a dict of {wxs_name: working_dir_for_wxs_build}. |
|
200 | ``extra_wxs`` is a dict of {wxs_name: working_dir_for_wxs_build}. | |
|
201 | ``extra_features`` is a list of additional named Features to include in | |||
|
202 | the build. These must match Feature names in one of the wxs scripts. | |||
200 | """ |
|
203 | """ | |
201 | arch = 'x64' if r'\x64' in os.environ.get('LIB', '') else 'x86' |
|
204 | arch = 'x64' if r'\x64' in os.environ.get('LIB', '') else 'x86' | |
202 |
|
205 | |||
@@ -256,6 +259,9 def build_installer(source_dir: pathlib. | |||||
256 | defines['Version'] = version |
|
259 | defines['Version'] = version | |
257 | defines['Comments'] = 'Installs Mercurial version %s' % version |
|
260 | defines['Comments'] = 'Installs Mercurial version %s' % version | |
258 | defines['VCRedistSrcDir'] = str(hg_build_dir) |
|
261 | defines['VCRedistSrcDir'] = str(hg_build_dir) | |
|
262 | if extra_features: | |||
|
263 | assert all(';' not in f for f in extra_features) | |||
|
264 | defines['MercurialExtraFeatures'] = ';'.join(extra_features) | |||
259 |
|
265 | |||
260 | run_candle(wix_path, build_dir, source, source_build_rel, defines=defines) |
|
266 | run_candle(wix_path, build_dir, source, source_build_rel, defines=defines) | |
261 |
|
267 | |||
@@ -298,7 +304,7 def build_signed_installer(source_dir: p | |||||
298 | name: str, version=None, subject_name=None, |
|
304 | name: str, version=None, subject_name=None, | |
299 | cert_path=None, cert_password=None, |
|
305 | cert_path=None, cert_password=None, | |
300 | timestamp_url=None, extra_packages_script=None, |
|
306 | timestamp_url=None, extra_packages_script=None, | |
301 | extra_wxs=None): |
|
307 | extra_wxs=None, extra_features=None): | |
302 | """Build an installer with signed executables.""" |
|
308 | """Build an installer with signed executables.""" | |
303 |
|
309 | |||
304 | post_build_fn = make_post_build_signing_fn( |
|
310 | post_build_fn = make_post_build_signing_fn( | |
@@ -312,7 +318,7 def build_signed_installer(source_dir: p | |||||
312 | msi_name=name.lower(), version=version, |
|
318 | msi_name=name.lower(), version=version, | |
313 | post_build_fn=post_build_fn, |
|
319 | post_build_fn=post_build_fn, | |
314 | extra_packages_script=extra_packages_script, |
|
320 | extra_packages_script=extra_packages_script, | |
315 | extra_wxs=extra_wxs) |
|
321 | extra_wxs=extra_wxs, extra_features=extra_features) | |
316 |
|
322 | |||
317 | description = '%s %s' % (name, version) |
|
323 | description = '%s %s' % (name, version) | |
318 |
|
324 |
@@ -39,6 +39,9 if __name__ == '__main__': | |||||
39 | 'py2exe binary.')) |
|
39 | 'py2exe binary.')) | |
40 | parser.add_argument('--extra-wxs', |
|
40 | parser.add_argument('--extra-wxs', | |
41 | help='CSV of path_to_wxs_file=working_dir_for_wxs_file') |
|
41 | help='CSV of path_to_wxs_file=working_dir_for_wxs_file') | |
|
42 | parser.add_argument('--extra-features', | |||
|
43 | help=('CSV of extra feature names to include ' | |||
|
44 | 'in the installer from the extra wxs files')) | |||
42 |
|
45 | |||
43 | args = parser.parse_args() |
|
46 | args = parser.parse_args() | |
44 |
|
47 | |||
@@ -64,6 +67,8 if __name__ == '__main__': | |||||
64 | if args.extra_wxs: |
|
67 | if args.extra_wxs: | |
65 | kwargs['extra_wxs'] = dict( |
|
68 | kwargs['extra_wxs'] = dict( | |
66 | thing.split("=") for thing in args.extra_wxs.split(',')) |
|
69 | thing.split("=") for thing in args.extra_wxs.split(',')) | |
|
70 | if args.extra_features: | |||
|
71 | kwargs['extra_features'] = args.extra_features.split(',') | |||
67 |
|
72 | |||
68 | if args.sign_sn or args.sign_cert: |
|
73 | if args.sign_sn or args.sign_cert: | |
69 | fn = build_signed_installer |
|
74 | fn = build_signed_installer |
@@ -129,6 +129,11 | |||||
129 | <MergeRef Id='VCRuntime' /> |
|
129 | <MergeRef Id='VCRuntime' /> | |
130 | <MergeRef Id='VCRuntimePolicy' /> |
|
130 | <MergeRef Id='VCRuntimePolicy' /> | |
131 | </Feature> |
|
131 | </Feature> | |
|
132 | <?if $(var.MercurialExtraFeatures)?> | |||
|
133 | <?foreach EXTRAFEAT in $(var.MercurialExtraFeatures)?> | |||
|
134 | <FeatureRef Id="$(var.EXTRAFEAT)" /> | |||
|
135 | <?endforeach?> | |||
|
136 | <?endif?> | |||
132 | <Feature Id='Locales' Title='Translations' Description='Translations' Level='1'> |
|
137 | <Feature Id='Locales' Title='Translations' Description='Translations' Level='1'> | |
133 | <ComponentGroupRef Id='localeFolder' /> |
|
138 | <ComponentGroupRef Id='localeFolder' /> | |
134 | <ComponentRef Id='i18nFolder' /> |
|
139 | <ComponentRef Id='i18nFolder' /> |
General Comments 0
You need to be logged in to leave comments.
Login now