diff --git a/.python-virtualenv.metadata b/.python-virtualenv.metadata index b1fdf0c..cb9bc0d 100644 --- a/.python-virtualenv.metadata +++ b/.python-virtualenv.metadata @@ -1 +1 @@ -ee10bef35332c6d7a9c9c82e11c5e5d081ddbdbd SOURCES/virtualenv-20.21.1.tar.gz +3052925621f507a334dc357ddffda03bba3e729c SOURCES/virtualenv-20.26.6.tar.gz diff --git a/SOURCES/rpm-wheels.patch b/SOURCES/rpm-wheels.patch index 72f569f..fd257fe 100644 --- a/SOURCES/rpm-wheels.patch +++ b/SOURCES/rpm-wheels.patch @@ -1,4 +1,4 @@ -From 57ddc4814e921021ed95e9f21cc3f8f9bf06a1f2 Mon Sep 17 00:00:00 2001 +From da9ce1c9d7d422e310d79d58a8b7ed07cbc781d1 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Thu, 9 Feb 2023 15:13:36 +0100 Subject: [PATCH] RPM wheels @@ -19,10 +19,10 @@ Co-Authored-By: Miro HronĨok create mode 100644 src/virtualenv/util/path/_system_wheels.py diff --git a/src/virtualenv/run/__init__.py b/src/virtualenv/run/__init__.py -index 6d22b71..19d1791 100644 +index 48647ec..80c9d4a 100644 --- a/src/virtualenv/run/__init__.py +++ b/src/virtualenv/run/__init__.py -@@ -87,8 +87,9 @@ def build_parser_only(args=None): +@@ -97,8 +97,9 @@ def build_parser_only(args=None): def handle_extra_commands(options): if options.upgrade_embed_wheels: @@ -35,24 +35,25 @@ index 6d22b71..19d1791 100644 def load_app_data(args, parser, options): diff --git a/src/virtualenv/seed/embed/base_embed.py b/src/virtualenv/seed/embed/base_embed.py -index f29110b..07649c2 100644 +index 864cc49..4586f40 100644 --- a/src/virtualenv/seed/embed/base_embed.py +++ b/src/virtualenv/seed/embed/base_embed.py -@@ -3,8 +3,9 @@ from pathlib import Path +@@ -5,8 +5,9 @@ from pathlib import Path - from ..seeder import Seeder - from ..wheels import Version + from virtualenv.seed.seeder import Seeder + from virtualenv.seed.wheels import Version +from virtualenv.util.path._system_wheels import get_system_wheels_paths -PERIODIC_UPDATE_ON_BY_DEFAULT = True +PERIODIC_UPDATE_ON_BY_DEFAULT = False - class BaseEmbed(Seeder, metaclass=ABCMeta): -@@ -27,6 +28,15 @@ class BaseEmbed(Seeder, metaclass=ABCMeta): + class BaseEmbed(Seeder, ABC): +@@ -28,6 +29,15 @@ class BaseEmbed(Seeder, ABC): + if not self.distribution_to_versions(): self.enabled = False - ++ + if "embed" in (self.pip_version, self.setuptools_version, self.wheel_version): + raise RuntimeError( + "Embedded wheels are not available if virtualenv " @@ -61,11 +62,10 @@ index f29110b..07649c2 100644 + "version which uses the system-wide pip, setuptools " + "and wheel wheels provided also by RPM packages." + ) -+ + @classmethod - def distributions(cls): - return { -@@ -105,6 +115,10 @@ class BaseEmbed(Seeder, metaclass=ABCMeta): + def distributions(cls) -> dict[str, Version]: +@@ -112,6 +122,10 @@ class BaseEmbed(Seeder, ABC): result += f" {distribution}{ver}," return result[:-1] + ")" @@ -77,10 +77,10 @@ index f29110b..07649c2 100644 __all__ = [ "BaseEmbed", diff --git a/src/virtualenv/seed/embed/pip_invoke.py b/src/virtualenv/seed/embed/pip_invoke.py -index 2ca9438..339295f 100644 +index 815753c..5423c9f 100644 --- a/src/virtualenv/seed/embed/pip_invoke.py +++ b/src/virtualenv/seed/embed/pip_invoke.py -@@ -15,6 +15,7 @@ class PipInvoke(BaseEmbed): +@@ -16,6 +16,7 @@ class PipInvoke(BaseEmbed): def run(self, creator): if not self.enabled: return @@ -89,10 +89,10 @@ index 2ca9438..339295f 100644 with self.get_pip_install_cmd(creator.exe, for_py_version) as cmd: env = pip_wheel_env_run(self.extra_search_dir, self.app_data, self.env) diff --git a/src/virtualenv/seed/embed/via_app_data/via_app_data.py b/src/virtualenv/seed/embed/via_app_data/via_app_data.py -index f31ecf6..d7a0f5a 100644 +index 7e58bfc..e236319 100644 --- a/src/virtualenv/seed/embed/via_app_data/via_app_data.py +++ b/src/virtualenv/seed/embed/via_app_data/via_app_data.py -@@ -37,6 +37,7 @@ class FromAppData(BaseEmbed): +@@ -39,6 +39,7 @@ class FromAppData(BaseEmbed): def run(self, creator): if not self.enabled: return @@ -101,10 +101,10 @@ index f31ecf6..d7a0f5a 100644 pip_version = name_to_whl["pip"].version_tuple if "pip" in name_to_whl else None installer_class = self.installer_class(pip_version) diff --git a/src/virtualenv/seed/wheels/acquire.py b/src/virtualenv/seed/wheels/acquire.py -index 21fde34..d6ae171 100644 +index 8b3ddd8..7a2a4e5 100644 --- a/src/virtualenv/seed/wheels/acquire.py +++ b/src/virtualenv/seed/wheels/acquire.py -@@ -97,13 +97,14 @@ def find_compatible_in_house(distribution, version_spec, for_py_version, in_fold +@@ -106,13 +106,14 @@ def find_compatible_in_house(distribution, version_spec, for_py_version, in_fold def pip_wheel_env_run(search_dirs, app_data, env): @@ -121,11 +121,11 @@ index 21fde34..d6ae171 100644 app_data=app_data, do_periodic_update=False, diff --git a/src/virtualenv/seed/wheels/embed/__init__.py b/src/virtualenv/seed/wheels/embed/__init__.py -index 782051a..38dece9 100644 +index f068efc..fc044f1 100644 --- a/src/virtualenv/seed/wheels/embed/__init__.py +++ b/src/virtualenv/seed/wheels/embed/__init__.py -@@ -53,7 +53,11 @@ BUNDLE_SUPPORT = { - MAX = "3.12" +@@ -50,7 +50,11 @@ BUNDLE_SUPPORT = { + MAX = "3.7" +# Redefined here because bundled wheels are removed in RPM build @@ -165,5 +165,5 @@ index 0000000..f3fd9b1 + if wheels_dir.exists(): + yield wheels_dir -- -2.44.0 +2.46.2 diff --git a/SPECS/python-virtualenv.spec b/SPECS/python-virtualenv.spec index 0032f12..da6ea05 100644 --- a/SPECS/python-virtualenv.spec +++ b/SPECS/python-virtualenv.spec @@ -2,50 +2,16 @@ %bcond tests %{without bootstrap} Name: python-virtualenv -Version: 20.21.1 +Version: 20.26.6 Release: %autorelease Summary: Tool to create isolated Python environments License: MIT URL: http://pypi.python.org/pypi/virtualenv -Source0: %{pypi_source virtualenv} +Source: %{pypi_source virtualenv} # Add /usr/share/python-wheels to extra_search_dir -Patch1: rpm-wheels.patch - -## Backports from virtualenv 20.22+ -## We cannot update yet as we want to preserve support for Python 2.7 and 3.6 environments -## Patches in https://github.com/fedora-python/virtualenv/commits/20.21.x -# (20.23.0) prevent PermissionError when using venv creator on some systems -# https://github.com/pypa/virtualenv/pull/2543 -Patch2: prevent-PermissionError-when-using-venv-creator-on-s.patch -# (20.23.0) 3.12 support and no setuptools/wheel on 3.12+ -# freezgun and typing changes stripped -# files missing in sdist removed from the path file -# https://github.com/pypa/virtualenv/pull/2558 -Patch3: 3.12-support-and-no-setuptools-wheel-on-3.12-2558.patch -# (20.24.0) Fix tests with pluggy 1.2.0+ -# Manually cherry-picked from https://github.com/pypa/virtualenv/pull/2593 -Patch4: Fix-tests-with-pluggy-1.2.0.patch -# Fix compatibility with Python 3.13 -# https://github.com/pypa/virtualenv/pull/2673 -# https://github.com/pypa/virtualenv/pull/2702 -Patch5: py3.13.patch -# Allow builtin interpreter discovery to find specific Python versions given a -# general spec -# https://github.com/pypa/virtualenv/pull/2709 -# which contains regressions (mostly but perhaps not exclusively on Windows) -# that are fixed by: -# Fix PATH-based Python discovery on Windows -# https://github.com/pypa/virtualenv/pull/2712 -# -# Backported to 20.21.1. -Patch6: prs-2709-and-2712.patch -# Quote template strings in activation scripts -# to prevent possible command injection. -# https://github.com/pypa/virtualenv/issues/2768 -# Backported from 20.26.6 -Patch7: prevent_command_injection.patch +Patch: rpm-wheels.patch BuildArch: noarch @@ -55,20 +21,17 @@ BuildRequires: python3-devel BuildRequires: fish BuildRequires: tcsh BuildRequires: gcc +# from the [test] extra, but manually filtered, version bounds removed BuildRequires: python3-flaky BuildRequires: python3-packaging BuildRequires: python3-pytest +BuildRequires: python3-pytest-env +#BuildRequires: python3-pytest-freezer -- not available, tests skipped BuildRequires: python3-pytest-mock BuildRequires: python3-pytest-randomly BuildRequires: python3-pytest-timeout - -# The .dist-info folder generated by -# %%pyproject_buildrequires confuses -# importlib.metadata entry points and -# that leads to failed tests where -# virtualenv is run via subprocess. -# The .dist-info is removed since: -BuildRequires: pyproject-rpm-macros >= 1.6.3 +BuildRequires: python3-setuptools +BuildRequires: python3-time-machine %endif # RPM installed wheels @@ -76,44 +39,38 @@ BuildRequires: %{python_wheel_pkg_prefix}-pip-wheel BuildRequires: %{python_wheel_pkg_prefix}-setuptools-wheel BuildRequires: %{python_wheel_pkg_prefix}-wheel-wheel -%description -virtualenv is a tool to create isolated Python environments. virtualenv -is a successor to workingenv, and an extension of virtual-python. It is -written by Ian Bicking, and sponsored by the Open Planning Project. It is -licensed under an MIT-style permissive license. +%global _description %{expand: +virtualenv is a tool to create isolated Python environments. +A subset of it has been integrated into the Python standard library under +the venv module. The venv module does not offer all features of this library, +to name just a few more prominent: +- is slower (by not having the app-data seed method), +- is not as extendable, +- cannot create virtual environments for arbitrarily installed Python versions + (and automatically discover these), +- does not have as rich programmatic API (describe virtual environments + without creating them).} -%package -n python3-virtualenv -Summary: Tool to create isolated Python environments +%description %_description -# 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 -%{?python_provide:%python_provide python3-virtualenv} +%package -n python3-virtualenv +Summary: Tool to create isolated Python environments # Provide "virtualenv" for convenience Provides: virtualenv = %{version}-%{release} # RPM installed wheels Requires: %{python_wheel_pkg_prefix}-pip-wheel +# Python 3.12 virtualenvs are created without setuptools/wheel, +# but the users can still do --wheel=bundle --setuptools=bundle to force them: Requires: %{python_wheel_pkg_prefix}-setuptools-wheel Requires: %{python_wheel_pkg_prefix}-wheel-wheel -# Pythons < 3.7 need an older version of wheel: -Requires: (%{python_wheel_pkg_prefix}-wheel0.37-wheel if python2.7) -Requires: (%{python_wheel_pkg_prefix}-wheel0.37-wheel if pypy2.7) -Requires: (%{python_wheel_pkg_prefix}-wheel0.37-wheel if python3.6) +# This was a requirement for Python 3.6+2.7 virtual environments +Obsoletes: %{python_wheel_pkg_prefix}-wheel0.37-wheel < 0.37.1-20 -%description -n python3-virtualenv -virtualenv is a tool to create isolated Python environments. virtualenv -is a successor to workingenv, and an extension of virtual-python. It is -written by Ian Bicking, and sponsored by the Open Planning Project. It is -licensed under an MIT-style permissive license +%description -n python3-virtualenv %_description %prep @@ -130,15 +87,6 @@ test ! -f src/virtualenv/seed/embed/wheels/*.whl # On Fedora, this should change nothing, but when building for RHEL9+, it will sed -i "s|/usr/share/python-wheels|%{python_wheel_dir}|" src/virtualenv/util/path/_system_wheels.py -# Allow platformdirs version 4 -# Backported from release 20.24.7 -# https://github.com/pypa/virtualenv/commit/55650340d9c9415bf035596266f245a8d59c6993 -sed -i "s/platformdirs<4/platformdirs<5/" pyproject.toml - -# Fix compatibility with pytest 8 -# Fixed upstream in: https://github.com/pypa/virtualenv/commit/16a6af7760c0806c2071956435b1822bb8424595 -sed -i "/pytest.skip/s/msg=/reason=/" tests/unit/activation/conftest.py tests/conftest.py - %generate_buildrequires %pyproject_buildrequires @@ -147,14 +95,15 @@ sed -i "/pytest.skip/s/msg=/reason=/" tests/unit/activation/conftest.py tests/co %install %pyproject_install -%pyproject_save_files virtualenv +%pyproject_save_files -l virtualenv -%if %{with tests} %check +%pyproject_check_import -e '*activate_this' -e '*windows*' +%if %{with tests} # Skip tests which requires internet or some extra dependencies # Requires internet: # - test_download_* -# - test_can_build_c_extensions (on Python 3.12+) +# - test_can_build_c_extensions # Uses disabled functionalities around bundled wheels: # - test_wheel_* # - test_seed_link_via_app_data @@ -163,20 +112,15 @@ sed -i "/pytest.skip/s/msg=/reason=/" tests/unit/activation/conftest.py tests/co # - test_bundle.py (whole file) # Uses disabled functionalities around automatic updates: # - test_periodic_update.py (whole file) -# Requires Python 2: -# - test_py_pyc_missing PIP_CERT=/etc/pki/tls/certs/ca-bundle.crt \ %pytest -vv -k "not test_bundle and \ not test_acquire and \ not test_periodic_update and \ not test_wheel_ and \ not test_download_ and \ -%if v"%{python3_version}" >= v"3.12" not test_can_build_c_extensions and \ -%endif not test_base_bootstrap_via_pip_invoke and \ - not test_seed_link_via_app_data and \ - not test_py_pyc_missing" + not test_seed_link_via_app_data" %endif %files -n python3-virtualenv -f %{pyproject_files}