##// END OF EJS Templates
automation: support building Windows wheels for Python 3.7 and 3.8...
Gregory Szorc -
r45261:48096e26 default draft
parent child Browse files
Show More
@@ -99,7 +99,12 b' def build_wix('
99 99
100 100
101 101 def build_windows_wheel(
102 hga: HGAutomation, aws_region, arch, revision, base_image_name
102 hga: HGAutomation,
103 aws_region,
104 python_version,
105 arch,
106 revision,
107 base_image_name,
103 108 ):
104 109 c = hga.aws_connection(aws_region)
105 110 image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name)
@@ -110,8 +115,11 b' def build_windows_wheel('
110 115
111 116 windows.synchronize_hg(SOURCE_ROOT, revision, instance)
112 117
113 for a in arch:
114 windows.build_wheel(instance.winrm_client, a, DIST_PATH)
118 for py_version in python_version:
119 for a in arch:
120 windows.build_wheel(
121 instance.winrm_client, py_version, a, DIST_PATH
122 )
115 123
116 124
117 125 def build_all_windows_packages(
@@ -128,10 +136,18 b' def build_all_windows_packages('
128 136
129 137 windows.synchronize_hg(SOURCE_ROOT, revision, instance)
130 138
139 for py_version in ("2.7", "3.7", "3.8"):
140 for arch in ("x86", "x64"):
141 windows.purge_hg(winrm_client)
142 windows.build_wheel(
143 winrm_client,
144 python_version=py_version,
145 arch=arch,
146 dest_path=DIST_PATH,
147 )
148
131 149 for arch in ('x86', 'x64'):
132 150 windows.purge_hg(winrm_client)
133 windows.build_wheel(winrm_client, arch, DIST_PATH)
134 windows.purge_hg(winrm_client)
135 151 windows.build_inno_installer(
136 152 winrm_client, arch, DIST_PATH, version=version
137 153 )
@@ -316,6 +332,13 b' def get_parser():'
316 332 'build-windows-wheel', help='Build Windows wheel(s)',
317 333 )
318 334 sp.add_argument(
335 '--python-version',
336 help='Python version to build for',
337 choices={'2.7', '3.7', '3.8'},
338 nargs='*',
339 default=['3.8'],
340 )
341 sp.add_argument(
319 342 '--arch',
320 343 help='Architecture to build for',
321 344 choices={'x86', 'x64'},
@@ -79,7 +79,7 b' if ($LASTEXITCODE -ne 0) {{'
79 79
80 80 BUILD_WHEEL = r'''
81 81 Set-Location C:\hgdev\src
82 C:\hgdev\python27-{arch}\Scripts\pip.exe wheel --wheel-dir dist .
82 C:\hgdev\python{python_version}-{arch}\python.exe -m pip wheel --wheel-dir dist .
83 83 if ($LASTEXITCODE -ne 0) {{
84 84 throw "process exited non-0: $LASTEXITCODE"
85 85 }}
@@ -101,8 +101,13 b' if ($LASTEXITCODE -ne 0) {{'
101 101 }}
102 102 '''
103 103
104 X86_WHEEL_FILENAME = 'mercurial-{version}-cp27-cp27m-win32.whl'
105 X64_WHEEL_FILENAME = 'mercurial-{version}-cp27-cp27m-win_amd64.whl'
104 WHEEL_FILENAME_PYTHON27_X86 = 'mercurial-{version}-cp27-cp27m-win32.whl'
105 WHEEL_FILENAME_PYTHON27_X64 = 'mercurial-{version}-cp27-cp27m-win_amd64.whl'
106 WHEEL_FILENAME_PYTHON37_X86 = 'mercurial-{version}-cp37-cp37m-win32.whl'
107 WHEEL_FILENAME_PYTHON37_X64 = 'mercurial-{version}-cp37-cp37m-win_amd64.whl'
108 WHEEL_FILENAME_PYTHON38_X86 = 'mercurial-{version}-cp38-cp38-win32.whl'
109 WHEEL_FILENAME_PYTHON38_X64 = 'mercurial-{version}-cp38-cp38-win_amd64.whl'
110
106 111 X86_EXE_FILENAME = 'Mercurial-{version}.exe'
107 112 X64_EXE_FILENAME = 'Mercurial-{version}-x64.exe'
108 113 X86_MSI_FILENAME = 'mercurial-{version}-x86.msi'
@@ -300,14 +305,24 b' def build_inno_installer('
300 305 copy_latest_dist(winrm_client, '*.exe', dest_path)
301 306
302 307
303 def build_wheel(winrm_client, arch: str, dest_path: pathlib.Path):
308 def build_wheel(
309 winrm_client, python_version: str, arch: str, dest_path: pathlib.Path
310 ):
304 311 """Build Python wheels on a remote machine.
305 312
306 313 Using a WinRM client, remote commands are executed to build a Python wheel
307 314 for Mercurial.
308 315 """
309 print('Building Windows wheel for %s' % arch)
310 ps = get_vc_prefix(arch) + BUILD_WHEEL.format(arch=arch)
316 print('Building Windows wheel for Python %s %s' % (python_version, arch))
317
318 ps = BUILD_WHEEL.format(
319 python_version=python_version.replace(".", ""), arch=arch
320 )
321
322 # Python 2.7 requires an activated environment.
323 if python_version == "2.7":
324 ps = get_vc_prefix(arch) + ps
325
311 326 run_powershell(winrm_client, ps)
312 327 copy_latest_dist(winrm_client, '*.whl', dest_path)
313 328
@@ -356,15 +371,23 b' def run_tests(winrm_client, python_versi'
356 371
357 372 def resolve_wheel_artifacts(dist_path: pathlib.Path, version: str):
358 373 return (
359 dist_path / X86_WHEEL_FILENAME.format(version=version),
360 dist_path / X64_WHEEL_FILENAME.format(version=version),
374 dist_path / WHEEL_FILENAME_PYTHON27_X86.format(version=version),
375 dist_path / WHEEL_FILENAME_PYTHON27_X64.format(version=version),
376 dist_path / WHEEL_FILENAME_PYTHON37_X86.format(version=version),
377 dist_path / WHEEL_FILENAME_PYTHON37_X64.format(version=version),
378 dist_path / WHEEL_FILENAME_PYTHON38_X86.format(version=version),
379 dist_path / WHEEL_FILENAME_PYTHON38_X64.format(version=version),
361 380 )
362 381
363 382
364 383 def resolve_all_artifacts(dist_path: pathlib.Path, version: str):
365 384 return (
366 dist_path / X86_WHEEL_FILENAME.format(version=version),
367 dist_path / X64_WHEEL_FILENAME.format(version=version),
385 dist_path / WHEEL_FILENAME_PYTHON27_X86.format(version=version),
386 dist_path / WHEEL_FILENAME_PYTHON27_X64.format(version=version),
387 dist_path / WHEEL_FILENAME_PYTHON37_X86.format(version=version),
388 dist_path / WHEEL_FILENAME_PYTHON37_X64.format(version=version),
389 dist_path / WHEEL_FILENAME_PYTHON38_X86.format(version=version),
390 dist_path / WHEEL_FILENAME_PYTHON38_X64.format(version=version),
368 391 dist_path / X86_EXE_FILENAME.format(version=version),
369 392 dist_path / X64_EXE_FILENAME.format(version=version),
370 393 dist_path / X86_MSI_FILENAME.format(version=version),
General Comments 0
You need to be logged in to leave comments. Login now