[Python-checkins] bpo-38809: Windows build scripts use python.exe from virtual envs (GH-17164)

Miss Islington (bot) webhook-mailer at python.org
Mon Nov 18 12:53:25 EST 2019


https://github.com/python/cpython/commit/cbbf1098f383e575d93841e555329eb66283c2f1
commit: cbbf1098f383e575d93841e555329eb66283c2f1
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-11-18T09:53:21-08:00
summary:

bpo-38809: Windows build scripts use python.exe from virtual envs (GH-17164)


https://bugs.python.org/issue38809
(cherry picked from commit ee703cbb418b7458bebb1d26a5e19d6b55280b28)

Co-authored-by: Tal Einat <taleinat+github at gmail.com>

files:
A Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst
M PCbuild/find_python.bat

diff --git a/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst b/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst
new file mode 100644
index 0000000000000..10eaf844e8aaf
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2019-11-15-09-25-44.bpo-38809.9jwta6.rst
@@ -0,0 +1,2 @@
+On Windows, build scripts will now recognize and use python.exe from an
+active virtual env.
diff --git a/PCbuild/find_python.bat b/PCbuild/find_python.bat
index d5c787fd77aa4..40937a67c33ac 100644
--- a/PCbuild/find_python.bat
+++ b/PCbuild/find_python.bat
@@ -24,6 +24,9 @@
 :begin_search
 @set PYTHON=
 
+ at rem If there is an active virtual env, use that one
+ at if NOT "%VIRTUAL_ENV%"=="" (set PYTHON="%VIRTUAL_ENV%\Scripts\python.exe") & (set _Py_Python_Source=found in virtual env) & goto :found
+
 @set _Py_EXTERNALS_DIR=%EXTERNALS_DIR%
 @if "%_Py_EXTERNALS_DIR%"=="" (set _Py_EXTERNALS_DIR=%~dp0\..\externals)
 



More information about the Python-checkins mailing list