File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 3030 exit 1
3131fi
3232
33+ # Look up python installations, starting with 3 with a fallback of 2
34+ if [ -x " $( command -v python3) " ]
35+ then
36+ PY=" $( command -v python3) "
37+ elif [ -x " $( command -v python) " ]
38+ then
39+ PY=" $( command -v python) "
40+ elif [ -x " $( command -v python2) " ]
41+ then
42+ PY=" $( command -v python2) "
43+ else
44+ echo " ERROR: No working python installation was found"
45+ echo " Please install python and add it to the PATH variable"
46+ exit 1
47+ fi
48+
3349# Function that compares two versions strings v1 and v2 given in arguments (e.g 1.31 and 1.33.0).
3450# Returns 1 if v1 > v2, 0 if v1 == v2, 2 if v1 < v2.
3551function vercomp() {
@@ -86,7 +102,7 @@ Path=${1:-rustlings/}
86102echo " Cloning Rustlings at $Path ..."
87103git clone -q https://github.com/rust-lang/rustlings $Path
88104
89- Version=$( curl -s https://api.github.com/repos/rust-lang/rustlings/releases/latest | python -c " import json,sys;obj=json.load(sys.stdin);print(obj['tag_name']);" )
105+ Version=$( curl -s https://api.github.com/repos/rust-lang/rustlings/releases/latest | ${PY} -c " import json,sys;obj=json.load(sys.stdin);print(obj['tag_name']);" )
90106CargoBin=" ${CARGO_HOME:- $HOME / .cargo} /bin"
91107
92108echo " Checking out version $Version ..."
You can’t perform that action at this time.
0 commit comments