-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrfgengou
More file actions
executable file
·46 lines (38 loc) · 1.4 KB
/
rfgengou
File metadata and controls
executable file
·46 lines (38 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
run(){
"${PYTHON}" "`dirname "$0"`/rfGengouCmd.py" $*
exit $?
}
PYTHON_CHECK="import sys;exit(not((sys.version_info[0]==3 and sys.version_info[1]>=3) or (sys.version_info[0]==2 and sys.version_info[1]>=3)))"
# check as installed command
PYTHON=`dirname "$0"`/python
if "${PYTHON}" -c "${PYTHON_CHECK}" >/dev/null 2>&1 ; then run ; fi
# check as installed command in official package on mac
PYTHON=`dirname "$0"`/python3
if "${PYTHON}" -c "${PYTHON_CHECK}" >/dev/null 2>&1 ; then run ; fi
# check PYTHON env
if test -n "${PYTHON}" ; then
if "${PYTHON}" -c "${PYTHON_CHECK}" >/dev/null 2>&1 ; then run ; fi
fi
# check PATH
for V in "" 3 3.8 3.7 3.6 3.5 3.4 3.3 2 2.7 2.6 2.5 2.4 2.3 ; do
PYTHON=python$V
if "${PYTHON}" -c "${PYTHON_CHECK}" >/dev/null 2>&1 ; then run ; fi
done
# check pyenv
if test -n "${PYENV_ROOT}" ; then
for V in `ls -vr "${PYENV_ROOT}/versions"` ; do
PYTHON=${PYENV_ROOT}/versions/$V/bin/python
if "${PYTHON}" -c "${PYTHON_CHECK}" >/dev/null 2>&1 ; then run ; fi
done
fi
# check official package on mac
if test -d /Library/Frameworks/Python.framework ; then
for V in 3.8 3.7 3.6 3.5 3.4 3.3 2.7 2.6 2.5 2.4 2.3 ; do
PYTHON=/Library/Frameworks/Python.framework/Versions/$V/bin/python$V
if "${PYTHON}" -c "${PYTHON_CHECK}" >/dev/null 2>&1 ; then run ; fi
done
fi
echo "python not found"
echo "please install python 3.3 (or later) or 2.3 (or later)"
exit 127