comparison env/lib/python3.7/site-packages/virtualenv/activation/xonsh/activate.xsh @ 0:26e78fe6e8c4 draft

"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
author shellac
date Sat, 02 May 2020 07:14:21 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:26e78fe6e8c4
1 """Xonsh activate script for virtualenv"""
2 from xonsh.tools import get_sep as _get_sep
3
4 def _deactivate(args):
5 if "pydoc" in aliases:
6 del aliases["pydoc"]
7
8 if ${...}.get("_OLD_VIRTUAL_PATH", ""):
9 $PATH = $_OLD_VIRTUAL_PATH
10 del $_OLD_VIRTUAL_PATH
11
12 if ${...}.get("_OLD_VIRTUAL_PYTHONHOME", ""):
13 $PYTHONHOME = $_OLD_VIRTUAL_PYTHONHOME
14 del $_OLD_VIRTUAL_PYTHONHOME
15
16 if "VIRTUAL_ENV" in ${...}:
17 del $VIRTUAL_ENV
18
19 if "VIRTUAL_ENV_PROMPT" in ${...}:
20 del $VIRTUAL_ENV_PROMPT
21
22 if "nondestructive" not in args:
23 # Self destruct!
24 del aliases["deactivate"]
25
26
27 # unset irrelevant variables
28 _deactivate(["nondestructive"])
29 aliases["deactivate"] = _deactivate
30
31 $VIRTUAL_ENV = r"__VIRTUAL_ENV__"
32
33 $_OLD_VIRTUAL_PATH = $PATH
34 $PATH = $PATH[:]
35 $PATH.add($VIRTUAL_ENV + _get_sep() + "__BIN_NAME__", front=True, replace=True)
36
37 if ${...}.get("PYTHONHOME", ""):
38 # unset PYTHONHOME if set
39 $_OLD_VIRTUAL_PYTHONHOME = $PYTHONHOME
40 del $PYTHONHOME
41
42 $VIRTUAL_ENV_PROMPT = "__VIRTUAL_PROMPT__"
43 if not $VIRTUAL_ENV_PROMPT:
44 del $VIRTUAL_ENV_PROMPT
45
46 aliases["pydoc"] = ["python", "-m", "pydoc"]