- No more Python 2.6 or Jython support - Drop runtime dependency on pythonX-devel See https://lists.fedoraproject.org/archives/list/python-devel@lists.fedoraproject.org/thread/F3EGYJ362AUZMGR3P2OP3ARK4YNLEASO/ Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1699031epel9
parent
5251bc6300
commit
c2c5bce7b0
@ -1,16 +0,0 @@
|
|||||||
diff --git a/virtualenv.py b/virtualenv.py
|
|
||||||
index c4e3bd5..89b8863 100755
|
|
||||||
--- a/virtualenv.py
|
|
||||||
+++ b/virtualenv.py
|
|
||||||
@@ -1181,8 +1181,9 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, sy
|
|
||||||
exec_dir = join(sys.exec_prefix, 'Lib')
|
|
||||||
else:
|
|
||||||
exec_dir = join(sys.exec_prefix, 'lib', py_version)
|
|
||||||
- for fn in os.listdir(exec_dir):
|
|
||||||
- copyfile(join(exec_dir, fn), join(lib_dir, fn), symlink)
|
|
||||||
+ if os.path.isdir(exec_dir):
|
|
||||||
+ for fn in os.listdir(exec_dir):
|
|
||||||
+ copyfile(join(exec_dir, fn), join(lib_dir, fn), symlink)
|
|
||||||
|
|
||||||
if is_jython:
|
|
||||||
# Jython has either jython-dev.jar and javalib/ dir, or just
|
|
@ -1,79 +0,0 @@
|
|||||||
diff --git a/tests/test_virtualenv.py b/tests/test_virtualenv.py
|
|
||||||
index ce45ede..3cd200b 100644
|
|
||||||
--- a/tests/test_virtualenv.py
|
|
||||||
+++ b/tests/test_virtualenv.py
|
|
||||||
@@ -4,11 +4,16 @@ import os
|
|
||||||
import shutil
|
|
||||||
import sys
|
|
||||||
import tempfile
|
|
||||||
+import zipfile
|
|
||||||
import pytest
|
|
||||||
import platform # noqa
|
|
||||||
|
|
||||||
from mock import patch, Mock
|
|
||||||
|
|
||||||
+try:
|
|
||||||
+ from pathlib import Path
|
|
||||||
+except ImportError:
|
|
||||||
+ from pathlib2 import Path
|
|
||||||
|
|
||||||
def test_version():
|
|
||||||
"""Should have a version string"""
|
|
||||||
@@ -139,3 +144,44 @@ def test_always_copy_option():
|
|
||||||
" symlink (to %s)" % (full_name, os.readlink(full_name))
|
|
||||||
finally:
|
|
||||||
shutil.rmtree(tmp_virtualenv)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+def test_missing_certifi_pem(tmp_path):
|
|
||||||
+ """Make sure that we can still create virtual environment if pip is
|
|
||||||
+ patched to not use certifi's cacert.pem and the file is removed.
|
|
||||||
+ This can happen if pip is packaged by Linux distributions."""
|
|
||||||
+ proj_dir = Path(__file__).parent.parent
|
|
||||||
+ support_original = proj_dir / "virtualenv_support"
|
|
||||||
+ pip_wheel = sorted(support_original.glob("pip*whl"))[0]
|
|
||||||
+ whl_name = pip_wheel.name
|
|
||||||
+
|
|
||||||
+ wheeldir = tmp_path / "wheels"
|
|
||||||
+ wheeldir.mkdir()
|
|
||||||
+ tmpcert = tmp_path / "tmpcert.pem"
|
|
||||||
+ cacert = "pip/_vendor/certifi/cacert.pem"
|
|
||||||
+ certifi = "pip/_vendor/certifi/core.py"
|
|
||||||
+ oldpath = b"os.path.join(f, 'cacert.pem')"
|
|
||||||
+ newpath = "r'{}'".format(tmpcert).encode()
|
|
||||||
+ removed = False
|
|
||||||
+ replaced = False
|
|
||||||
+
|
|
||||||
+ with zipfile.ZipFile(str(pip_wheel), "r") as whlin:
|
|
||||||
+ with zipfile.ZipFile(str(wheeldir / whl_name), "w") as whlout:
|
|
||||||
+ for item in whlin.infolist():
|
|
||||||
+ buff = whlin.read(item.filename)
|
|
||||||
+ if item.filename == cacert:
|
|
||||||
+ tmpcert.write_bytes(buff)
|
|
||||||
+ removed = True
|
|
||||||
+ continue
|
|
||||||
+ if item.filename == certifi:
|
|
||||||
+ nbuff = buff.replace(oldpath, newpath)
|
|
||||||
+ assert nbuff != buff
|
|
||||||
+ buff = nbuff
|
|
||||||
+ replaced = True
|
|
||||||
+ whlout.writestr(item, buff)
|
|
||||||
+
|
|
||||||
+ assert removed and replaced
|
|
||||||
+
|
|
||||||
+ venvdir = tmp_path / "venv"
|
|
||||||
+ search_dirs = [str(wheeldir), str(support_original)]
|
|
||||||
+ virtualenv.create_environment(str(venvdir), search_dirs=search_dirs)
|
|
||||||
diff --git a/virtualenv.py b/virtualenv.py
|
|
||||||
index c1fe7f1..3837250 100755
|
|
||||||
--- a/virtualenv.py
|
|
||||||
+++ b/virtualenv.py
|
|
||||||
@@ -867,6 +867,8 @@ def install_wheel(project_names, py_executable, search_dirs=None,
|
|
||||||
except ImportError:
|
|
||||||
from pip import main as _main
|
|
||||||
cert_data = pkgutil.get_data("pip._vendor.requests", "cacert.pem")
|
|
||||||
+ except IOError:
|
|
||||||
+ cert_data = None
|
|
||||||
|
|
||||||
if cert_data is not None:
|
|
||||||
cert_file = tempfile.NamedTemporaryFile(delete=False)
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From 01e27bd7a6ddde4db6654ab2f18def36dab64329 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
||||||
|
Date: Fri, 12 Jul 2019 11:58:32 +0200
|
||||||
|
Subject: [PATCH] Also search the LICENSE file in lib64/pythonX.Y
|
||||||
|
|
||||||
|
Several Linux distributions including Gentoo, Fedora, openSUSE
|
||||||
|
put things in lib64/pythonX.Y instead of lib/pythonX.Y on 64bit
|
||||||
|
architectures (x86_64, aarch64, etc.).
|
||||||
|
|
||||||
|
This was already respected via the fix_lib64() function, however
|
||||||
|
when virtualenv was searching for Python LICENSE, it was not.
|
||||||
|
|
||||||
|
Now is the lib64/pythonX.Y patch searched as well and unlike fix_lib64()
|
||||||
|
no checks need to be made, as the patch are tested in sequence.
|
||||||
|
|
||||||
|
See https://github.com/pypa/virtualenv/issues/1352#issuecomment-510500384
|
||||||
|
---
|
||||||
|
virtualenv.py | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/virtualenv.py b/virtualenv.py
|
||||||
|
index 3ccbed6d..d4d5d304 100755
|
||||||
|
--- a/virtualenv.py
|
||||||
|
+++ b/virtualenv.py
|
||||||
|
@@ -1333,9 +1333,12 @@ def copy_required_files(src_dir, lib_dir, symlink):
|
||||||
|
|
||||||
|
def copy_license(prefix, dst_prefix, lib_dir, symlink):
|
||||||
|
"""Copy the license file so `license()` builtin works"""
|
||||||
|
+ lib64_dir = lib_dir.replace("lib", "lib64")
|
||||||
|
for license_path in (
|
||||||
|
# posix cpython
|
||||||
|
os.path.join(prefix, os.path.relpath(lib_dir, dst_prefix), "LICENSE.txt"),
|
||||||
|
+ # posix cpython installed in /usr/lib64
|
||||||
|
+ os.path.join(prefix, os.path.relpath(lib64_dir, dst_prefix), "LICENSE.txt"),
|
||||||
|
# windows cpython
|
||||||
|
os.path.join(prefix, "LICENSE.txt"),
|
||||||
|
# pypy
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,16 @@
|
|||||||
diff --git a/virtualenv.py b/virtualenv.py
|
diff --git a/virtualenv.py b/virtualenv.py
|
||||||
index 2ad2695..a0ddfaf 100755
|
index 3ccbed6..504efc8 100755
|
||||||
--- a/virtualenv.py
|
--- a/virtualenv.py
|
||||||
+++ b/virtualenv.py
|
+++ b/virtualenv.py
|
||||||
@@ -400,6 +400,9 @@ def _find_file(filename, dirs):
|
@@ -473,7 +473,10 @@ def virtualenv_support_dirs():
|
||||||
def file_search_dirs():
|
|
||||||
here = os.path.dirname(os.path.abspath(__file__))
|
# normal filesystem installation
|
||||||
dirs = [here, join(here, 'virtualenv_support')]
|
if os.path.isdir(join(HERE, "virtualenv_support")):
|
||||||
+ if sys.version_info >= (2, 7):
|
- yield [join(HERE, "virtualenv_support")]
|
||||||
+ # we don't insert on 2.6 because the wheels there are not compatible
|
+ if os.path.isdir("/usr/share/python-wheels"):
|
||||||
+ dirs.insert(1, '/usr/share/python-wheels')
|
+ yield ["/usr/share/python-wheels", join(HERE, "virtualenv_support")]
|
||||||
if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
|
+ else:
|
||||||
# Probably some boot script; just in case virtualenv is installed...
|
+ yield [join(HERE, "virtualenv_support")]
|
||||||
|
elif IS_ZIPAPP:
|
||||||
|
tmpdir = tempfile.mkdtemp()
|
||||||
try:
|
try:
|
||||||
|
@ -1 +1 @@
|
|||||||
SHA512 (virtualenv-16.0.0.tar.gz) = 43bc37f1da1b65e9a2df5a8813a801f27f5783b7211219d441d1c2132789917df42fdc0aba1d5ec51e3d6f7583af9474d59c1f532d8880c8c325ccc96e73b3df
|
SHA512 (virtualenv-16.6.1.tar.gz) = 6253f44401471b6af09b38cbb3919fc35070e3168d5381c384011028e75e2ded6d13dc86304eb97b13c302ac917396727e4a6f6d0c98aa9eea885391af760620
|
||||||
|
Loading…
Reference in new issue