diff contrib/automation/hgautomation/cli.py @ 44771:802ee93c205d stable

automation: support building Python 3 Inno installers The core packaging code now supports building Python 3 installers using PyOxidizer. Let's teach the automation code to invoke it so that we produce both Python 2 and Python 3 based exe installers. When publishing the artifacts, the Python 3 versions are preferred over the Python 2 versions given their higher weight (10 versus 9). This may be a controversial change. But I think making Python 3 the default is warranted, as it is the future. The Python 2 installers are still fully supported and can be installed should issues with Python 3 arise. Differential Revision: https://phab.mercurial-scm.org/D8483
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 24 Apr 2020 12:11:08 -0700
parents 9d441f820c8b
children 5e788dc7fb5d
line wrap: on
line diff
--- a/contrib/automation/hgautomation/cli.py	Fri Apr 24 11:48:07 2020 -0700
+++ b/contrib/automation/hgautomation/cli.py	Fri Apr 24 12:11:08 2020 -0700
@@ -63,7 +63,13 @@
 
 
 def build_inno(
-    hga: HGAutomation, aws_region, arch, revision, version, base_image_name
+    hga: HGAutomation,
+    aws_region,
+    python_version,
+    arch,
+    revision,
+    version,
+    base_image_name,
 ):
     c = hga.aws_connection(aws_region)
     image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
@@ -74,10 +80,15 @@
 
         windows.synchronize_hg(SOURCE_ROOT, revision, instance)
 
-        for a in arch:
-            windows.build_inno_installer(
-                instance.winrm_client, a, DIST_PATH, version=version
-            )
+        for py_version in python_version:
+            for a in arch:
+                windows.build_inno_installer(
+                    instance.winrm_client,
+                    py_version,
+                    a,
+                    DIST_PATH,
+                    version=version,
+                )
 
 
 def build_wix(
@@ -146,12 +157,15 @@
                     dest_path=DIST_PATH,
                 )
 
+        for py_version in (2, 3):
+            for arch in ('x86', 'x64'):
+                windows.purge_hg(winrm_client)
+                windows.build_inno_installer(
+                    winrm_client, py_version, arch, DIST_PATH, version=version
+                )
+
         for arch in ('x86', 'x64'):
             windows.purge_hg(winrm_client)
-            windows.build_inno_installer(
-                winrm_client, arch, DIST_PATH, version=version
-            )
-            windows.purge_hg(winrm_client)
             windows.build_wix_installer(
                 winrm_client, arch, DIST_PATH, version=version
             )
@@ -309,6 +323,14 @@
         'build-inno', help='Build Inno Setup installer(s)',
     )
     sp.add_argument(
+        '--python-version',
+        help='Which version of Python to target',
+        choices={2, 3},
+        type=int,
+        nargs='*',
+        default=[3],
+    )
+    sp.add_argument(
         '--arch',
         help='Architecture to build for',
         choices={'x86', 'x64'},