mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-135455: Fix version and architecture detection in PC/layout script. (GH-135461)
(cherry picked from commit afc5ab6cce)
Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
parent
c260ed15d1
commit
0430135aac
3 changed files with 95 additions and 12 deletions
|
|
@ -247,9 +247,15 @@ def in_build(f, dest="", new_name=None, no_lib=False):
|
|||
if ns.include_freethreaded:
|
||||
yield from in_build("venvlaunchert.exe", "Lib/venv/scripts/nt/")
|
||||
yield from in_build("venvwlaunchert.exe", "Lib/venv/scripts/nt/")
|
||||
else:
|
||||
elif (VER_MAJOR, VER_MINOR) > (3, 12):
|
||||
yield from in_build("venvlauncher.exe", "Lib/venv/scripts/nt/")
|
||||
yield from in_build("venvwlauncher.exe", "Lib/venv/scripts/nt/")
|
||||
else:
|
||||
# Older versions of venv expected the scripts to be named 'python'
|
||||
# and they were renamed at this stage. We need to replicate that
|
||||
# when packaging older versions.
|
||||
yield from in_build("venvlauncher.exe", "Lib/venv/scripts/nt/", "python")
|
||||
yield from in_build("venvwlauncher.exe", "Lib/venv/scripts/nt/", "pythonw")
|
||||
|
||||
if ns.include_tools:
|
||||
|
||||
|
|
@ -652,15 +658,6 @@ def main():
|
|||
ns.doc_build = (Path.cwd() / ns.doc_build).resolve()
|
||||
if ns.include_cat and not ns.include_cat.is_absolute():
|
||||
ns.include_cat = (Path.cwd() / ns.include_cat).resolve()
|
||||
if not ns.arch:
|
||||
# TODO: Calculate arch from files in ns.build instead
|
||||
if sys.winver.endswith("-arm64"):
|
||||
ns.arch = "arm64"
|
||||
elif sys.winver.endswith("-32"):
|
||||
ns.arch = "win32"
|
||||
else:
|
||||
ns.arch = "amd64"
|
||||
|
||||
if ns.zip and not ns.zip.is_absolute():
|
||||
ns.zip = (Path.cwd() / ns.zip).resolve()
|
||||
if ns.catalog and not ns.catalog.is_absolute():
|
||||
|
|
@ -668,6 +665,17 @@ def main():
|
|||
|
||||
configure_logger(ns)
|
||||
|
||||
if not ns.arch:
|
||||
from .support.arch import calculate_from_build_dir
|
||||
ns.arch = calculate_from_build_dir(ns.build)
|
||||
|
||||
expect = f"{VER_MAJOR}.{VER_MINOR}.{VER_MICRO}{VER_SUFFIX}"
|
||||
actual = check_patchlevel_version(ns.source)
|
||||
if actual and actual != expect:
|
||||
log_error(f"Inferred version {expect} does not match {actual} from patchlevel.h. "
|
||||
"You should set %PYTHONINCLUDE% or %PYTHON_HEXVERSION% before launching.")
|
||||
return 5
|
||||
|
||||
log_info(
|
||||
"""OPTIONS
|
||||
Source: {ns.source}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue