Mercurial > hg
diff 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 |
line wrap: on
line diff
--- a/contrib/packaging/hgpackaging/wix.py Thu Apr 23 18:06:02 2020 -0700 +++ b/contrib/packaging/hgpackaging/wix.py Mon Apr 20 17:33:41 2020 -0700 @@ -341,7 +341,6 @@ hg_build_dir = source_dir / 'build' dist_dir = source_dir / 'dist' - wix_dir = source_dir / 'contrib' / 'packaging' / 'wix' requirements_txt = ( source_dir / 'contrib' / 'packaging' / 'requirements_win32.txt' @@ -388,13 +387,41 @@ print('removing %s' % p) p.unlink() - wix_pkg, wix_entry = download_entry('wix', hg_build_dir) - wix_path = hg_build_dir / ('wix-%s' % wix_entry['version']) + return run_wix_packaging( + source_dir, + build_dir, + staging_dir, + arch, + version=version, + orig_version=orig_version, + msi_name=msi_name, + extra_wxs=extra_wxs, + extra_features=extra_features, + ) + + +def run_wix_packaging( + source_dir: pathlib.Path, + build_dir: pathlib.Path, + staging_dir: pathlib.Path, + arch: str, + version: str, + orig_version: str, + msi_name: typing.Optional[str] = "mercurial", + extra_wxs: typing.Optional[typing.Dict[str, str]] = None, + extra_features: typing.Optional[typing.List[str]] = None, +): + """Invokes WiX to package up a built Mercurial.""" + + wix_dir = source_dir / 'contrib' / 'packaging' / 'wix' + + wix_pkg, wix_entry = download_entry('wix', build_dir) + wix_path = build_dir / ('wix-%s' % wix_entry['version']) if not wix_path.exists(): extract_zip_to_directory(wix_pkg, wix_path) - ensure_vc90_merge_modules(hg_build_dir) + ensure_vc90_merge_modules(build_dir) source_build_rel = pathlib.Path(os.path.relpath(source_dir, build_dir)) @@ -413,7 +440,7 @@ source = wix_dir / 'mercurial.wxs' defines['Version'] = version defines['Comments'] = 'Installs Mercurial version %s' % version - defines['VCRedistSrcDir'] = str(hg_build_dir) + defines['VCRedistSrcDir'] = str(build_dir) if extra_features: assert all(';' not in f for f in extra_features) defines['MercurialExtraFeatures'] = ';'.join(extra_features)