diff --git a/docs/changelog/1669.bugfix.rst b/docs/changelog/1669.bugfix.rst new file mode 100644 index 000000000..5fa952b72 --- /dev/null +++ b/docs/changelog/1669.bugfix.rst @@ -0,0 +1,2 @@ +Disable distutils fixup for python 3 until `pypa/pip #7778 `_ is fixed and +released - by :user:`gaborbernat`. diff --git a/setup.py b/setup.py index 18642d636..0f0ab7a9f 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,5 @@ setup( use_scm_version={"write_to": "src/virtualenv/version.py", "write_to_template": '__version__ = "{version}"'}, - setup_requires=[ - # this cannot be enabled until https://github.com/pypa/pip/issues/7778 is addressed - # "setuptools_scm >= 2" - ], + setup_requires=["setuptools_scm >= 2"], ) diff --git a/src/virtualenv/create/via_global_ref/api.py b/src/virtualenv/create/via_global_ref/api.py index 8ee0c5c8f..0d3907356 100644 --- a/src/virtualenv/create/via_global_ref/api.py +++ b/src/virtualenv/create/via_global_ref/api.py @@ -53,6 +53,8 @@ def create(self): def patch_distutils_via_pth(self): """Patch the distutils package to not be derailed by its configuration files""" + if self.interpreter.version_info.major == 3: + return # TODO: remove this, for her to bypass: https://github.com/pypa/pip/issues/7778 patch_file = Path(__file__).parent / "_distutils_patch_virtualenv.py" with ensure_file_on_disk(patch_file, self.app_data) as resolved_path: text = resolved_path.read_text() diff --git a/tests/unit/seed/test_boostrap_link_via_app_data.py b/tests/unit/seed/test_boostrap_link_via_app_data.py index 3c4c6697a..aefd9d68f 100644 --- a/tests/unit/seed/test_boostrap_link_via_app_data.py +++ b/tests/unit/seed/test_boostrap_link_via_app_data.py @@ -7,7 +7,7 @@ import pytest from virtualenv.discovery.py_info import PythonInfo -from virtualenv.info import fs_supports_symlink +from virtualenv.info import PY3, fs_supports_symlink from virtualenv.run import cli_run from virtualenv.seed.embed.wheels import BUNDLE_SUPPORT from virtualenv.seed.embed.wheels.acquire import BUNDLE_FOLDER @@ -115,7 +115,7 @@ def read_only_folder(temp_app_data): os.chmod(str(temp_app_data), S_IWUSR | S_IREAD) -@pytest.mark.skipif(sys.platform == "win32", reason="Windows only applies R/O to files") +@pytest.mark.skipif(sys.platform == "win32" or PY3, reason="Windows only applies R/O to files") def test_base_bootstrap_link_via_app_data_not_writable(tmp_path, current_fastest, read_only_folder, monkeypatch): dest = tmp_path / "venv" result = cli_run(["--seeder", "app-data", "--creator", current_fastest, "--clear-app-data", "-vv", str(dest)])