Remove hack for local/ prefixes
Python 3.10 and 3.11 in rawhide will have a new "venv" scheme which virtualenv in the latest version prefers.
This commit is contained in:
parent
a0db7f781c
commit
9d4d4ef0bd
54
2231.patch
Normal file
54
2231.patch
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
From 58ff51c482ed40a6b38766c90954d7d3edcaa0fb Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
||||||
|
Date: Mon, 8 Nov 2021 15:54:18 +0100
|
||||||
|
Subject: [PATCH] Fix test_custom_venv_install_scheme_is_prefered mocking if
|
||||||
|
"venv" install scheme actually exists
|
||||||
|
|
||||||
|
The error this prevents was:
|
||||||
|
|
||||||
|
"""distutils.command.install
|
||||||
|
|
||||||
|
Implements the Distutils 'install' command."""
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
# Copy from sysconfig._INSTALL_SCHEMES
|
||||||
|
for key in SCHEME_KEYS:
|
||||||
|
for distutils_scheme_name, sys_scheme_name in (
|
||||||
|
("unix_prefix", "posix_prefix"), ("unix_home", "posix_home"),
|
||||||
|
("nt", "nt")):
|
||||||
|
sys_key = key
|
||||||
|
> sys_scheme = sysconfig._INSTALL_SCHEMES[sys_scheme_name]
|
||||||
|
E KeyError: 'posix_home'
|
||||||
|
---
|
||||||
|
tests/unit/discovery/py_info/test_py_info.py | 9 ++++++++-
|
||||||
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/tests/unit/discovery/py_info/test_py_info.py b/tests/unit/discovery/py_info/test_py_info.py
|
||||||
|
index 053a6f906..d4c4bba25 100644
|
||||||
|
--- a/tests/unit/discovery/py_info/test_py_info.py
|
||||||
|
+++ b/tests/unit/discovery/py_info/test_py_info.py
|
||||||
|
@@ -349,7 +349,6 @@ def test_custom_venv_install_scheme_is_prefered(mocker):
|
||||||
|
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
sysconfig_install_schemes = _stringify_schemes_dict(sysconfig_install_schemes)
|
||||||
|
- mocker.patch("sysconfig._INSTALL_SCHEMES", sysconfig_install_schemes)
|
||||||
|
|
||||||
|
# On Python < 3.10, the distutils schemes are not derived from sysconfig schemes
|
||||||
|
# So we mock them as well to assert the custom "venv" install scheme has priority
|
||||||
|
@@ -367,7 +366,15 @@ def test_custom_venv_install_scheme_is_prefered(mocker):
|
||||||
|
|
||||||
|
if sys.version_info[0] == 2:
|
||||||
|
distutils_schemes = _stringify_schemes_dict(distutils_schemes)
|
||||||
|
+
|
||||||
|
+ # We need to mock distutils first, so they don't see the mocked sysconfig,
|
||||||
|
+ # if imported for the first time.
|
||||||
|
+ # That can happen if the actual interpreter has the "venv" INSTALL_SCHEME
|
||||||
|
+ # and hence this is the first time we are touching distutils in this process.
|
||||||
|
+ # If distutils saw our mocked sysconfig INSTALL_SCHEMES, we would need
|
||||||
|
+ # to define all install schemes.
|
||||||
|
mocker.patch("distutils.command.install.INSTALL_SCHEMES", distutils_schemes)
|
||||||
|
+ mocker.patch("sysconfig._INSTALL_SCHEMES", sysconfig_install_schemes)
|
||||||
|
|
||||||
|
pyinfo = PythonInfo()
|
||||||
|
pyver = "{}.{}".format(pyinfo.version_info.major, pyinfo.version_info.minor)
|
@ -1,14 +0,0 @@
|
|||||||
diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py
|
|
||||||
index 0de6128..006df83 100644
|
|
||||||
--- a/src/virtualenv/discovery/py_info.py
|
|
||||||
+++ b/src/virtualenv/discovery/py_info.py
|
|
||||||
@@ -124,6 +124,9 @@ class PythonInfo(object):
|
|
||||||
prefixes = self.prefix, self.exec_prefix, self.base_prefix, self.base_exec_prefix
|
|
||||||
config_var = {k: "" if v in prefixes else v for k, v in self.sysconfig_vars.items()}
|
|
||||||
result = self.sysconfig_path(key, config_var=config_var).lstrip(os.sep)
|
|
||||||
+ # A hack for https://github.com/pypa/virtualenv/issues/2208
|
|
||||||
+ if result.startswith(u"local/"):
|
|
||||||
+ return result[6:]
|
|
||||||
return result
|
|
||||||
|
|
||||||
@staticmethod
|
|
@ -1,6 +1,6 @@
|
|||||||
Name: python-virtualenv
|
Name: python-virtualenv
|
||||||
Version: 20.10.0
|
Version: 20.10.0
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Tool to create isolated Python environments
|
Summary: Tool to create isolated Python environments
|
||||||
|
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -10,9 +10,8 @@ Source0: %{pypi_source virtualenv}
|
|||||||
# Add /usr/share/python-wheels to extra_search_dir
|
# Add /usr/share/python-wheels to extra_search_dir
|
||||||
Patch1: rpm-wheels.patch
|
Patch1: rpm-wheels.patch
|
||||||
|
|
||||||
# A hack/workaround for https://github.com/pypa/virtualenv/issues/2208
|
# Hotfix for the test of the new functionality
|
||||||
# This makes virtualenv's paths not contain /local/
|
Patch2: https://github.com/pypa/virtualenv/pull/2231.patch
|
||||||
Patch2: hack_around_local.patch
|
|
||||||
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
@ -60,6 +59,14 @@ licensed under an MIT-style permissive license.
|
|||||||
%package -n python3-virtualenv
|
%package -n python3-virtualenv
|
||||||
Summary: Tool to create isolated Python environments
|
Summary: Tool to create isolated Python environments
|
||||||
|
|
||||||
|
# This virtualenv requires the "venv" install scheme on Pythons
|
||||||
|
# where we patch "posix_prefix".
|
||||||
|
# Explicitly conflict with Pythons where we don't have it yet.
|
||||||
|
Conflicts: python3.11 < 3.11.0~a2
|
||||||
|
%if 0%{?fedora} >= 36
|
||||||
|
Conflicts: python3.10 < 3.10.0-3
|
||||||
|
%endif
|
||||||
|
|
||||||
Obsoletes: python3-virtualenv-python26 < 16.6
|
Obsoletes: python3-virtualenv-python26 < 16.6
|
||||||
%{?python_provide:%python_provide python3-virtualenv}
|
%{?python_provide:%python_provide python3-virtualenv}
|
||||||
|
|
||||||
@ -155,6 +162,9 @@ rm -r tmp_path
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 08 2021 Lumír Balhar <lbalhar@redhat.com> - 20.10.0-2
|
||||||
|
- Remove hack for local/ prefixes
|
||||||
|
|
||||||
* Tue Nov 02 2021 Lumír Balhar <lbalhar@redhat.com> - 20.10.0-1
|
* Tue Nov 02 2021 Lumír Balhar <lbalhar@redhat.com> - 20.10.0-1
|
||||||
- Update to 20.10.0
|
- Update to 20.10.0
|
||||||
Resolves: rhbz#2019116
|
Resolves: rhbz#2019116
|
||||||
|
Loading…
Reference in New Issue
Block a user