packaging: move version derivation to run_wix_packaging() stable
authorGregory Szorc <gregory.szorc@gmail.com>
Mon, 20 Apr 2020 18:24:35 -0700
branchstable
changeset 44766 a5740490eb5f
parent 44765 a39984091380
child 44767 234882d17814
packaging: move version derivation to run_wix_packaging() With the previous commit moving signing inline, we no longer need to compute the version string in build_installer() and can instead move this logic to run_wix_packaging(). This makes the logic in build_installer() simpler, which makes it easier to implement alternate building mechanisms. Differential Revision: https://phab.mercurial-scm.org/D8476
contrib/packaging/hgpackaging/wix.py
--- a/contrib/packaging/hgpackaging/wix.py	Mon Apr 20 17:53:20 2020 -0700
+++ b/contrib/packaging/hgpackaging/wix.py	Mon Apr 20 18:24:35 2020 -0700
@@ -327,12 +327,6 @@
         extra_packages_script=extra_packages_script,
     )
 
-    orig_version = version or find_version(source_dir)
-    version = normalize_windows_version(orig_version)
-    print('using version string: %s' % version)
-    if version != orig_version:
-        print('(normalized from: %s)' % orig_version)
-
     build_dir = hg_build_dir / ('wix-%s' % arch)
     staging_dir = build_dir / 'stage'
 
@@ -361,7 +355,6 @@
         staging_dir,
         arch,
         version=version,
-        orig_version=orig_version,
         msi_name=msi_name,
         extra_wxs=extra_wxs,
         extra_features=extra_features,
@@ -375,7 +368,6 @@
     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,
@@ -389,6 +381,13 @@
     we will sign both the hg.exe and the .msi using the signing credentials
     specified.
     """
+
+    orig_version = version or find_version(source_dir)
+    version = normalize_windows_version(orig_version)
+    print('using version string: %s' % version)
+    if version != orig_version:
+        print('(normalized from: %s)' % orig_version)
+
     if signing_info:
         sign_with_signtool(
             staging_dir / "hg.exe",