您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

153 行
2.3 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 is a limited edition of https://github.com/yyuu/pyenv-which-ext
  6. # and it will looks for original `PATH` if there is Anaconda/Miniconda
  7. # installed and the command name is blacklisted.
  8. conda_exists() {
  9. shopt -s nullglob
  10. local condas=($(echo "${PYENV_ROOT}/versions/"*"/bin/conda" "${PYENV_ROOT}/versions/"*"/envs/"*"/bin/conda"))
  11. shopt -u nullglob
  12. [ -n "${condas}" ]
  13. }
  14. conda_shims() {
  15. ## curl
  16. cat <<EOS
  17. curl
  18. curl-config
  19. EOS
  20. ## fontconfig
  21. cat <<EOS
  22. fc-cache
  23. fc-cat
  24. fc-list
  25. fc-match
  26. fc-pattern
  27. fc-query
  28. fc-scan
  29. fc-validate
  30. EOS
  31. ## freetype
  32. cat <<EOS
  33. freetype-config
  34. EOS
  35. ## libpng
  36. cat <<EOS
  37. libpng-config
  38. EOS
  39. ## openssl
  40. cat <<EOS
  41. openssl
  42. EOS
  43. ## qtchooser
  44. cat <<EOS
  45. assistant
  46. designer
  47. lconvert
  48. linguist
  49. lrelease
  50. lupdate
  51. moc
  52. pixeltool
  53. qcollectiongenerator
  54. qdbus
  55. qdbuscpp2xml
  56. qdbusviewer
  57. qdbusxml2cpp
  58. qhelpconverter
  59. qhelpgenerator
  60. qmake
  61. qmlplugindump
  62. qmlviewer
  63. qtconfig
  64. rcc
  65. uic
  66. xmlpatterns
  67. xmlpatternsvalidator
  68. EOS
  69. ## redis
  70. cat <<EOS
  71. redis-benchmark
  72. redis-check-aof
  73. redis-check-dump
  74. redis-cli
  75. redis-server
  76. EOS
  77. ## sqlite3
  78. cat <<EOS
  79. sqlite3
  80. EOS
  81. ## libxml2
  82. cat <<EOS
  83. xml2-config
  84. EOS
  85. ## libxslt
  86. cat <<EOS
  87. xslt-config
  88. EOS
  89. ## xsltproc
  90. cat <<EOS
  91. xsltproc
  92. EOS
  93. }
  94. expand_path() {
  95. if [ ! -d "$1" ]; then
  96. return 1
  97. fi
  98. local cwd="$(pwd)"
  99. cd "$1"
  100. pwd
  101. cd "$cwd"
  102. }
  103. remove_from_path() {
  104. local path_to_remove="$(expand_path "$1")"
  105. local result=""
  106. if [ -z "$path_to_remove" ]; then
  107. echo "${PATH}"
  108. return
  109. fi
  110. local paths
  111. IFS=: paths=($PATH)
  112. for path in "${paths[@]}"; do
  113. path="$(expand_path "$path" || true)"
  114. if [ -n "$path" ] && [ "$path" != "$path_to_remove" ]; then
  115. result="${result}${path}:"
  116. fi
  117. done
  118. echo "${result%:}"
  119. }
  120. lookup_from_path() {
  121. local command_to_lookup="$1"
  122. local original_path="${PATH}"
  123. PATH="$(remove_from_path "${PYENV_ROOT}/shims")"
  124. local result="$(command -v "$command_to_lookup" || true)"
  125. PATH="${original_path}"
  126. echo "$result"
  127. }
  128. if [ -n "$PYENV_COMMAND" ] && [ ! -x "$PYENV_COMMAND_PATH" ]; then
  129. if conda_exists && conda_shims | grep -q -x "$PYENV_COMMAND"; then
  130. PYENV_COMMAND_PATH="$(lookup_from_path "$PYENV_COMMAND" || true)"
  131. fi
  132. fi