bpo-33125: Add support for building and releasing Windows ARM64 packa… · python/cpython@c9f480d (original) (raw)
`@@ -285,14 +285,13 @@ def _compile_one_py(src, dest, name, optimize, checked=True):
`
285
285
`log_warning("Failed to compile {}", src)
`
286
286
`return None
`
287
287
``
``
288
+
288
289
`# name argument added to address bpo-37641
`
289
290
`def _py_temp_compile(src, name, ns, dest_dir=None, checked=True):
`
290
291
`if not ns.precompile or src not in PY_FILES or src.parent in DATA_DIRS:
`
291
292
`return None
`
292
293
`dest = (dest_dir or ns.temp) / (src.stem + ".pyc")
`
293
``
`-
return _compile_one_py(
`
294
``
`-
src, dest, name, optimize=2, checked=checked
`
295
``
`-
)
`
``
294
`+
return _compile_one_py(src, dest, name, optimize=2, checked=checked)
`
296
295
``
297
296
``
298
297
`def _write_to_zip(zf, dest, src, ns, checked=True):
`
`@@ -496,6 +495,13 @@ def main():
`
496
495
`parser.add_argument(
`
497
496
`"-b", "--build", metavar="dir", help="Specify the build directory", type=Path
`
498
497
` )
`
``
498
`+
parser.add_argument(
`
``
499
`+
"--arch",
`
``
500
`+
metavar="architecture",
`
``
501
`+
help="Specify the target architecture",
`
``
502
`+
type=str,
`
``
503
`+
default=None,
`
``
504
`+
)
`
499
505
`parser.add_argument(
`
500
506
`"--doc-build",
`
501
507
`metavar="dir",
`
`@@ -587,6 +593,8 @@ def main():
`
587
593
`ns.doc_build = (Path.cwd() / ns.doc_build).resolve()
`
588
594
`if ns.include_cat and not ns.include_cat.is_absolute():
`
589
595
`ns.include_cat = (Path.cwd() / ns.include_cat).resolve()
`
``
596
`+
if not ns.arch:
`
``
597
`+
ns.arch = "amd64" if sys.maxsize > 2 ** 32 else "win32"
`
590
598
``
591
599
`if ns.copy and not ns.copy.is_absolute():
`
592
600
`ns.copy = (Path.cwd() / ns.copy).resolve()
`
`@@ -602,13 +610,23 @@ def main():
`
602
610
`Source: {ns.source}
`
603
611
`Build: {ns.build}
`
604
612
`Temp: {ns.temp}
`
``
613
`+
Arch: {ns.arch}
`
605
614
``
606
615
`Copy to: {ns.copy}
`
607
616
`Zip to: {ns.zip}
`
608
617
`Catalog: {ns.catalog}""",
`
609
618
`ns=ns,
`
610
619
` )
`
611
620
``
``
621
`+
if ns.arch not in ("win32", "amd64", "arm32", "arm64"):
`
``
622
`+
log_error("--arch is not a valid value (win32, amd64, arm32, arm64)")
`
``
623
`+
return 4
`
``
624
`+
if ns.arch in ("arm32", "arm64"):
`
``
625
`+
for n in ("include_idle", "include_tcltk"):
`
``
626
`+
if getattr(ns, n):
`
``
627
`+
log_warning(f"Disabling --{n.replace('_', '-')} on unsupported platform")
`
``
628
`+
setattr(ns, n, False)
`
``
629
+
612
630
`if ns.include_idle and not ns.include_tcltk:
`
613
631
`log_warning("Assuming --include-tcltk to support --include-idle")
`
614
632
`ns.include_tcltk = True
`