You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1022 B

4 years ago
  1. """Xonsh activate script for virtualenv"""
  2. from xonsh.tools import get_sep as _get_sep
  3. def _deactivate(args):
  4. if "pydoc" in aliases:
  5. del aliases["pydoc"]
  6. if ${...}.get("_OLD_VIRTUAL_PATH", ""):
  7. $PATH = $_OLD_VIRTUAL_PATH
  8. del $_OLD_VIRTUAL_PATH
  9. if ${...}.get("_OLD_VIRTUAL_PYTHONHOME", ""):
  10. $PYTHONHOME = $_OLD_VIRTUAL_PYTHONHOME
  11. del $_OLD_VIRTUAL_PYTHONHOME
  12. if "VIRTUAL_ENV" in ${...}:
  13. del $VIRTUAL_ENV
  14. if "nondestructive" not in args:
  15. # Self destruct!
  16. del aliases["deactivate"]
  17. # unset irrelevant variables
  18. _deactivate(["nondestructive"])
  19. aliases["deactivate"] = _deactivate
  20. $VIRTUAL_ENV = r"/home/alpcentaur/ProjektA/PrototypeWebApp/venv"
  21. $_OLD_VIRTUAL_PATH = $PATH
  22. $PATH = $PATH[:]
  23. $PATH.add($VIRTUAL_ENV + _get_sep() + "bin", front=True, replace=True)
  24. if ${...}.get("PYTHONHOME", ""):
  25. # unset PYTHONHOME if set
  26. $_OLD_VIRTUAL_PYTHONHOME = $PYTHONHOME
  27. del $PYTHONHOME
  28. aliases["pydoc"] = ["python", "-m", "pydoc"]