Advertisement
Guest User

activate_script.sh

a guest
Apr 24th, 2018
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. (python3) jespinozlt-osx:~ jespinoz$ which activate
  2. /Users/jespinoz/anaconda/bin/activate
  3. (python3) jespinozlt-osx:~ jespinoz$ cat /Users/jespinoz/anaconda/bin/activate
  4. #!/bin/sh
  5. _CONDA_ROOT="/Users/jespinoz/anaconda"
  6. \. "$_CONDA_ROOT/etc/profile.d/conda.sh" || return $?
  7. _conda_activate "$@"
  8. (python3) jespinozlt-osx:~ jespinoz$ cat ~/anaconda/etc/profile.d/conda.sh
  9. _CONDA_EXE="/Users/jespinoz/anaconda/bin/conda"
  10. _CONDA_ROOT="/Users/jespinoz/anaconda"
  11. _conda_set_vars() {
  12. # set _CONDA_SHELL_FLAVOR
  13. if [ -n "${BASH_VERSION:+x}" ]; then
  14. _CONDA_SHELL_FLAVOR=bash
  15. elif [ -n "${ZSH_VERSION:+x}" ]; then
  16. _CONDA_SHELL_FLAVOR=zsh
  17. elif [ -n "${KSH_VERSION:+x}" ]; then
  18. _CONDA_SHELL_FLAVOR=ksh
  19. elif [ -n "${POSH_VERSION:+x}" ]; then
  20. _CONDA_SHELL_FLAVOR=posh
  21. else
  22. # default to dash; if we run into a problem here, please raise an issue
  23. _CONDA_SHELL_FLAVOR=dash
  24. fi
  25.  
  26. if [ -z "${_CONDA_EXE+x}" ]; then
  27. if [ -n "${_CONDA_ROOT:+x}" ]; then
  28. # typically this should be for dev only; _CONDA_EXE should be written at top of file
  29. # for normal installs
  30. _CONDA_EXE="$_CONDA_ROOT/conda/shell/bin/conda"
  31. fi
  32. if ! [ -f "${_CONDA_EXE-x}" ]; then
  33. _CONDA_EXE="$PWD/conda/shell/bin/conda"
  34. fi
  35. fi
  36.  
  37. # We're not allowing PS1 to be unbound. It must at least be set.
  38. # However, we're not exporting it, which can cause problems when starting a second shell
  39. # via a first shell (i.e. starting zsh from bash).
  40. if [ -z "${PS1+x}" ]; then
  41. PS1=
  42. fi
  43.  
  44. }
  45.  
  46.  
  47. _conda_hashr() {
  48. case "$_CONDA_SHELL_FLAVOR" in
  49. zsh) \rehash;;
  50. posh) ;;
  51. *) \hash -r;;
  52. esac
  53. }
  54.  
  55.  
  56. _conda_activate() {
  57. if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
  58. # Handle transition from shell activated with conda <= 4.3 to a subsequent activation
  59. # after conda updated to >= 4.4. See issue #6173.
  60. PS1="$CONDA_PS1_BACKUP"
  61. \unset CONDA_PS1_BACKUP
  62. fi
  63.  
  64. \local ask_conda
  65. ask_conda="$(PS1="$PS1" $_CONDA_EXE shell.posix activate "$@")" || \return $?
  66. \eval "$ask_conda"
  67.  
  68. _conda_hashr
  69. }
  70.  
  71. _conda_deactivate() {
  72. \local ask_conda
  73. ask_conda="$(PS1="$PS1" $_CONDA_EXE shell.posix deactivate "$@")" || \return $?
  74. \eval "$ask_conda"
  75.  
  76. _conda_hashr
  77. }
  78.  
  79. _conda_reactivate() {
  80. \local ask_conda
  81. ask_conda="$(PS1="$PS1" $_CONDA_EXE shell.posix reactivate)" || \return $?
  82. \eval "$ask_conda"
  83.  
  84. _conda_hashr
  85. }
  86.  
  87.  
  88. conda() {
  89. if [ "$#" -lt 1 ]; then
  90. $_CONDA_EXE
  91. else
  92. \local cmd="$1"
  93. shift
  94. case "$cmd" in
  95. activate)
  96. _conda_activate "$@"
  97. ;;
  98. deactivate)
  99. _conda_deactivate "$@"
  100. ;;
  101. install|update|uninstall|remove)
  102. $_CONDA_EXE "$cmd" "$@" && _conda_reactivate
  103. ;;
  104. *)
  105. $_CONDA_EXE "$cmd" "$@"
  106. ;;
  107. esac
  108. fi
  109. }
  110.  
  111.  
  112. _conda_set_vars
  113.  
  114. if [ -z "${CONDA_SHLVL+x}" ]; then
  115. \export CONDA_SHLVL=0
  116. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement