summaryrefslogtreecommitdiff
path: root/Lib/venv
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2019-03-21 10:04:21 -0700
committerGitHub <noreply@github.com>2019-03-21 10:04:21 -0700
commit8bba81fd55873148c65b7d0e6a6effbd63048c76 (patch)
treedcf33cf11d17ac5d0c3a157ef682c7d72a8a9943 /Lib/venv
parent7ee88bf3e59493137a775368165c5c5fe1ed7f46 (diff)
downloadcpython-git-8bba81fd55873148c65b7d0e6a6effbd63048c76.tar.gz
bpo-35978: Correctly skips venv tests in venvs (GH-12220)
Also fixes venvs from the build directory on Windows.
Diffstat (limited to 'Lib/venv')
-rw-r--r--Lib/venv/__init__.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
index a309b861c5..5e6d375e95 100644
--- a/Lib/venv/__init__.py
+++ b/Lib/venv/__init__.py
@@ -178,18 +178,23 @@ class EnvBuilder:
# On Windows, we rewrite symlinks to our base python.exe into
# copies of venvlauncher.exe
basename, ext = os.path.splitext(os.path.basename(src))
- if basename.endswith('_d'):
- ext = '_d' + ext
- basename = basename[:-2]
- if sysconfig.is_python_build(True):
+ srcfn = os.path.join(os.path.dirname(__file__),
+ "scripts",
+ "nt",
+ basename + ext)
+ # Builds or venv's from builds need to remap source file
+ # locations, as we do not put them into Lib/venv/scripts
+ if sysconfig.is_python_build(True) or not os.path.isfile(srcfn):
+ if basename.endswith('_d'):
+ ext = '_d' + ext
+ basename = basename[:-2]
if basename == 'python':
basename = 'venvlauncher'
elif basename == 'pythonw':
basename = 'venvwlauncher'
- scripts = os.path.dirname(src)
+ src = os.path.join(os.path.dirname(src), basename + ext)
else:
- scripts = os.path.join(os.path.dirname(__file__), "scripts", "nt")
- src = os.path.join(scripts, basename + ext)
+ src = srcfn
shutil.copyfile(src, dst)