Mercurial > hg
comparison contrib/automation/hgautomation/cli.py @ 48847:4561ec90d3c1
automation: delete code related to Python 2.7 support
The building of Inno and WiX installers took a python_version argument
that allowed us to specify "2" or "3" for the major Python version. Since
we no longer support Python 2, we can delete this argument and everything
feeding into it.
Differential Revision: https://phab.mercurial-scm.org/D12264
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 19 Feb 2022 18:42:12 -0700 |
parents | d7e064d509a0 |
children | 493034cc3265 |
comparison
equal
deleted
inserted
replaced
48846:d7e064d509a0 | 48847:4561ec90d3c1 |
---|---|
63 | 63 |
64 | 64 |
65 def build_inno( | 65 def build_inno( |
66 hga: HGAutomation, | 66 hga: HGAutomation, |
67 aws_region, | 67 aws_region, |
68 python_version, | |
69 arch, | 68 arch, |
70 revision, | 69 revision, |
71 version, | 70 version, |
72 base_image_name, | 71 base_image_name, |
73 ): | 72 ): |
78 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: | 77 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
79 instance = insts[0] | 78 instance = insts[0] |
80 | 79 |
81 windows.synchronize_hg(SOURCE_ROOT, revision, instance) | 80 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
82 | 81 |
83 for py_version in python_version: | 82 for a in arch: |
84 for a in arch: | 83 windows.build_inno_installer( |
85 windows.build_inno_installer( | 84 instance.winrm_client, |
86 instance.winrm_client, | 85 a, |
87 py_version, | 86 DIST_PATH, |
88 a, | 87 version=version, |
89 DIST_PATH, | 88 ) |
90 version=version, | |
91 ) | |
92 | 89 |
93 | 90 |
94 def build_wix( | 91 def build_wix( |
95 hga: HGAutomation, | 92 hga: HGAutomation, |
96 aws_region, | 93 aws_region, |
97 python_version, | |
98 arch, | 94 arch, |
99 revision, | 95 revision, |
100 version, | 96 version, |
101 base_image_name, | 97 base_image_name, |
102 ): | 98 ): |
107 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: | 103 with aws.temporary_windows_dev_instances(c, image, 't3.medium') as insts: |
108 instance = insts[0] | 104 instance = insts[0] |
109 | 105 |
110 windows.synchronize_hg(SOURCE_ROOT, revision, instance) | 106 windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
111 | 107 |
112 for py_version in python_version: | 108 for a in arch: |
113 for a in arch: | 109 windows.build_wix_installer( |
114 windows.build_wix_installer( | 110 instance.winrm_client, |
115 instance.winrm_client, | 111 a, |
116 py_version, | 112 DIST_PATH, |
117 a, | 113 version=version, |
118 DIST_PATH, | 114 ) |
119 version=version, | |
120 ) | |
121 | 115 |
122 | 116 |
123 def build_windows_wheel( | 117 def build_windows_wheel( |
124 hga: HGAutomation, | 118 hga: HGAutomation, |
125 aws_region, | 119 aws_region, |
166 python_version=py_version, | 160 python_version=py_version, |
167 arch=arch, | 161 arch=arch, |
168 dest_path=DIST_PATH, | 162 dest_path=DIST_PATH, |
169 ) | 163 ) |
170 | 164 |
171 for py_version in (2, 3): | 165 for arch in ('x86', 'x64'): |
172 for arch in ('x86', 'x64'): | 166 windows.purge_hg(winrm_client) |
173 windows.purge_hg(winrm_client) | 167 windows.build_inno_installer( |
174 windows.build_inno_installer( | 168 winrm_client, arch, DIST_PATH, version=version |
175 winrm_client, py_version, arch, DIST_PATH, version=version | 169 ) |
176 ) | 170 windows.build_wix_installer( |
177 windows.build_wix_installer( | 171 winrm_client, arch, DIST_PATH, version=version |
178 winrm_client, py_version, arch, DIST_PATH, version=version | 172 ) |
179 ) | |
180 | 173 |
181 | 174 |
182 def terminate_ec2_instances(hga: HGAutomation, aws_region): | 175 def terminate_ec2_instances(hga: HGAutomation, aws_region): |
183 c = hga.aws_connection(aws_region, ensure_ec2_state=False) | 176 c = hga.aws_connection(aws_region, ensure_ec2_state=False) |
184 aws.terminate_ec2_instances(c.ec2resource) | 177 aws.terminate_ec2_instances(c.ec2resource) |
338 sp = subparsers.add_parser( | 331 sp = subparsers.add_parser( |
339 'build-inno', | 332 'build-inno', |
340 help='Build Inno Setup installer(s)', | 333 help='Build Inno Setup installer(s)', |
341 ) | 334 ) |
342 sp.add_argument( | 335 sp.add_argument( |
343 '--python-version', | |
344 help='Which version of Python to target', | |
345 choices={3}, | |
346 type=int, | |
347 nargs='*', | |
348 default=[3], | |
349 ) | |
350 sp.add_argument( | |
351 '--arch', | 336 '--arch', |
352 help='Architecture to build for', | 337 help='Architecture to build for', |
353 choices={'x86', 'x64'}, | 338 choices={'x86', 'x64'}, |
354 nargs='*', | 339 nargs='*', |
355 default=['x64'], | 340 default=['x64'], |
399 default=aws.WINDOWS_BASE_IMAGE_NAME, | 384 default=aws.WINDOWS_BASE_IMAGE_NAME, |
400 ) | 385 ) |
401 sp.set_defaults(func=build_windows_wheel) | 386 sp.set_defaults(func=build_windows_wheel) |
402 | 387 |
403 sp = subparsers.add_parser('build-wix', help='Build WiX installer(s)') | 388 sp = subparsers.add_parser('build-wix', help='Build WiX installer(s)') |
404 sp.add_argument( | |
405 '--python-version', | |
406 help='Which version of Python to target', | |
407 choices={3}, | |
408 type=int, | |
409 nargs='*', | |
410 default=[3], | |
411 ) | |
412 sp.add_argument( | 389 sp.add_argument( |
413 '--arch', | 390 '--arch', |
414 help='Architecture to build for', | 391 help='Architecture to build for', |
415 choices={'x86', 'x64'}, | 392 choices={'x86', 'x64'}, |
416 nargs='*', | 393 nargs='*', |