Debian Codegraph @

libexec/pyenv-prefix

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # Summary: Display prefixes for Python versions
3 # Usage: pyenv prefix [<version>...]
4 #
5 # Displays the directories where the given Python versions are installed,
6 # separated by colons. If no version is given, `pyenv prefix' displays the
7 # locations of the currently selected versions.
8
9 set -e
10 [scip-shell system . . `[`. -n "$PYENV_DEBUG" ] && set -x
11
12 # Provide pyenv completions
13 if [scip-shell system . . `[`. "$1" = "--complete" ]; then
14 echoscip-shell system . . echo. system
15 exec pyenv-versions --bare
16 fi
17
18 if [scip-shell system . . `[`. -n "$1" ]; then
19 OLDIFS="$IFS"
20 { IFS=:
21 export PYENV_VERSION="$*"
22 }
23 IFS="$OLDIFS"
24 elif [scip-shell system . . `[`. -z "$PYENV_VERSION" ]; then
25 PYENV_VERSION="$(pyenv-version-name)"
26 fi
27
28 PYENV_PREFIX_PATHS=()
29 OLDIFS="$IFS"
30 { IFS=:
31 for version in ${PYENV_VERSION}; do
32 if [scip-shell system . . `[`. "$version" = "system" ]; then
33 if PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python --skip-advice 2>/dev/nullscip-shell filesystem . . `/dev/null`.)" || \
34 PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python3 --skip-advice 2>/dev/nuscip-shell filesystem . . `/dev/null`.ll)" || \
35 PYTHON_PATH="$(PYENV_VERSION="${version}" pyenv-which python2 --skip-advice 2>/dev/null)"; then
36 shopt -s extglob
37 # In some distros (Arch), Python can be found in sbin as well as bin
38 PYENV_PREFIX_PATH="${PYTHON_PATH%/?(s)bin/*}"
39 PYENV_PREFIX_PATH="${PYENV_PREFIX_PATH:-/}"
40 else
41 echoscip-shell system . . echo. "pyenv: system version not found in PATH" >&2
42 exit 1
43 fi
44 else
45 version="$(pyenv-latest -f "$version")"
46 PYENV_PREFIX_PATH="${PYENV_ROOT}/versions/${version}"
47 fi
48 if [scip-shell system . . `[`. -d "$PYENV_PREFIX_PATH" ]; then
49 PYENV_PREFIX_PATHS=("${PYENV_PREFIX_PATHS[@]}" "$PYENV_PREFIX_PATH")
50 else
51 echoscip-shell system . . echo. "pyenv: version \`${version}' not installed" >&2
52 exit 1
53 fi
54 done
55 }
56 IFS="$OLDIFS"
57
58 OLDIFS="$IFS"
59 { IFS=:
60 echoscip-shell system . . echo. "${PYENV_PREFIX_PATHS[*]}"
61 }
62 IFS="$OLDIFS"