Show More
@@ -99,7 +99,12 def build_wix( | |||||
99 |
|
99 | |||
100 |
|
100 | |||
101 | def build_windows_wheel( |
|
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 | c = hga.aws_connection(aws_region) |
|
109 | c = hga.aws_connection(aws_region) | |
105 | image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) |
|
110 | image = aws.ensure_windows_dev_ami(c, base_image_name=base_image_name) | |
@@ -110,8 +115,11 def build_windows_wheel( | |||||
110 |
|
115 | |||
111 | windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
|
116 | windows.synchronize_hg(SOURCE_ROOT, revision, instance) | |
112 |
|
117 | |||
|
118 | for py_version in python_version: | |||
113 | for a in arch: |
|
119 | for a in arch: | |
114 |
windows.build_wheel( |
|
120 | windows.build_wheel( | |
|
121 | instance.winrm_client, py_version, a, DIST_PATH | |||
|
122 | ) | |||
115 |
|
123 | |||
116 |
|
124 | |||
117 | def build_all_windows_packages( |
|
125 | def build_all_windows_packages( | |
@@ -128,9 +136,17 def build_all_windows_packages( | |||||
128 |
|
136 | |||
129 | windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
|
137 | windows.synchronize_hg(SOURCE_ROOT, revision, instance) | |
130 |
|
138 | |||
131 | for arch in ('x86', 'x64'): |
|
139 | for py_version in ("2.7", "3.7", "3.8"): | |
|
140 | for arch in ("x86", "x64"): | |||
132 | windows.purge_hg(winrm_client) |
|
141 | windows.purge_hg(winrm_client) | |
133 |
windows.build_wheel( |
|
142 | windows.build_wheel( | |
|
143 | winrm_client, | |||
|
144 | python_version=py_version, | |||
|
145 | arch=arch, | |||
|
146 | dest_path=DIST_PATH, | |||
|
147 | ) | |||
|
148 | ||||
|
149 | for arch in ('x86', 'x64'): | |||
134 | windows.purge_hg(winrm_client) |
|
150 | windows.purge_hg(winrm_client) | |
135 | windows.build_inno_installer( |
|
151 | windows.build_inno_installer( | |
136 | winrm_client, arch, DIST_PATH, version=version |
|
152 | winrm_client, arch, DIST_PATH, version=version | |
@@ -316,6 +332,13 def get_parser(): | |||||
316 | 'build-windows-wheel', help='Build Windows wheel(s)', |
|
332 | 'build-windows-wheel', help='Build Windows wheel(s)', | |
317 | ) |
|
333 | ) | |
318 | sp.add_argument( |
|
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 | '--arch', |
|
342 | '--arch', | |
320 | help='Architecture to build for', |
|
343 | help='Architecture to build for', | |
321 | choices={'x86', 'x64'}, |
|
344 | choices={'x86', 'x64'}, |
@@ -79,7 +79,7 if ($LASTEXITCODE -ne 0) {{ | |||||
79 |
|
79 | |||
80 | BUILD_WHEEL = r''' |
|
80 | BUILD_WHEEL = r''' | |
81 | Set-Location C:\hgdev\src |
|
81 | Set-Location C:\hgdev\src | |
82 |
C:\hgdev\python |
|
82 | C:\hgdev\python{python_version}-{arch}\python.exe -m pip wheel --wheel-dir dist . | |
83 | if ($LASTEXITCODE -ne 0) {{ |
|
83 | if ($LASTEXITCODE -ne 0) {{ | |
84 | throw "process exited non-0: $LASTEXITCODE" |
|
84 | throw "process exited non-0: $LASTEXITCODE" | |
85 | }} |
|
85 | }} | |
@@ -101,8 +101,13 if ($LASTEXITCODE -ne 0) {{ | |||||
101 | }} |
|
101 | }} | |
102 | ''' |
|
102 | ''' | |
103 |
|
103 | |||
104 |
|
|
104 | WHEEL_FILENAME_PYTHON27_X86 = 'mercurial-{version}-cp27-cp27m-win32.whl' | |
105 |
|
|
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 | X86_EXE_FILENAME = 'Mercurial-{version}.exe' |
|
111 | X86_EXE_FILENAME = 'Mercurial-{version}.exe' | |
107 | X64_EXE_FILENAME = 'Mercurial-{version}-x64.exe' |
|
112 | X64_EXE_FILENAME = 'Mercurial-{version}-x64.exe' | |
108 | X86_MSI_FILENAME = 'mercurial-{version}-x86.msi' |
|
113 | X86_MSI_FILENAME = 'mercurial-{version}-x86.msi' | |
@@ -300,14 +305,24 def build_inno_installer( | |||||
300 | copy_latest_dist(winrm_client, '*.exe', dest_path) |
|
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 | """Build Python wheels on a remote machine. |
|
311 | """Build Python wheels on a remote machine. | |
305 |
|
312 | |||
306 | Using a WinRM client, remote commands are executed to build a Python wheel |
|
313 | Using a WinRM client, remote commands are executed to build a Python wheel | |
307 | for Mercurial. |
|
314 | for Mercurial. | |
308 | """ |
|
315 | """ | |
309 | print('Building Windows wheel for %s' % arch) |
|
316 | print('Building Windows wheel for Python %s %s' % (python_version, arch)) | |
310 | ps = get_vc_prefix(arch) + BUILD_WHEEL.format(arch=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 | run_powershell(winrm_client, ps) |
|
326 | run_powershell(winrm_client, ps) | |
312 | copy_latest_dist(winrm_client, '*.whl', dest_path) |
|
327 | copy_latest_dist(winrm_client, '*.whl', dest_path) | |
313 |
|
328 | |||
@@ -356,15 +371,23 def run_tests(winrm_client, python_versi | |||||
356 |
|
371 | |||
357 | def resolve_wheel_artifacts(dist_path: pathlib.Path, version: str): |
|
372 | def resolve_wheel_artifacts(dist_path: pathlib.Path, version: str): | |
358 | return ( |
|
373 | return ( | |
359 |
dist_path / |
|
374 | dist_path / WHEEL_FILENAME_PYTHON27_X86.format(version=version), | |
360 |
dist_path / |
|
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 | def resolve_all_artifacts(dist_path: pathlib.Path, version: str): |
|
383 | def resolve_all_artifacts(dist_path: pathlib.Path, version: str): | |
365 | return ( |
|
384 | return ( | |
366 |
dist_path / |
|
385 | dist_path / WHEEL_FILENAME_PYTHON27_X86.format(version=version), | |
367 |
dist_path / |
|
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 | dist_path / X86_EXE_FILENAME.format(version=version), |
|
391 | dist_path / X86_EXE_FILENAME.format(version=version), | |
369 | dist_path / X64_EXE_FILENAME.format(version=version), |
|
392 | dist_path / X64_EXE_FILENAME.format(version=version), | |
370 | dist_path / X86_MSI_FILENAME.format(version=version), |
|
393 | dist_path / X86_MSI_FILENAME.format(version=version), |
General Comments 0
You need to be logged in to leave comments.
Login now