Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
44771:802ee93c205d | 44772:5e788dc7fb5d |
---|---|
90 version=version, | 90 version=version, |
91 ) | 91 ) |
92 | 92 |
93 | 93 |
94 def build_wix( | 94 def build_wix( |
95 hga: HGAutomation, aws_region, arch, revision, version, base_image_name | 95 hga: HGAutomation, |
96 aws_region, | |
97 python_version, | |
98 arch, | |
99 revision, | |
100 version, | |
101 base_image_name, | |
96 ): | 102 ): |
97 c = hga.aws_connection(aws_region) | 103 c = hga.aws_connection(aws_region) |
98 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | 104 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
99 DIST_PATH.mkdir(exist_ok=True) | 105 DIST_PATH.mkdir(exist_ok=True) |
100 | 106 |
101 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: | 107 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
102 instance = insts[0] | 108 instance = insts[0] |
103 | 109 |
104 windows.synchronize_hg(SOURCE_ROOT, revision, instance) | 110 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
105 | 111 |
106 for a in arch: | 112 for py_version in python_version: |
107 windows.build_wix_installer( | 113 for a in arch: |
108 instance.winrm_client, a, DIST_PATH, version=version | 114 windows.build_wix_installer( |
109 ) | 115 instance.winrm_client, |
116 py_version, | |
117 a, | |
118 DIST_PATH, | |
119 version=version, | |
120 ) | |
110 | 121 |
111 | 122 |
112 def build_windows_wheel( | 123 def build_windows_wheel( |
113 hga: HGAutomation, | 124 hga: HGAutomation, |
114 aws_region, | 125 aws_region, |
161 for arch in ('x86', 'x64'): | 172 for arch in ('x86', 'x64'): |
162 windows.purge_hg(winrm_client) | 173 windows.purge_hg(winrm_client) |
163 windows.build_inno_installer( | 174 windows.build_inno_installer( |
164 winrm_client, py_version, arch, DIST_PATH, version=version | 175 winrm_client, py_version, arch, DIST_PATH, version=version |
165 ) | 176 ) |
166 | 177 windows.build_wix_installer( |
167 for arch in ('x86', 'x64'): | 178 winrm_client, py_version, arch, DIST_PATH, version=version |
168 windows.purge_hg(winrm_client) | 179 ) |
169 windows.build_wix_installer( | |
170 winrm_client, arch, DIST_PATH, version=version | |
171 ) | |
172 | 180 |
173 | 181 |
174 def terminate_ec2_instances(hga: HGAutomation, aws_region): | 182 def terminate_ec2_instances(hga: HGAutomation, aws_region): |
175 c = hga.aws_connection(aws_region, ensure_ec2_state=False) | 183 c = hga.aws_connection(aws_region, ensure_ec2_state=False) |
176 aws.terminate_ec2_instances(c.ec2resource) | 184 aws.terminate_ec2_instances(c.ec2resource) |
376 default=aws.WINDOWS_BASE_IMAGE_NAME, | 384 default=aws.WINDOWS_BASE_IMAGE_NAME, |
377 ) | 385 ) |
378 sp.set_defaults(func=build_windows_wheel) | 386 sp.set_defaults(func=build_windows_wheel) |
379 | 387 |
380 sp = subparsers.add_parser('build-wix', help='Build WiX installer(s)') | 388 sp = subparsers.add_parser('build-wix', help='Build WiX installer(s)') |
389 sp.add_argument( | |
390 '--python-version', | |
391 help='Which version of Python to target', | |
392 choices={2, 3}, | |
393 type=int, | |
394 nargs='*', | |
395 default=[3], | |
396 ) | |
381 sp.add_argument( | 397 sp.add_argument( |
382 '--arch', | 398 '--arch', |
383 help='Architecture to build for', | 399 help='Architecture to build for', |
384 choices={'x86', 'x64'}, | 400 choices={'x86', 'x64'}, |
385 nargs='*', | 401 nargs='*', |