File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 12
12
export CHUTNEY_PATH
13
13
fi
14
14
15
- binaries=" python3 python python2"
15
+ python_ok ()
16
+ {
17
+ checkpy=" $1 "
18
+ test -f " ${checkpy} " && \
19
+ test -x " ${checkpy} " && \
20
+ " ${checkpy} " -c ' import sys;sys.exit(sys.version_info[0]<3)'
21
+ }
22
+
23
+ binaries=" python3 python"
16
24
17
25
if ! test " ${PYTHON+y} "
18
26
then
31
39
;;
32
40
esac
33
41
abs_path=" ${directory}${binary} "
34
- if test -f " ${abs_path} " && test -x " ${abs_path} "
42
+ if python_ok " ${abs_path} "
35
43
then
36
44
PYTHON=" ${abs_path} "
37
45
break
44
52
fi
45
53
done
46
54
IFS=" ${saved_IFS} "
55
+ else
56
+ if ! python_ok " $( command -v " ${PYTHON} " ) "
57
+ then
58
+ echo " Python in \$ PYTHON envvar (\" $PYTHON \" ) is not present, or is not python 3." >&2
59
+ exit 1
60
+ fi
47
61
fi
48
62
49
63
if ! test " ${PYTHON+y} "
50
64
then
51
65
printf " No compatible Python version found.\n" >&2
52
- printf " Is Python installed and in your PATH?\n" >&2
66
+ printf " Is python 3 installed and in your PATH?\n" >&2
53
67
exit 1
54
68
fi
55
69
You can’t perform that action at this time.
0 commit comments