Mercurial > public > mercurial-scm > hg-stable
comparison contrib/automation/hgautomation/cli.py @ 44756: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 |
comparison
equal
deleted
inserted
replaced
44755:47609da15379 | 44756:802ee93c205d |
---|---|
61 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | 61 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
62 print('Windows development AMI available as %s' % image.id) | 62 print('Windows development AMI available as %s' % image.id) |
63 | 63 |
64 | 64 |
65 def build_inno( | 65 def build_inno( |
66 hga: HGAutomation, aws_region, arch, revision, version, base_image_name | 66 hga: HGAutomation, |
67 aws_region, | |
68 python_version, | |
69 arch, | |
70 revision, | |
71 version, | |
72 base_image_name, | |
67 ): | 73 ): |
68 c = hga.aws_connection(aws_region) | 74 c = hga.aws_connection(aws_region) |
69 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | 75 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
70 DIST_PATH.mkdir(exist_ok=True) | 76 DIST_PATH.mkdir(exist_ok=True) |
71 | 77 |
72 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: | 78 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
73 instance = insts[0] | 79 instance = insts[0] |
74 | 80 |
75 windows.synchronize_hg(SOURCE_ROOT, revision, instance) | 81 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
76 | 82 |
77 for a in arch: | 83 for py_version in python_version: |
78 windows.build_inno_installer( | 84 for a in arch: |
79 instance.winrm_client, a, DIST_PATH, version=version | 85 windows.build_inno_installer( |
80 ) | 86 instance.winrm_client, |
87 py_version, | |
88 a, | |
89 DIST_PATH, | |
90 version=version, | |
91 ) | |
81 | 92 |
82 | 93 |
83 def build_wix( | 94 def build_wix( |
84 hga: HGAutomation, aws_region, arch, revision, version, base_image_name | 95 hga: HGAutomation, aws_region, arch, revision, version, base_image_name |
85 ): | 96 ): |
144 python_version=py_version, | 155 python_version=py_version, |
145 arch=arch, | 156 arch=arch, |
146 dest_path=DIST_PATH, | 157 dest_path=DIST_PATH, |
147 ) | 158 ) |
148 | 159 |
160 for py_version in (2, 3): | |
161 for arch in ('x86', 'x64'): | |
162 windows.purge_hg(winrm_client) | |
163 windows.build_inno_installer( | |
164 winrm_client, py_version, arch, DIST_PATH, version=version | |
165 ) | |
166 | |
149 for arch in ('x86', 'x64'): | 167 for arch in ('x86', 'x64'): |
150 windows.purge_hg(winrm_client) | |
151 windows.build_inno_installer( | |
152 winrm_client, arch, DIST_PATH, version=version | |
153 ) | |
154 windows.purge_hg(winrm_client) | 168 windows.purge_hg(winrm_client) |
155 windows.build_wix_installer( | 169 windows.build_wix_installer( |
156 winrm_client, arch, DIST_PATH, version=version | 170 winrm_client, arch, DIST_PATH, version=version |
157 ) | 171 ) |
158 | 172 |
305 ) | 319 ) |
306 sp.set_defaults(func=build_all_windows_packages) | 320 sp.set_defaults(func=build_all_windows_packages) |
307 | 321 |
308 sp = subparsers.add_parser( | 322 sp = subparsers.add_parser( |
309 'build-inno', help='Build Inno Setup installer(s)', | 323 'build-inno', help='Build Inno Setup installer(s)', |
324 ) | |
325 sp.add_argument( | |
326 '--python-version', | |
327 help='Which version of Python to target', | |
328 choices={2, 3}, | |
329 type=int, | |
330 nargs='*', | |
331 default=[3], | |
310 ) | 332 ) |
311 sp.add_argument( | 333 sp.add_argument( |
312 '--arch', | 334 '--arch', |
313 help='Architecture to build for', | 335 help='Architecture to build for', |
314 choices={'x86', 'x64'}, | 336 choices={'x86', 'x64'}, |