packaging: add -python2 to Windows installer filenames stable
authorGregory Szorc <gregory.szorc@gmail.com>
Thu, 23 Apr 2020 18:48:36 -0700
branchstable
changeset 44769 9ade217b550d
parent 44768 9d441f820c8b
child 44770 47609da15379
packaging: add -python2 to Windows installer filenames We just taught the Windows installers to produce Python 3 variants built with PyOxidizer. Our plan is to publish both Python 2 and Python 3 versions of the installers for Mercurial 5.4. This commit teaches the Inno and WiX installers to add an optional string suffix to the installer name. On Python 2, that suffix is "-python2." We reserve the existing name for the Python 3 installers, which we want to make the default. Differential Revision: https://phab.mercurial-scm.org/D8479
contrib/automation/hgautomation/windows.py
contrib/packaging/hgpackaging/inno.py
contrib/packaging/hgpackaging/wix.py
contrib/packaging/inno/mercurial.iss
--- a/contrib/automation/hgautomation/windows.py	Thu Apr 23 17:24:37 2020 -0700
+++ b/contrib/automation/hgautomation/windows.py	Thu Apr 23 18:48:36 2020 -0700
@@ -108,10 +108,10 @@
 WHEEL_FILENAME_PYTHON38_X86 = 'mercurial-{version}-cp38-cp38-win32.whl'
 WHEEL_FILENAME_PYTHON38_X64 = 'mercurial-{version}-cp38-cp38-win_amd64.whl'
 
-X86_EXE_FILENAME = 'Mercurial-{version}.exe'
-X64_EXE_FILENAME = 'Mercurial-{version}-x64.exe'
-X86_MSI_FILENAME = 'mercurial-{version}-x86.msi'
-X64_MSI_FILENAME = 'mercurial-{version}-x64.msi'
+X86_EXE_FILENAME = 'Mercurial-{version}-x86-python2.exe'
+X64_EXE_FILENAME = 'Mercurial-{version}-x64-python2.exe'
+X86_MSI_FILENAME = 'mercurial-{version}-x86-python2.msi'
+X64_MSI_FILENAME = 'mercurial-{version}-x64-python2.msi'
 
 MERCURIAL_SCM_BASE_URL = 'https://mercurial-scm.org/release/windows'
 
--- a/contrib/packaging/hgpackaging/inno.py	Thu Apr 23 17:24:37 2020 -0700
+++ b/contrib/packaging/hgpackaging/inno.py	Thu Apr 23 18:48:36 2020 -0700
@@ -111,6 +111,7 @@
         iscc_exe,
         version,
         arch="x64" if vc_x64 else None,
+        suffix="-python2",
     )
 
 
@@ -150,6 +151,7 @@
     iscc_exe: pathlib.Path,
     version,
     arch=None,
+    suffix="",
 ):
     """Build an Inno installer from staged Mercurial files.
 
@@ -214,6 +216,9 @@
 
     if arch:
         args.append('/dARCH=%s' % arch)
+        args.append('/dSUFFIX=-%s%s' % (arch, suffix))
+    else:
+        args.append('/dSUFFIX=-x86%s' % suffix)
 
     if not version:
         version = read_version_py(source_dir)
--- a/contrib/packaging/hgpackaging/wix.py	Thu Apr 23 17:24:37 2020 -0700
+++ b/contrib/packaging/hgpackaging/wix.py	Thu Apr 23 18:48:36 2020 -0700
@@ -358,6 +358,7 @@
         version=version,
         python2=True,
         msi_name=msi_name,
+        suffix="-python2",
         extra_wxs=extra_wxs,
         extra_features=extra_features,
         signing_info=signing_info,
@@ -415,6 +416,7 @@
     version: str,
     python2: bool,
     msi_name: typing.Optional[str] = "mercurial",
+    suffix: str = "",
     extra_wxs: typing.Optional[typing.Dict[str, str]] = None,
     extra_features: typing.Optional[typing.List[str]] = None,
     signing_info: typing.Optional[typing.Dict[str, str]] = None,
@@ -489,7 +491,9 @@
     run_candle(wix_path, build_dir, source, source_build_rel, defines=defines)
 
     msi_path = (
-        source_dir / 'dist' / ('%s-%s-%s.msi' % (msi_name, orig_version, arch))
+        source_dir
+        / 'dist'
+        / ('%s-%s-%s%s.msi' % (msi_name, orig_version, arch, suffix))
     )
 
     args = [
--- a/contrib/packaging/inno/mercurial.iss	Thu Apr 23 17:24:37 2020 -0700
+++ b/contrib/packaging/inno/mercurial.iss	Thu Apr 23 18:48:36 2020 -0700
@@ -9,14 +9,13 @@
 AppCopyright=Copyright 2005-2020 Matt Mackall and others
 AppName=Mercurial
 AppVersion={#VERSION}
+OutputBaseFilename=Mercurial-{#VERSION}{#SUFFIX}
 #if ARCH == "x64"
 AppVerName=Mercurial {#VERSION} (64-bit)
-OutputBaseFilename=Mercurial-{#VERSION}-x64
 ArchitecturesAllowed=x64
 ArchitecturesInstallIn64BitMode=x64
 #else
 AppVerName=Mercurial {#VERSION}
-OutputBaseFilename=Mercurial-{#VERSION}
 #endif
 InfoAfterFile=../postinstall.txt
 LicenseFile=Copying.txt