The venv code for the uninstalled case depends on various hacks only present in the Windows code paths, so instead of using the unix ones patch the windows ones. We now create a venvlauncher.exe in the build dir which gets copied to the venv package during install, and when run uninstalled copies it to the created venvs. This is mroe in line with what the msvc build does.
60 lines
2.5 KiB
Diff
60 lines
2.5 KiB
Diff
Don't copy the whole /bin when symlinking.
|
|
Also provide python3.exe for backwards compat.
|
|
Unset MSYSTEM, to fix some path comparisons due to os.sep differences.
|
|
Skip some msvc build specifics
|
|
diff -Naur Python-3.8.0-orig/Lib/venv/__init__.py Python-3.8.0/Lib/venv/__init__.py
|
|
--- Python-3.8.0-orig/Lib/venv/__init__.py 2019-10-22 10:05:21.691201800 +0300
|
|
+++ Python-3.8.0/Lib/venv/__init__.py 2019-10-22 10:05:25.591208600 +0300
|
|
@@ -11,6 +11,7 @@
|
|
import sys
|
|
import sysconfig
|
|
import types
|
|
+from sysconfig import _POSIX_BUILD
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
@@ -110,7 +111,7 @@
|
|
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')
|
|
@@ -244,7 +244,7 @@
|
|
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
|
|
@@ -267,7 +267,10 @@
|
|
if os.path.lexists(src):
|
|
copier(src, os.path.join(binpath, suffix))
|
|
|
|
- if sysconfig.is_python_build(True):
|
|
+ if _POSIX_BUILD:
|
|
+ copier(os.path.join(dirname, 'python.exe'), os.path.join(binpath, 'python3.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:
|
|
@@ -285,9 +285,11 @@
|
|
# We run ensurepip in isolated mode to avoid side effects from
|
|
# environment vars, the current directory and anything else
|
|
# intended for the global Python environment
|
|
+ env = os.environ.copy()
|
|
+ env.pop("MSYSTEM", None)
|
|
cmd = [context.env_exe, '-Im', 'ensurepip', '--upgrade',
|
|
- '--default-pip']
|
|
- subprocess.check_output(cmd, stderr=subprocess.STDOUT)
|
|
+ '--default-pip']
|
|
+ subprocess.check_call(cmd, stderr=subprocess.STDOUT, env=env)
|
|
|
|
def setup_scripts(self, context):
|
|
"""
|