From 52abb4851f411889e156c97981542f6708552485 Mon Sep 17 00:00:00 2001 From: Lumir Balhar Date: Mon, 4 Dec 2023 14:28:31 +0100 Subject: [PATCH] Fix compatibility with Python 3.13 Resolves: rhbz#2251781 (cherry picked from commit d83676642c6ce12420b02c5efaeacfd046b6ffd4) --- py3.13.patch | 60 ++++++++++++++++++++++++++++++++++++++++++ python-virtualenv.spec | 3 +++ 2 files changed, 63 insertions(+) create mode 100644 py3.13.patch diff --git a/py3.13.patch b/py3.13.patch new file mode 100644 index 0000000..729192c --- /dev/null +++ b/py3.13.patch @@ -0,0 +1,60 @@ +From 11c30f6c69c4516b406c1c62f472d37898c58b93 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 4 Dec 2023 14:26:52 +0100 +Subject: [PATCH] Run CI tests on Python 3.13, fix tests (#2673) + +--- + docs/changelog/2673.feature.rst | 1 + + tests/unit/create/test_creator.py | 6 +++++- + tests/unit/create/via_global_ref/builtin/testing/path.py | 6 +++++- + 3 files changed, 11 insertions(+), 2 deletions(-) + create mode 100644 docs/changelog/2673.feature.rst + +diff --git a/docs/changelog/2673.feature.rst b/docs/changelog/2673.feature.rst +new file mode 100644 +index 0000000..0adf4a0 +--- /dev/null ++++ b/docs/changelog/2673.feature.rst +@@ -0,0 +1 @@ ++The tests now pass on the CI with Python 3.13.0a2 - by :user:`hroncok`. +diff --git a/tests/unit/create/test_creator.py b/tests/unit/create/test_creator.py +index 8b9d688..fc21ad8 100644 +--- a/tests/unit/create/test_creator.py ++++ b/tests/unit/create/test_creator.py +@@ -231,7 +231,11 @@ def test_create_no_seed(python, creator, isolated, system, coverage_env, special + assert os.path.exists(make_file) + + git_ignore = (dest / ".gitignore").read_text(encoding="utf-8") +- assert git_ignore.splitlines() == ["# created by virtualenv automatically", "*"] ++ if creator_key == "venv" and sys.version_info >= (3, 13): ++ comment = "# Created by venv; see https://docs.python.org/3/library/venv.html" ++ else: ++ comment = "# created by virtualenv automatically" ++ assert git_ignore.splitlines() == [comment, "*"] + + + def test_create_vcs_ignore_exists(tmp_path): +diff --git a/tests/unit/create/via_global_ref/builtin/testing/path.py b/tests/unit/create/via_global_ref/builtin/testing/path.py +index b2e1b85..d833de6 100644 +--- a/tests/unit/create/via_global_ref/builtin/testing/path.py ++++ b/tests/unit/create/via_global_ref/builtin/testing/path.py +@@ -44,11 +44,15 @@ class PathMockABC(FakeDataABC, Path): + """Mocks the behavior of `Path`""" + + _flavour = getattr(Path(), "_flavour", None) +- + if hasattr(_flavour, "altsep"): + # Allows to pass some tests for Windows via PosixPath. + _flavour.altsep = _flavour.altsep or "\\" + ++ # Python 3.13 renamed _flavour to pathmod ++ pathmod = getattr(Path(), "pathmod", None) ++ if hasattr(pathmod, "altsep"): ++ pathmod.altsep = pathmod.altsep or "\\" ++ + def exists(self): + return self.is_file() or self.is_dir() + +-- +2.43.0 + diff --git a/python-virtualenv.spec b/python-virtualenv.spec index 57cac2f..ff98a3d 100644 --- a/python-virtualenv.spec +++ b/python-virtualenv.spec @@ -21,6 +21,9 @@ Patch2: prevent-PermissionError-when-using-venv-creator-on-s.patch # 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 +# Fix compatibility with Python 3.13 +# https://github.com/pypa/virtualenv/pull/2673 +Patch5: py3.13.patch BuildArch: noarch