conda.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. export CONDA_EXE='/croot/conda_1689269889729/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/bin/conda'
  2. export _CE_M=''
  3. export _CE_CONDA=''
  4. export CONDA_PYTHON_EXE='/croot/conda_1689269889729/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_p/bin/python'
  5. # Copyright (C) 2012 Anaconda, Inc
  6. # SPDX-License-Identifier: BSD-3-Clause
  7. __conda_exe() (
  8. "$CONDA_EXE" $_CE_M $_CE_CONDA "$@"
  9. )
  10. __conda_hashr() {
  11. if [ -n "${ZSH_VERSION:+x}" ]; then
  12. \rehash
  13. elif [ -n "${POSH_VERSION:+x}" ]; then
  14. : # pass
  15. else
  16. \hash -r
  17. fi
  18. }
  19. __conda_activate() {
  20. if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
  21. # Handle transition from shell activated with conda <= 4.3 to a subsequent activation
  22. # after conda updated to >= 4.4. See issue #6173.
  23. PS1="$CONDA_PS1_BACKUP"
  24. \unset CONDA_PS1_BACKUP
  25. fi
  26. \local ask_conda
  27. ask_conda="$(PS1="${PS1:-}" __conda_exe shell.posix "$@")" || \return
  28. \eval "$ask_conda"
  29. __conda_hashr
  30. }
  31. __conda_reactivate() {
  32. \local ask_conda
  33. ask_conda="$(PS1="${PS1:-}" __conda_exe shell.posix reactivate)" || \return
  34. \eval "$ask_conda"
  35. __conda_hashr
  36. }
  37. conda() {
  38. \local cmd="${1-__missing__}"
  39. case "$cmd" in
  40. activate|deactivate)
  41. __conda_activate "$@"
  42. ;;
  43. install|update|upgrade|remove|uninstall)
  44. __conda_exe "$@" || \return
  45. __conda_reactivate
  46. ;;
  47. *)
  48. __conda_exe "$@"
  49. ;;
  50. esac
  51. }
  52. if [ -z "${CONDA_SHLVL+x}" ]; then
  53. \export CONDA_SHLVL=0
  54. # In dev-mode CONDA_EXE is python.exe and on Windows
  55. # it is in a different relative location to condabin.
  56. if [ -n "${_CE_CONDA:+x}" ] && [ -n "${WINDIR+x}" ]; then
  57. PATH="$(\dirname "$CONDA_EXE")/condabin${PATH:+":${PATH}"}"
  58. else
  59. PATH="$(\dirname "$(\dirname "$CONDA_EXE")")/condabin${PATH:+":${PATH}"}"
  60. fi
  61. \export PATH
  62. # We're not allowing PS1 to be unbound. It must at least be set.
  63. # However, we're not exporting it, which can cause problems when starting a second shell
  64. # via a first shell (i.e. starting zsh from bash).
  65. if [ -z "${PS1+x}" ]; then
  66. PS1=
  67. fi
  68. fi