diff --git a/contrib/packaging/hgpackaging/wix.py b/contrib/packaging/hgpackaging/wix.py --- a/contrib/packaging/hgpackaging/wix.py +++ b/contrib/packaging/hgpackaging/wix.py @@ -179,8 +179,9 @@ def make_libraries_xml(wix_dir: pathlib. def build_installer(source_dir: pathlib.Path, python_exe: pathlib.Path, msi_name='mercurial', version=None, post_build_fn=None, - extra_packages_script: typing.Optional[str]=None, - extra_wxs:typing.Optional[typing.Dict[str,str]]=None): + extra_packages_script=None, + extra_wxs:typing.Optional[typing.Dict[str,str]]=None, + extra_features:typing.Optional[typing.List[str]]=None): """Build a WiX MSI installer. ``source_dir`` is the path to the Mercurial source tree to use. @@ -197,6 +198,8 @@ def build_installer(source_dir: pathlib. print a null byte followed by a newline-separated list of packages that should be included in the exe. ``extra_wxs`` is a dict of {wxs_name: working_dir_for_wxs_build}. + ``extra_features`` is a list of additional named Features to include in + the build. These must match Feature names in one of the wxs scripts. """ arch = 'x64' if r'\x64' in os.environ.get('LIB', '') else 'x86' @@ -256,6 +259,9 @@ def build_installer(source_dir: pathlib. defines['Version'] = version defines['Comments'] = 'Installs Mercurial version %s' % version defines['VCRedistSrcDir'] = str(hg_build_dir) + if extra_features: + assert all(';' not in f for f in extra_features) + defines['MercurialExtraFeatures'] = ';'.join(extra_features) run_candle(wix_path, build_dir, source, source_build_rel, defines=defines) @@ -298,7 +304,7 @@ def build_signed_installer(source_dir: p name: str, version=None, subject_name=None, cert_path=None, cert_password=None, timestamp_url=None, extra_packages_script=None, - extra_wxs=None): + extra_wxs=None, extra_features=None): """Build an installer with signed executables.""" post_build_fn = make_post_build_signing_fn( @@ -312,7 +318,7 @@ def build_signed_installer(source_dir: p msi_name=name.lower(), version=version, post_build_fn=post_build_fn, extra_packages_script=extra_packages_script, - extra_wxs=extra_wxs) + extra_wxs=extra_wxs, extra_features=extra_features) description = '%s %s' % (name, version) diff --git a/contrib/packaging/wix/build.py b/contrib/packaging/wix/build.py --- a/contrib/packaging/wix/build.py +++ b/contrib/packaging/wix/build.py @@ -39,6 +39,9 @@ if __name__ == '__main__': 'py2exe binary.')) parser.add_argument('--extra-wxs', help='CSV of path_to_wxs_file=working_dir_for_wxs_file') + parser.add_argument('--extra-features', + help=('CSV of extra feature names to include ' + 'in the installer from the extra wxs files')) args = parser.parse_args() @@ -64,6 +67,8 @@ if __name__ == '__main__': if args.extra_wxs: kwargs['extra_wxs'] = dict( thing.split("=") for thing in args.extra_wxs.split(',')) + if args.extra_features: + kwargs['extra_features'] = args.extra_features.split(',') if args.sign_sn or args.sign_cert: fn = build_signed_installer diff --git a/contrib/packaging/wix/mercurial.wxs b/contrib/packaging/wix/mercurial.wxs --- a/contrib/packaging/wix/mercurial.wxs +++ b/contrib/packaging/wix/mercurial.wxs @@ -129,6 +129,11 @@ + + + + +