Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

47 řádky
1.2 KiB

  1. # Anaconda comes with binaries of system packages (e.g. `openssl`, `curl`).
  2. # Creating shims for those binaries will prevent pyenv users to run those
  3. # commands normally when not using Anaconda.
  4. #
  5. # This hooks is intended to skip creating shims for those executables.
  6. conda_exists() {
  7. shopt -s nullglob
  8. local condas=($(echo "${PYENV_ROOT}/versions/"*"/bin/conda" "${PYENV_ROOT}/versions/"*"/envs/"*"/bin/conda"))
  9. shopt -u nullglob
  10. [ -n "${condas}" ]
  11. }
  12. shims=()
  13. for shim in $(cat "${BASH_SOURCE%/*}/conda.txt"); do
  14. if [ -n "${shim%%#*}" ]; then
  15. shims[${#shims[*]}]="${shim})return 0;;"
  16. fi
  17. done
  18. eval "conda_shim(){ case \"\$1\" in ${shims[@]} *)return 1;;esac;}"
  19. # override `make_shims` to avoid conflict between pyenv-virtualenv's `envs.bash`
  20. # https://github.com/yyuu/pyenv-virtualenv/blob/v20160716/etc/pyenv.d/rehash/envs.bash
  21. make_shims() {
  22. local file shim
  23. for file do
  24. shim="${file##*/}"
  25. if ! conda_shim "${shim}" 1>&2; then
  26. register_shim "$shim"
  27. fi
  28. done
  29. }
  30. deregister_conda_shims() {
  31. local shim
  32. local shims=()
  33. for shim in ${registered_shims}; do
  34. if ! conda_shim "${shim}" 1>&2; then
  35. shims[${#shims[*]}]="${shim}"
  36. fi
  37. done
  38. registered_shims=" ${shims[@]} "
  39. }
  40. if conda_exists; then
  41. deregister_conda_shims
  42. fi