64 lines
2.7 KiB
Diff
64 lines
2.7 KiB
Diff
From c8508a5ef10e15b2ec56a63690e53b52ed1a95a1 Mon Sep 17 00:00:00 2001
|
|
From: Christoph Reiter <reiter.christoph@gmail.com>
|
|
Date: Thu, 17 Jun 2021 18:52:26 +0530
|
|
Subject: [PATCH 069/N] venv creation fixes
|
|
|
|
Co-authored-by: Naveen M K <naveen521kk@gmail.com>
|
|
---
|
|
Lib/venv/__init__.py | 14 +++++++++++---
|
|
1 file changed, 11 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
|
|
index 69155e5..49ac80e 100644
|
|
--- a/Lib/venv/__init__.py
|
|
+++ b/Lib/venv/__init__.py
|
|
@@ -11,6 +11,7 @@ import subprocess
|
|
import sys
|
|
import sysconfig
|
|
import types
|
|
+from sysconfig import _POSIX_BUILD
|
|
|
|
|
|
CORE_VENV_DEPS = ('pip', 'setuptools')
|
|
@@ -124,7 +125,7 @@ class EnvBuilder:
|
|
context.executable = executable
|
|
context.python_dir = dirname
|
|
context.python_exe = exename
|
|
- if sys.platform == 'win32':
|
|
+ if sys.platform == 'win32' and not _POSIX_BUILD:
|
|
binname = 'Scripts'
|
|
incpath = 'Include'
|
|
libpath = os.path.join(env_dir, 'Lib', 'site-packages')
|
|
@@ -271,7 +272,7 @@ class EnvBuilder:
|
|
if not os.path.islink(path):
|
|
os.chmod(path, 0o755)
|
|
else:
|
|
- if self.symlinks:
|
|
+ if self.symlinks and not _POSIX_BUILD:
|
|
# For symlinking, we need a complete copy of the root directory
|
|
# If symlinks fail, you'll get unnecessary copies of files, but
|
|
# we assume that if you've opted into symlinks on Windows then
|
|
@@ -295,7 +296,13 @@ class EnvBuilder:
|
|
if os.path.lexists(src):
|
|
copier(src, os.path.join(binpath, suffix))
|
|
|
|
- if sysconfig.is_python_build(True):
|
|
+ if _POSIX_BUILD:
|
|
+ # copy from python/pythonw so the venvlauncher magic in symlink_or_copy triggers
|
|
+ copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python3.exe'))
|
|
+ copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python%d.%d.exe' % sys.version_info[:2]))
|
|
+ copier(os.path.join(dirname, 'pythonw.exe'), os.path.join(binpath, 'python3w.exe'))
|
|
+
|
|
+ if sysconfig.is_python_build(True) and not _POSIX_BUILD:
|
|
# copy init.tcl
|
|
for root, dirs, files in os.walk(context.python_dir):
|
|
if 'init.tcl' in files:
|
|
@@ -319,6 +326,7 @@ class EnvBuilder:
|
|
env['VIRTUAL_ENV'] = context.env_dir
|
|
env.pop('PYTHONHOME', None)
|
|
env.pop('PYTHONPATH', None)
|
|
+ env.pop("MSYSTEM", None)
|
|
kwargs['cwd'] = context.env_dir
|
|
kwargs['executable'] = context.env_exec_cmd
|
|
subprocess.check_output(args, **kwargs)
|