Show More
@@ -158,7 +158,7 b' def build_all_windows_packages(' | |||
|
158 | 158 | |
|
159 | 159 | windows.synchronize_hg(SOURCE_ROOT, revision, instance) |
|
160 | 160 | |
|
161 |
for py_version in ( |
|
|
161 | for py_version in ("3.7", "3.8", "3.9", "3.10"): | |
|
162 | 162 | for arch in ("x86", "x64"): |
|
163 | 163 | windows.purge_hg(winrm_client) |
|
164 | 164 | windows.build_wheel( |
@@ -342,7 +342,7 b' def get_parser():' | |||
|
342 | 342 | sp.add_argument( |
|
343 | 343 | '--python-version', |
|
344 | 344 | help='Which version of Python to target', |
|
345 |
choices={ |
|
|
345 | choices={3}, | |
|
346 | 346 | type=int, |
|
347 | 347 | nargs='*', |
|
348 | 348 | default=[3], |
@@ -377,7 +377,7 b' def get_parser():' | |||
|
377 | 377 | sp.add_argument( |
|
378 | 378 | '--python-version', |
|
379 | 379 | help='Python version to build for', |
|
380 |
choices={ |
|
|
380 | choices={'3.7', '3.8', '3.9', '3.10'}, | |
|
381 | 381 | nargs='*', |
|
382 | 382 | default=['3.8'], |
|
383 | 383 | ) |
@@ -404,7 +404,7 b' def get_parser():' | |||
|
404 | 404 | sp.add_argument( |
|
405 | 405 | '--python-version', |
|
406 | 406 | help='Which version of Python to target', |
|
407 |
choices={ |
|
|
407 | choices={3}, | |
|
408 | 408 | type=int, |
|
409 | 409 | nargs='*', |
|
410 | 410 | default=[3], |
@@ -499,8 +499,8 b' def get_parser():' | |||
|
499 | 499 | sp.add_argument( |
|
500 | 500 | '--python-version', |
|
501 | 501 | help='Python version to use', |
|
502 |
choices={ |
|
|
503 |
default=' |
|
|
502 | choices={'3.5', '3.6', '3.7', '3.8', '3.9', '3.10'}, | |
|
503 | default='3.9', | |
|
504 | 504 | ) |
|
505 | 505 | sp.add_argument( |
|
506 | 506 | '--arch', |
@@ -19,30 +19,6 b' from .pypi import upload as pypi_upload' | |||
|
19 | 19 | from .winrm import run_powershell |
|
20 | 20 | |
|
21 | 21 | |
|
22 | # PowerShell commands to activate a Visual Studio 2008 environment. | |
|
23 | # This is essentially a port of vcvarsall.bat to PowerShell. | |
|
24 | ACTIVATE_VC9_AMD64 = r''' | |
|
25 | Write-Output "activating Visual Studio 2008 environment for AMD64" | |
|
26 | $root = "$env:LOCALAPPDATA\Programs\Common\Microsoft\Visual C++ for Python\9.0" | |
|
27 | $Env:VCINSTALLDIR = "${root}\VC\" | |
|
28 | $Env:WindowsSdkDir = "${root}\WinSDK\" | |
|
29 | $Env:PATH = "${root}\VC\Bin\amd64;${root}\WinSDK\Bin\x64;${root}\WinSDK\Bin;$Env:PATH" | |
|
30 | $Env:INCLUDE = "${root}\VC\Include;${root}\WinSDK\Include;$Env:PATH" | |
|
31 | $Env:LIB = "${root}\VC\Lib\amd64;${root}\WinSDK\Lib\x64;$Env:LIB" | |
|
32 | $Env:LIBPATH = "${root}\VC\Lib\amd64;${root}\WinSDK\Lib\x64;$Env:LIBPATH" | |
|
33 | '''.lstrip() | |
|
34 | ||
|
35 | ACTIVATE_VC9_X86 = r''' | |
|
36 | Write-Output "activating Visual Studio 2008 environment for x86" | |
|
37 | $root = "$env:LOCALAPPDATA\Programs\Common\Microsoft\Visual C++ for Python\9.0" | |
|
38 | $Env:VCINSTALLDIR = "${root}\VC\" | |
|
39 | $Env:WindowsSdkDir = "${root}\WinSDK\" | |
|
40 | $Env:PATH = "${root}\VC\Bin;${root}\WinSDK\Bin;$Env:PATH" | |
|
41 | $Env:INCLUDE = "${root}\VC\Include;${root}\WinSDK\Include;$Env:INCLUDE" | |
|
42 | $Env:LIB = "${root}\VC\Lib;${root}\WinSDK\Lib;$Env:LIB" | |
|
43 | $Env:LIBPATH = "${root}\VC\lib;${root}\WinSDK\Lib;$Env:LIBPATH" | |
|
44 | '''.lstrip() | |
|
45 | ||
|
46 | 22 | HG_PURGE = r''' |
|
47 | 23 | $Env:PATH = "C:\hgdev\venv-bootstrap\Scripts;$Env:PATH" |
|
48 | 24 | Set-Location C:\hgdev\src |
@@ -78,14 +54,6 b' if ($LASTEXITCODE -ne 0) {{' | |||
|
78 | 54 | }} |
|
79 | 55 | ''' |
|
80 | 56 | |
|
81 | BUILD_INNO_PYTHON2 = r''' | |
|
82 | Set-Location C:\hgdev\src | |
|
83 | $python = "C:\hgdev\python27-{arch}\python.exe" | |
|
84 | C:\hgdev\python37-x64\python.exe contrib\packaging\packaging.py inno --python $python {extra_args} | |
|
85 | if ($LASTEXITCODE -ne 0) {{ | |
|
86 | throw "process exited non-0: $LASTEXITCODE" | |
|
87 | }} | |
|
88 | '''.lstrip() | |
|
89 | 57 | |
|
90 | 58 | BUILD_WHEEL = r''' |
|
91 | 59 | Set-Location C:\hgdev\src |
@@ -105,14 +73,6 b' if ($LASTEXITCODE -ne 0) {{' | |||
|
105 | 73 | }} |
|
106 | 74 | ''' |
|
107 | 75 | |
|
108 | BUILD_WIX_PYTHON2 = r''' | |
|
109 | Set-Location C:\hgdev\src | |
|
110 | $python = "C:\hgdev\python27-{arch}\python.exe" | |
|
111 | C:\hgdev\python37-x64\python.exe contrib\packaging\packaging.py wix --python $python {extra_args} | |
|
112 | if ($LASTEXITCODE -ne 0) {{ | |
|
113 | throw "process exited non-0: $LASTEXITCODE" | |
|
114 | }} | |
|
115 | ''' | |
|
116 | 76 | |
|
117 | 77 | RUN_TESTS = r''' |
|
118 | 78 | C:\hgdev\MinGW\msys\1.0\bin\sh.exe --login -c "cd /c/hgdev/src/tests && /c/hgdev/{python_path}/python.exe run-tests.py {test_flags}" |
@@ -121,8 +81,7 b' if ($LASTEXITCODE -ne 0) {{' | |||
|
121 | 81 | }} |
|
122 | 82 | ''' |
|
123 | 83 | |
|
124 | WHEEL_FILENAME_PYTHON27_X86 = 'mercurial-{version}-cp27-cp27m-win32.whl' | |
|
125 | WHEEL_FILENAME_PYTHON27_X64 = 'mercurial-{version}-cp27-cp27m-win_amd64.whl' | |
|
84 | ||
|
126 | 85 | WHEEL_FILENAME_PYTHON37_X86 = 'mercurial-{version}-cp37-cp37m-win32.whl' |
|
127 | 86 | WHEEL_FILENAME_PYTHON37_X64 = 'mercurial-{version}-cp37-cp37m-win_amd64.whl' |
|
128 | 87 | WHEEL_FILENAME_PYTHON38_X86 = 'mercurial-{version}-cp38-cp38-win32.whl' |
@@ -132,13 +91,9 b" WHEEL_FILENAME_PYTHON39_X64 = 'mercurial" | |||
|
132 | 91 | WHEEL_FILENAME_PYTHON310_X86 = 'mercurial-{version}-cp310-cp310-win32.whl' |
|
133 | 92 | WHEEL_FILENAME_PYTHON310_X64 = 'mercurial-{version}-cp310-cp310-win_amd64.whl' |
|
134 | 93 | |
|
135 | EXE_FILENAME_PYTHON2_X86 = 'Mercurial-{version}-x86-python2.exe' | |
|
136 | EXE_FILENAME_PYTHON2_X64 = 'Mercurial-{version}-x64-python2.exe' | |
|
137 | 94 | EXE_FILENAME_PYTHON3_X86 = 'Mercurial-{version}-x86.exe' |
|
138 | 95 | EXE_FILENAME_PYTHON3_X64 = 'Mercurial-{version}-x64.exe' |
|
139 | 96 | |
|
140 | MSI_FILENAME_PYTHON2_X86 = 'mercurial-{version}-x86-python2.msi' | |
|
141 | MSI_FILENAME_PYTHON2_X64 = 'mercurial-{version}-x64-python2.msi' | |
|
142 | 97 | MSI_FILENAME_PYTHON3_X86 = 'mercurial-{version}-x86.msi' |
|
143 | 98 | MSI_FILENAME_PYTHON3_X64 = 'mercurial-{version}-x64.msi' |
|
144 | 99 | |
@@ -147,14 +102,6 b" MERCURIAL_SCM_BASE_URL = 'https://mercur" | |||
|
147 | 102 | X86_USER_AGENT_PATTERN = '.*Windows.*' |
|
148 | 103 | X64_USER_AGENT_PATTERN = '.*Windows.*(WOW|x)64.*' |
|
149 | 104 | |
|
150 | EXE_PYTHON2_X86_DESCRIPTION = ( | |
|
151 | 'Mercurial {version} Inno Setup installer - x86 Windows (Python 2) ' | |
|
152 | '- does not require admin rights' | |
|
153 | ) | |
|
154 | EXE_PYTHON2_X64_DESCRIPTION = ( | |
|
155 | 'Mercurial {version} Inno Setup installer - x64 Windows (Python 2) ' | |
|
156 | '- does not require admin rights' | |
|
157 | ) | |
|
158 | 105 | # TODO remove Python version once Python 2 is dropped. |
|
159 | 106 | EXE_PYTHON3_X86_DESCRIPTION = ( |
|
160 | 107 | 'Mercurial {version} Inno Setup installer - x86 Windows (Python 3) ' |
@@ -164,14 +111,6 b' EXE_PYTHON3_X64_DESCRIPTION = (' | |||
|
164 | 111 | 'Mercurial {version} Inno Setup installer - x64 Windows (Python 3) ' |
|
165 | 112 | '- does not require admin rights' |
|
166 | 113 | ) |
|
167 | MSI_PYTHON2_X86_DESCRIPTION = ( | |
|
168 | 'Mercurial {version} MSI installer - x86 Windows (Python 2) ' | |
|
169 | '- requires admin rights' | |
|
170 | ) | |
|
171 | MSI_PYTHON2_X64_DESCRIPTION = ( | |
|
172 | 'Mercurial {version} MSI installer - x64 Windows (Python 2) ' | |
|
173 | '- requires admin rights' | |
|
174 | ) | |
|
175 | 114 | MSI_PYTHON3_X86_DESCRIPTION = ( |
|
176 | 115 | 'Mercurial {version} MSI installer - x86 Windows (Python 3) ' |
|
177 | 116 | '- requires admin rights' |
@@ -182,15 +121,6 b' MSI_PYTHON3_X64_DESCRIPTION = (' | |||
|
182 | 121 | ) |
|
183 | 122 | |
|
184 | 123 | |
|
185 | def get_vc_prefix(arch): | |
|
186 | if arch == 'x86': | |
|
187 | return ACTIVATE_VC9_X86 | |
|
188 | elif arch == 'x64': | |
|
189 | return ACTIVATE_VC9_AMD64 | |
|
190 | else: | |
|
191 | raise ValueError('illegal arch: %s; must be x86 or x64' % arch) | |
|
192 | ||
|
193 | ||
|
194 | 124 | def fix_authorized_keys_permissions(winrm_client, path): |
|
195 | 125 | commands = [ |
|
196 | 126 | '$ErrorActionPreference = "Stop"', |
@@ -349,32 +279,21 b' def build_inno_installer(' | |||
|
349 | 279 | % (python_version, arch) |
|
350 | 280 | ) |
|
351 | 281 | |
|
352 | if python_version == 3: | |
|
353 | # TODO fix this limitation in packaging code | |
|
354 | if not version: | |
|
355 | raise Exception( | |
|
356 | "version string is required when building for Python 3" | |
|
357 | ) | |
|
282 | # TODO fix this limitation in packaging code | |
|
283 | if not version: | |
|
284 | raise Exception("version string is required when building for Python 3") | |
|
358 | 285 | |
|
359 |
|
|
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
|
363 |
|
|
|
364 |
|
|
|
286 | if arch == "x86": | |
|
287 | target_triple = "i686-pc-windows-msvc" | |
|
288 | elif arch == "x64": | |
|
289 | target_triple = "x86_64-pc-windows-msvc" | |
|
290 | else: | |
|
291 | raise Exception("unhandled arch: %s" % arch) | |
|
365 | 292 | |
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 | else: | |
|
371 | extra_args = [] | |
|
372 | if version: | |
|
373 | extra_args.extend(['--version', version]) | |
|
374 | ||
|
375 | ps = get_vc_prefix(arch) + BUILD_INNO_PYTHON2.format( | |
|
376 | arch=arch, extra_args=' '.join(extra_args) | |
|
377 | ) | |
|
293 | ps = BUILD_INNO_PYTHON3.format( | |
|
294 | pyoxidizer_target=target_triple, | |
|
295 | version=version, | |
|
296 | ) | |
|
378 | 297 | |
|
379 | 298 | run_powershell(winrm_client, ps) |
|
380 | 299 | copy_latest_dist(winrm_client, '*.exe', dest_path) |
@@ -394,10 +313,6 b' def build_wheel(' | |||
|
394 | 313 | python_version=python_version.replace(".", ""), arch=arch |
|
395 | 314 | ) |
|
396 | 315 | |
|
397 | # Python 2.7 requires an activated environment. | |
|
398 | if python_version == "2.7": | |
|
399 | ps = get_vc_prefix(arch) + ps | |
|
400 | ||
|
401 | 316 | run_powershell(winrm_client, ps) |
|
402 | 317 | copy_latest_dist(winrm_client, '*.whl', dest_path) |
|
403 | 318 | |
@@ -415,32 +330,21 b' def build_wix_installer(' | |||
|
415 | 330 | """ |
|
416 | 331 | print('Building WiX installer for Python %d %s' % (python_version, arch)) |
|
417 | 332 | |
|
418 | if python_version == 3: | |
|
419 | # TODO fix this limitation in packaging code | |
|
420 | if not version: | |
|
421 | raise Exception( | |
|
422 | "version string is required when building for Python 3" | |
|
423 | ) | |
|
333 | # TODO fix this limitation in packaging code | |
|
334 | if not version: | |
|
335 | raise Exception("version string is required when building for Python 3") | |
|
424 | 336 | |
|
425 |
|
|
|
426 |
|
|
|
427 |
|
|
|
428 |
|
|
|
429 |
|
|
|
430 |
|
|
|
337 | if arch == "x86": | |
|
338 | target_triple = "i686-pc-windows-msvc" | |
|
339 | elif arch == "x64": | |
|
340 | target_triple = "x86_64-pc-windows-msvc" | |
|
341 | else: | |
|
342 | raise Exception("unhandled arch: %s" % arch) | |
|
431 | 343 | |
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
|
|
|
436 | else: | |
|
437 | extra_args = [] | |
|
438 | if version: | |
|
439 | extra_args.extend(['--version', version]) | |
|
440 | ||
|
441 | ps = get_vc_prefix(arch) + BUILD_WIX_PYTHON2.format( | |
|
442 | arch=arch, extra_args=' '.join(extra_args) | |
|
443 | ) | |
|
344 | ps = BUILD_WIX_PYTHON3.format( | |
|
345 | pyoxidizer_target=target_triple, | |
|
346 | version=version, | |
|
347 | ) | |
|
444 | 348 | |
|
445 | 349 | run_powershell(winrm_client, ps) |
|
446 | 350 | copy_latest_dist(winrm_client, '*.msi', dest_path) |
@@ -474,8 +378,6 b' def run_tests(winrm_client, python_versi' | |||
|
474 | 378 | |
|
475 | 379 | def resolve_wheel_artifacts(dist_path: pathlib.Path, version: str): |
|
476 | 380 | return ( |
|
477 | dist_path / WHEEL_FILENAME_PYTHON27_X86.format(version=version), | |
|
478 | dist_path / WHEEL_FILENAME_PYTHON27_X64.format(version=version), | |
|
479 | 381 | dist_path / WHEEL_FILENAME_PYTHON37_X86.format(version=version), |
|
480 | 382 | dist_path / WHEEL_FILENAME_PYTHON37_X64.format(version=version), |
|
481 | 383 | dist_path / WHEEL_FILENAME_PYTHON38_X86.format(version=version), |
@@ -489,8 +391,6 b' def resolve_wheel_artifacts(dist_path: p' | |||
|
489 | 391 | |
|
490 | 392 | def resolve_all_artifacts(dist_path: pathlib.Path, version: str): |
|
491 | 393 | return ( |
|
492 | dist_path / WHEEL_FILENAME_PYTHON27_X86.format(version=version), | |
|
493 | dist_path / WHEEL_FILENAME_PYTHON27_X64.format(version=version), | |
|
494 | 394 | dist_path / WHEEL_FILENAME_PYTHON37_X86.format(version=version), |
|
495 | 395 | dist_path / WHEEL_FILENAME_PYTHON37_X64.format(version=version), |
|
496 | 396 | dist_path / WHEEL_FILENAME_PYTHON38_X86.format(version=version), |
@@ -499,24 +399,16 b' def resolve_all_artifacts(dist_path: pat' | |||
|
499 | 399 | dist_path / WHEEL_FILENAME_PYTHON39_X64.format(version=version), |
|
500 | 400 | dist_path / WHEEL_FILENAME_PYTHON310_X86.format(version=version), |
|
501 | 401 | dist_path / WHEEL_FILENAME_PYTHON310_X64.format(version=version), |
|
502 | dist_path / EXE_FILENAME_PYTHON2_X86.format(version=version), | |
|
503 | dist_path / EXE_FILENAME_PYTHON2_X64.format(version=version), | |
|
504 | 402 | dist_path / EXE_FILENAME_PYTHON3_X86.format(version=version), |
|
505 | 403 | dist_path / EXE_FILENAME_PYTHON3_X64.format(version=version), |
|
506 | dist_path / MSI_FILENAME_PYTHON2_X86.format(version=version), | |
|
507 | dist_path / MSI_FILENAME_PYTHON2_X64.format(version=version), | |
|
508 | 404 | dist_path / MSI_FILENAME_PYTHON3_X86.format(version=version), |
|
509 | 405 | dist_path / MSI_FILENAME_PYTHON3_X64.format(version=version), |
|
510 | 406 | ) |
|
511 | 407 | |
|
512 | 408 | |
|
513 | 409 | def generate_latest_dat(version: str): |
|
514 | python2_x86_exe_filename = EXE_FILENAME_PYTHON2_X86.format(version=version) | |
|
515 | python2_x64_exe_filename = EXE_FILENAME_PYTHON2_X64.format(version=version) | |
|
516 | 410 | python3_x86_exe_filename = EXE_FILENAME_PYTHON3_X86.format(version=version) |
|
517 | 411 | python3_x64_exe_filename = EXE_FILENAME_PYTHON3_X64.format(version=version) |
|
518 | python2_x86_msi_filename = MSI_FILENAME_PYTHON2_X86.format(version=version) | |
|
519 | python2_x64_msi_filename = MSI_FILENAME_PYTHON2_X64.format(version=version) | |
|
520 | 412 | python3_x86_msi_filename = MSI_FILENAME_PYTHON3_X86.format(version=version) |
|
521 | 413 | python3_x64_msi_filename = MSI_FILENAME_PYTHON3_X64.format(version=version) |
|
522 | 414 | |
@@ -536,20 +428,6 b' def generate_latest_dat(version: str):' | |||
|
536 | 428 | EXE_PYTHON3_X64_DESCRIPTION.format(version=version), |
|
537 | 429 | ), |
|
538 | 430 | ( |
|
539 | '9', | |
|
540 | version, | |
|
541 | X86_USER_AGENT_PATTERN, | |
|
542 | '%s/%s' % (MERCURIAL_SCM_BASE_URL, python2_x86_exe_filename), | |
|
543 | EXE_PYTHON2_X86_DESCRIPTION.format(version=version), | |
|
544 | ), | |
|
545 | ( | |
|
546 | '9', | |
|
547 | version, | |
|
548 | X64_USER_AGENT_PATTERN, | |
|
549 | '%s/%s' % (MERCURIAL_SCM_BASE_URL, python2_x64_exe_filename), | |
|
550 | EXE_PYTHON2_X64_DESCRIPTION.format(version=version), | |
|
551 | ), | |
|
552 | ( | |
|
553 | 431 | '10', |
|
554 | 432 | version, |
|
555 | 433 | X86_USER_AGENT_PATTERN, |
@@ -563,20 +441,6 b' def generate_latest_dat(version: str):' | |||
|
563 | 441 | '%s/%s' % (MERCURIAL_SCM_BASE_URL, python3_x64_msi_filename), |
|
564 | 442 | MSI_PYTHON3_X64_DESCRIPTION.format(version=version), |
|
565 | 443 | ), |
|
566 | ( | |
|
567 | '9', | |
|
568 | version, | |
|
569 | X86_USER_AGENT_PATTERN, | |
|
570 | '%s/%s' % (MERCURIAL_SCM_BASE_URL, python2_x86_msi_filename), | |
|
571 | MSI_PYTHON2_X86_DESCRIPTION.format(version=version), | |
|
572 | ), | |
|
573 | ( | |
|
574 | '9', | |
|
575 | version, | |
|
576 | X64_USER_AGENT_PATTERN, | |
|
577 | '%s/%s' % (MERCURIAL_SCM_BASE_URL, python2_x64_msi_filename), | |
|
578 | MSI_PYTHON2_X64_DESCRIPTION.format(version=version), | |
|
579 | ), | |
|
580 | 444 | ) |
|
581 | 445 | |
|
582 | 446 | lines = ['\t'.join(e) for e in entries] |
General Comments 0
You need to be logged in to leave comments.
Login now