From 77f7e6cf5ced0878ad1ba99a1d4056f6f6e0cc4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Sat, 31 Jul 2021 09:28:51 +0100 Subject: [PATCH] Remove xonsh activator MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- docs/changelog/2160.removal.rst | 3 ++ setup.cfg | 3 -- src/virtualenv/activation/__init__.py | 2 - src/virtualenv/activation/xonsh/__init__.py | 14 ------ src/virtualenv/activation/xonsh/activate.xsh | 46 -------------------- tests/unit/activation/test_xonsh.py | 38 ---------------- 6 files changed, 3 insertions(+), 103 deletions(-) create mode 100644 docs/changelog/2160.removal.rst delete mode 100644 src/virtualenv/activation/xonsh/__init__.py delete mode 100644 src/virtualenv/activation/xonsh/activate.xsh delete mode 100644 tests/unit/activation/test_xonsh.py diff --git a/docs/changelog/2160.removal.rst b/docs/changelog/2160.removal.rst new file mode 100644 index 000000000..5037dc95e --- /dev/null +++ b/docs/changelog/2160.removal.rst @@ -0,0 +1,3 @@ +Removed ``xonsh`` activator due to this breaking fairly often the CI and lack of support from those packages +maintainers, upstream is encouraged to continue supporting the project as a +`plugin `_ - by :user:`gaborbernat`. diff --git a/setup.cfg b/setup.cfg index 9a66f5b71..6baf8e16d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -66,7 +66,6 @@ virtualenv.activate = fish = virtualenv.activation.fish:FishActivator powershell = virtualenv.activation.powershell:PowerShellActivator python = virtualenv.activation.python:PythonActivator - xonsh = virtualenv.activation.xonsh:XonshActivator virtualenv.create = venv = virtualenv.create.via_global_ref.venv:Venv cpython3-posix = virtualenv.create.via_global_ref.builtin.cpython.cpython3:CPython3Posix @@ -103,7 +102,6 @@ testing = pytest-randomly>=1 pytest-timeout>=1 packaging>=20.0;python_version>"3.4" - xonsh>=0.9.16;python_version > '3.4' and python_version != '3.9' [options.package_data] virtualenv.activation.bash = *.sh @@ -111,7 +109,6 @@ virtualenv.activation.batch = *.bat virtualenv.activation.cshell = *.csh virtualenv.activation.fish = *.fish virtualenv.activation.powershell = *.ps1 -virtualenv.activation.xonsh = *.xsh virtualenv.seed.wheels.embed = *.whl [sdist] diff --git a/src/virtualenv/activation/__init__.py b/src/virtualenv/activation/__init__.py index fa2f0b4af..962cdf794 100644 --- a/src/virtualenv/activation/__init__.py +++ b/src/virtualenv/activation/__init__.py @@ -6,12 +6,10 @@ from .fish import FishActivator from .powershell import PowerShellActivator from .python import PythonActivator -from .xonsh import XonshActivator __all__ = [ "BashActivator", "PowerShellActivator", - "XonshActivator", "CShellActivator", "PythonActivator", "BatchActivator", diff --git a/src/virtualenv/activation/xonsh/__init__.py b/src/virtualenv/activation/xonsh/__init__.py deleted file mode 100644 index d92411c20..000000000 --- a/src/virtualenv/activation/xonsh/__init__.py +++ /dev/null @@ -1,14 +0,0 @@ -from __future__ import absolute_import, unicode_literals - -from virtualenv.util.path import Path - -from ..via_template import ViaTemplateActivator - - -class XonshActivator(ViaTemplateActivator): - def templates(self): - yield Path("activate.xsh") - - @classmethod - def supports(cls, interpreter): - return interpreter.version_info >= (3, 5) diff --git a/src/virtualenv/activation/xonsh/activate.xsh b/src/virtualenv/activation/xonsh/activate.xsh deleted file mode 100644 index c77ea6278..000000000 --- a/src/virtualenv/activation/xonsh/activate.xsh +++ /dev/null @@ -1,46 +0,0 @@ -"""Xonsh activate script for virtualenv""" -from xonsh.tools import get_sep as _get_sep - -def _deactivate(args): - if "pydoc" in aliases: - del aliases["pydoc"] - - if ${...}.get("_OLD_VIRTUAL_PATH", ""): - $PATH = $_OLD_VIRTUAL_PATH - del $_OLD_VIRTUAL_PATH - - if ${...}.get("_OLD_VIRTUAL_PYTHONHOME", ""): - $PYTHONHOME = $_OLD_VIRTUAL_PYTHONHOME - del $_OLD_VIRTUAL_PYTHONHOME - - if "VIRTUAL_ENV" in ${...}: - del $VIRTUAL_ENV - - if "VIRTUAL_ENV_PROMPT" in ${...}: - del $VIRTUAL_ENV_PROMPT - - if "nondestructive" not in args: - # Self destruct! - del aliases["deactivate"] - - -# unset irrelevant variables -_deactivate(["nondestructive"]) -aliases["deactivate"] = _deactivate - -$VIRTUAL_ENV = r"__VIRTUAL_ENV__" - -$_OLD_VIRTUAL_PATH = $PATH -$PATH = $PATH[:] -$PATH.add($VIRTUAL_ENV + _get_sep() + "__BIN_NAME__", front=True, replace=True) - -if ${...}.get("PYTHONHOME", ""): - # unset PYTHONHOME if set - $_OLD_VIRTUAL_PYTHONHOME = $PYTHONHOME - del $PYTHONHOME - -$VIRTUAL_ENV_PROMPT = "__VIRTUAL_PROMPT__" -if not $VIRTUAL_ENV_PROMPT: - del $VIRTUAL_ENV_PROMPT - -aliases["pydoc"] = ["python", "-m", "pydoc"] diff --git a/tests/unit/activation/test_xonsh.py b/tests/unit/activation/test_xonsh.py deleted file mode 100644 index 0b5db3abc..000000000 --- a/tests/unit/activation/test_xonsh.py +++ /dev/null @@ -1,38 +0,0 @@ -from __future__ import absolute_import, unicode_literals - -import sys - -import pytest -from flaky import flaky - -from virtualenv.activation import XonshActivator - - -@pytest.mark.slow -@pytest.mark.skipif( - sys.platform == "win32" or sys.version_info[0:2] >= (3, 9), - reason="xonsh on 3.9 or Windows is broken - https://github.com/xonsh/xonsh/issues/3689", -) -@flaky(max_runs=2, min_passes=1) -def test_xonsh(activation_tester_class, activation_tester): - class Xonsh(activation_tester_class): - def __init__(self, session): - super(Xonsh, self).__init__( - XonshActivator, - session, - "xonsh.exe" if sys.platform == "win32" else "xonsh", - "activate.xsh", - "xsh", - ) - self._invoke_script = [sys.executable, "-m", "xonsh"] - self._version_cmd = [sys.executable, "-m", "xonsh", "--version"] - - def env(self, tmp_path): - env = super(Xonsh, self).env(tmp_path) - env.update({"XONSH_DEBUG": "1", "XONSH_SHOW_TRACEBACK": "True"}) - return env - - def activate_call(self, script): - return "{} {}".format(self.activate_cmd, repr(str(script))).strip() - - activation_tester(Xonsh)