diff contrib/automation/hgautomation/cli.py @ 44772:5e788dc7fb5d stable

automation: support building Python 3 MSI installers This is very similar to what we just did for Inno. Differential Revision: https://phab.mercurial-scm.org/D8484
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 24 Apr 2020 12:37:43 -0700
parents 802ee93c205d
children 64a9423450ef
line wrap: on
line diff
--- a/contrib/automation/hgautomation/cli.py	Fri Apr 24 12:11:08 2020 -0700
+++ b/contrib/automation/hgautomation/cli.py	Fri Apr 24 12:37:43 2020 -0700
@@ -92,7 +92,13 @@
 
 
 def build_wix(
-    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)
@@ -103,10 +109,15 @@
 
         windows.synchronize_hg(SOURCE_ROOT, revision, instance)
 
-        for a in arch:
-            windows.build_wix_installer(
-                instance.winrm_client, a, DIST_PATH, version=version
-            )
+        for py_version in python_version:
+            for a in arch:
+                windows.build_wix_installer(
+                    instance.winrm_client,
+                    py_version,
+                    a,
+                    DIST_PATH,
+                    version=version,
+                )
 
 
 def build_windows_wheel(
@@ -163,12 +174,9 @@
                 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_wix_installer(
-                winrm_client, arch, DIST_PATH, version=version
-            )
+                windows.build_wix_installer(
+                    winrm_client, py_version, arch, DIST_PATH, version=version
+                )
 
 
 def terminate_ec2_instances(hga: HGAutomation, aws_region):
@@ -379,6 +387,14 @@
 
     sp = subparsers.add_parser('build-wix', help='Build WiX 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'},