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 30
30
exit 1
31
31
fi
32
32
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
+
33
49
# Function that compares two versions strings v1 and v2 given in arguments (e.g 1.31 and 1.33.0).
34
50
# Returns 1 if v1 > v2, 0 if v1 == v2, 2 if v1 < v2.
35
51
function vercomp() {
@@ -86,7 +102,7 @@ Path=${1:-rustlings/}
86
102
echo " Cloning Rustlings at $Path ..."
87
103
git clone -q https://github.com/rust-lang/rustlings $Path
88
104
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']);" )
90
106
CargoBin=" ${CARGO_HOME:- $HOME / .cargo} /bin"
91
107
92
108
echo " Checking out version $Version ..."
You can’t perform that action at this time.
0 commit comments