-
Notifications
You must be signed in to change notification settings - Fork 8
/
pyDriveWire
executable file
·42 lines (37 loc) · 898 Bytes
/
pyDriveWire
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
#!/bin/bash
pyenv=$(which pyenv)
if [ "X$pyenv" != "X" ]; then
if [ -z "${PYENV_ROOT}" ]; then
# pyenv setup for pyDriveWire
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
fi
eval "$(pyenv init -)"
for pyversion in "$(dirname ${0})/.python-version" "${HOME}/.python-version" "${HOME}/.pyenv/version"; do
if [ -e "${pyversion}" ]; then
pyenv shell "$(cat ${pyversion})"
break
fi
done
fi
python=$(which pypy)
if [ "X$python" == "X" ]; then
echo "WARNING: pypy was not found. It is recommended for maximum performance"
python=$(which python)
fi
if [ "X$python" == "X" ]; then
echo "ERROR: python was not found"
exit 1
fi
${python} <<EOF
try:
import serial
except:
exit(1)
EOF
if [ $? != 0 ]; then
echo "ERROR: pyserial is required!"
echo "Run: pypy -m pip install pyserial"
exit 1
fi
exec ${python} "$0.py" $*