Fix virtualenv unable to access venv setup files

We aren't currently compiling the venvlauncher as part of python with
gcc. Previous patches in PR #5625 removed the venvlauncher redirector
by skipping "nt" platform portions in the venv module.

Although the previous patches worked to fix venv, it left us with key
venvlauncher files missing that were expected to be present in Windows.

In issue #7014, tox and other tools that depend on virtualenv were
unable to run. For example, there was issues with no such file or
directory errors:
'mingw64/lib/python3.8/venv/scripts/nt/python.exe'

This fixes these issues by removing some of the previous patches in venv
and copying python.exe and pythonw.exe to the locations where the
venvlauncher redirect files are expected. A future solution may be to
try to compile venvlauncher using gcc.
This commit is contained in:
Dan Yeaw
2020-10-18 19:13:26 -04:00
parent 169d29fdd3
commit 7fd2d13dfe
2 changed files with 9 additions and 11 deletions

View File

@@ -18,15 +18,6 @@ diff -Naur Python-3.8.0-orig/Lib/venv/__init__.py Python-3.8.0/Lib/venv/__init__
binname = 'Scripts'
incpath = 'Include'
libpath = os.path.join(env_dir, 'Lib', 'site-packages')
@@ -156,7 +157,7 @@
if self.prompt is not None:
f.write(f'prompt = {self.prompt!r}\n')
- if os.name != 'nt':
+ if os.name != 'nt' or _POSIX_BUILD:
def symlink_or_copy(self, src, dst, relative_symlinks_ok=False):
"""
Try symlinking a file, and if that fails, fall back to copying.
@@ -230,7 +231,7 @@
path = context.env_exe
copier = self.symlink_or_copy

View File

@@ -18,7 +18,7 @@ pkgbase="mingw-w64-${_realname}"
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
_pybasever=3.8
pkgver=${_pybasever}.6
pkgrel=3
pkgrel=4
provides=("${MINGW_PACKAGE_PREFIX}-python3=${pkgver}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3"
"${MINGW_PACKAGE_PREFIX}-python2<2.7.16-7")
@@ -442,6 +442,13 @@ package() {
sed -i "s|${pkgdir}${MINGW_PREFIX}|${MINGW_PREFIX}|g" \
"${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/lib-dynload/_sysconfigdata*.py \
"${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/smtpd.py
# Replace missing venvlauncher files (issue #7014)
cp "${pkgdir}${MINGW_PREFIX}"/bin/python.exe "${pkgdir}${MINGW_PREFIX}"/bin/venvlauncher.exe
cp "${pkgdir}${MINGW_PREFIX}"/bin/pythonw.exe "${pkgdir}${MINGW_PREFIX}"/bin/venvwlauncher.exe
mkdir -p "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/venv/scripts/nt
cp "${pkgdir}${MINGW_PREFIX}"/bin/python.exe "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/venv/scripts/nt/python.exe
cp "${pkgdir}${MINGW_PREFIX}"/bin/pythonw.exe "${pkgdir}${MINGW_PREFIX}"/lib/python${_pybasever}/venv/scripts/nt/pythonw.exe
}
sha256sums=('a9e0b79d27aa056eb9cce8d63a427b5f9bab1465dee3f942dcfdb25a82f4ab8a'
@@ -528,7 +535,7 @@ sha256sums=('a9e0b79d27aa056eb9cce8d63a427b5f9bab1465dee3f942dcfdb25a82f4ab8a'
'17bf1ea04f476ee66555bc4386ffbebfe6be6f75e67947b7f85511241ac46407'
'0ded9e2792b95902d898aba91020103875f2987a9566b353f3e6988b08848f4a'
'd3a0669c83e4df5d33606b4c3443d2c6c71b76cb4f6421d6d54ee630023be6c2'
'c49e557d57a459b62c327bbbfa17b49e282e9978656a2cbae30685b5c97c1ede'
'4f2c989955e1a3b21e2eab286f74271c8e32a0b58d9acf1bcc0f2498c8daa52b'
'a7fbf65a86889f95138360ca4dbd4e51de2e214384ee39740d9c6c381ff997d9'
'ea0c602b59803b7f274c351676f6b09f93f3ff2b8695f28390dcb3effacb95db'
'6f1a48380445406709ba5c6b4b9c6f0301ea645324feb429f3719dc29b8f28ff'