Debian Codegraph @

libexec/pyenv-version-file

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2 # Usage: pyenv version-file [<dir>]
3 # Summary: Detect the file that sets the current pyenv version
4 set -e
5 [scip-shell system . . `[`. -n "$PYENV_DEBUG" ] && set -x
6
7 target_dir="$1"
8
9 find_local_version_filescip-shell shell shell-project 0.0.0 find_local_version_file().() {
10 local root="$1"
11 while ! [[ "$root" =~ ^//[^/]*$ ]]; do
12 if [scip-shell system . . `[`. -f "${root}/.python-version" ]; then
13 echoscip-shell system . . echo. "${root}/.python-version"
14 return 0
15 fi
16 [scip-shell system . . `[`. -n "$root" ] || break
17 root="${root%/*}"
18 done
19 return 1
20 }
21
22 if [scip-shell system . . `[`. -n "$target_dir" ]; then
23 find_local_version_filescip-shell shell shell-project 0.0.0 find_local_version_file(). "$target_dir"
24 else
25 find_local_version_filescip-shell shell shell-project 0.0.0 find_local_version_file(). "$PYENV_DIR" || {
26 [scip-shell system . . `[`. "$PYENV_DIR" != "$PWD" ] && find_local_version_filescip-shell shell shell-project 0.0.0 find_local_version_file(). "$PWD"
27 } || echoscip-shell system . . echo. "${PYENV_ROOT}/version"
28 fi