Skip to content

Commit 83c5ecd

Browse files
authoredFeb 29, 2024
pythongh-108051: Update versions found by find_python.bat and clarify readme (pythonGH-116118)
1 parent 91c3c64 commit 83c5ecd

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed
 

‎PCbuild/find_python.bat

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
:begin_search
3030
@set PYTHON=
3131

32+
@rem If PYTHON_FOR_BUILD is set, use that
33+
@if NOT "%PYTHON_FOR_BUILD%"=="" @(set PYTHON="%PYTHON_FOR_BUILD%") && (set _Py_Python_Source=found as PYTHON_FOR_BUILD) && goto :found
34+
3235
@rem If there is an active virtual env, use that one
3336
@if NOT "%VIRTUAL_ENV%"=="" (set PYTHON="%VIRTUAL_ENV%\Scripts\python.exe") & (set _Py_Python_Source=found in virtual env) & goto :found
3437

@@ -42,7 +45,9 @@
4245
@if NOT "%HOST_PYTHON%"=="" @%HOST_PYTHON% -Ec "import sys; assert sys.version_info[:2] >= (3, 9)" >nul 2>nul && (set PYTHON="%HOST_PYTHON%") && (set _Py_Python_Source=found as HOST_PYTHON) && goto :found
4346

4447
@rem If py.exe finds a recent enough version, use that one
45-
@for %%p in (3.11 3.10 3.9) do @py -%%p -EV >nul 2>&1 && (set PYTHON=py -%%p) && (set _Py_Python_Source=found %%p with py.exe) && goto :found
48+
@rem It is fine to add new versions to this list when they have released,
49+
@rem but we do not use prerelease builds here.
50+
@for %%p in (3.12 3.11 3.10 3.9) do @py -%%p -EV >nul 2>&1 && (set PYTHON=py -%%p) && (set _Py_Python_Source=found %%p with py.exe) && goto :found
4651

4752
@if NOT exist "%_Py_EXTERNALS_DIR%" mkdir "%_Py_EXTERNALS_DIR%"
4853
@set _Py_NUGET=%NUGET%

‎PCbuild/readme.txt

+12-6
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,18 @@ directory. This script extracts all the external sub-projects from
226226
and
227227
https://github.com/python/cpython-bin-deps
228228
via a Python script called "get_external.py", located in this directory.
229-
If Python 3.6 or later is not available via the "py.exe" launcher, the
230-
path or command to use for Python can be provided in the PYTHON_FOR_BUILD
231-
environment variable, or get_externals.bat will download the latest
232-
version of NuGet and use it to download the latest "pythonx86" package
233-
for use with get_external.py. Everything downloaded by these scripts is
234-
stored in ..\externals (relative to this directory).
229+
Everything downloaded by these scripts is stored in ..\externals
230+
(relative to this directory), or the path specified by the EXTERNALS_DIR
231+
environment variable.
232+
233+
The path or command to use for Python can be provided with the
234+
PYTHON_FOR_BUILD environment variable. If this is not set, an active
235+
virtual environment will be used. If none is active, and HOST_PYTHON is
236+
set to a recent enough version or "py.exe" is able to find a recent
237+
enough version, those will be used. If all else fails, a copy of Python
238+
will be downloaded from NuGet and extracted to the externals directory.
239+
This will then be used for later builds (see PCbuild/find_python.bat
240+
for the full logic).
235241

236242
It is also possible to download sources from each project's homepage,
237243
though you may have to change folder names or pass the names to MSBuild

0 commit comments

Comments
 (0)
Please sign in to comment.