@@ -247,9 +247,15 @@ def in_build(f, dest="", new_name=None, no_lib=False):
247
247
if ns .include_freethreaded :
248
248
yield from in_build ("venvlaunchert.exe" , "Lib/venv/scripts/nt/" )
249
249
yield from in_build ("venvwlaunchert.exe" , "Lib/venv/scripts/nt/" )
250
- else :
250
+ elif ( VER_MAJOR , VER_MINOR ) > ( 3 , 12 ) :
251
251
yield from in_build ("venvlauncher.exe" , "Lib/venv/scripts/nt/" )
252
252
yield from in_build ("venvwlauncher.exe" , "Lib/venv/scripts/nt/" )
253
+ else :
254
+ # Older versions of venv expected the scripts to be named 'python'
255
+ # and they were renamed at this stage. We need to replicate that
256
+ # when packaging older versions.
257
+ yield from in_build ("venvlauncher.exe" , "Lib/venv/scripts/nt/" , "python" )
258
+ yield from in_build ("venvwlauncher.exe" , "Lib/venv/scripts/nt/" , "pythonw" )
253
259
254
260
if ns .include_tools :
255
261
@@ -652,22 +658,24 @@ def main():
652
658
ns .doc_build = (Path .cwd () / ns .doc_build ).resolve ()
653
659
if ns .include_cat and not ns .include_cat .is_absolute ():
654
660
ns .include_cat = (Path .cwd () / ns .include_cat ).resolve ()
655
- if not ns .arch :
656
- # TODO: Calculate arch from files in ns.build instead
657
- if sys .winver .endswith ("-arm64" ):
658
- ns .arch = "arm64"
659
- elif sys .winver .endswith ("-32" ):
660
- ns .arch = "win32"
661
- else :
662
- ns .arch = "amd64"
663
-
664
661
if ns .zip and not ns .zip .is_absolute ():
665
662
ns .zip = (Path .cwd () / ns .zip ).resolve ()
666
663
if ns .catalog and not ns .catalog .is_absolute ():
667
664
ns .catalog = (Path .cwd () / ns .catalog ).resolve ()
668
665
669
666
configure_logger (ns )
670
667
668
+ if not ns .arch :
669
+ from .support .arch import calculate_from_build_dir
670
+ ns .arch = calculate_from_build_dir (ns .build )
671
+
672
+ expect = f"{ VER_MAJOR } .{ VER_MINOR } .{ VER_MICRO } { VER_SUFFIX } "
673
+ actual = check_patchlevel_version (ns .source )
674
+ if actual and actual != expect :
675
+ log_error (f"Inferred version { expect } does not match { actual } from patchlevel.h. "
676
+ "You should set %PYTHONINCLUDE% or %PYTHON_HEXVERSION% before launching." )
677
+ return 5
678
+
671
679
log_info (
672
680
"""OPTIONS
673
681
Source: {ns.source}
0 commit comments