Commit 502fd1c 1 parent d13787e commit 502fd1c Copy full SHA for 502fd1c
File tree 1 file changed +8
-13
lines changed
1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -eo pipefail
4
4
5
- current_script_dir=" $(
6
- cd -- " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1
7
- pwd -P
8
- ) "
9
- plugin_dir=" $( dirname " $current_script_dir " ) "
10
-
11
- # shellcheck source=../lib/utils.bash
12
- source " ${plugin_dir} /lib/utils.bash"
13
-
14
- if [[ ! -x " $( command -v python) " ]]; then
15
- log_failure_and_exit " Python not found and is required for gcloud. Might I suggest https://github.com/danhper/asdf-python"
5
+ if [[ -x " $( command -v python3) " ]]; then
6
+ python_cmd=" python3"
7
+ elif [[ -x " $( command -v python) " ]]; then
8
+ python_cmd=" python"
9
+ else
10
+ printf " 🚨 %s\\ n" " Python not found and is required for gcloud. Might I suggest https://github.com/danhper/asdf-python"
11
+ exit 1
16
12
fi
17
13
18
14
# credit: https://unix.stackexchange.com/a/56846/397902
19
15
if [ -z " ${CLOUDSDK_PYTHON: +1} " ]; then
20
16
# undefined or defined and empty
21
- python_sdk=" $( command -v python) "
22
- export CLOUDSDK_PYTHON=${python_sdk}
17
+ export CLOUDSDK_PYTHON=" $python_cmd "
23
18
fi
You can’t perform that action at this time.
0 commit comments