From 734fe023f11458f993c49f91b158de774c94d4a4 Mon Sep 17 00:00:00 2001 From: Bernat Gabor Date: Wed, 26 Feb 2020 15:12:44 +0000 Subject: [PATCH] Disable distutils fixup for python 3 Until https://github.com/pypa/pip/issues/7778 is fixed and released. Signed-off-by: Bernat Gabor --- docs/changelog/1669.bugfix.rst | 2 ++ setup.py | 5 +---- src/virtualenv/create/via_global_ref/api.py | 2 ++ tests/unit/create/test_creator.py | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 docs/changelog/1669.bugfix.rst 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/create/test_creator.py b/tests/unit/create/test_creator.py index f66218ed5..a4eb6b4c6 100644 --- a/tests/unit/create/test_creator.py +++ b/tests/unit/create/test_creator.py @@ -19,7 +19,7 @@ from virtualenv.create.creator import DEBUG_SCRIPT, Creator, get_env_debug_info from virtualenv.discovery.builtin import get_interpreter from virtualenv.discovery.py_info import PythonInfo -from virtualenv.info import IS_PYPY, fs_supports_symlink +from virtualenv.info import IS_PYPY, PY3, fs_supports_symlink from virtualenv.pyenv_cfg import PyEnvCfg from virtualenv.run import cli_run, session_via_cli from virtualenv.util.path import Path @@ -351,6 +351,7 @@ def test_create_long_path(current_fastest, tmp_path): subprocess.check_call([str(result.creator.script("pip")), "--version"]) +@pytest.mark.skipif(PY3, reason="https://github.com/pypa/pip/issues/7778") @pytest.mark.parametrize("creator", set(PythonInfo.current_system().creators().key_to_class) - {"builtin"}) def test_create_distutils_cfg(creator, tmp_path, monkeypatch): cmd = [