Update script to test under Python 2, or 3, or both, as available.
Chris Pressey
2 years ago
0 | 0 | #!/bin/sh |
1 | 1 | |
2 | PYTHONPATH=src python2 src/feedmark/tests.py || exit 1 | |
3 | PYTHONPATH=src python3 src/feedmark/tests.py || exit 1 | |
2 | APPLIANCES="" | |
3 | ||
4 | if [ "x$PYTHON" != "x" ]; then | |
5 | if command -v "$PYTHON" > /dev/null 2>&1; then | |
6 | PYTHONPATH=src $PYTHON src/feedmark/tests.py || exit 1 | |
7 | else | |
8 | echo "$PYTHON not found on executable search path. Aborting." | |
9 | exit 1 | |
10 | fi | |
11 | else | |
12 | MISSING="" | |
13 | if command -v python2 > /dev/null 2>&1; then | |
14 | PYTHONPATH=src python2 src/feedmark/tests.py || exit 1 | |
15 | else | |
16 | MISSING="${MISSING}2" | |
17 | fi | |
18 | if command -v python3 > /dev/null 2>&1; then | |
19 | PYTHONPATH=src python3 src/feedmark/tests.py || exit 1 | |
20 | else | |
21 | MISSING="${MISSING}3" | |
22 | fi | |
23 | if [ "x${MISSING}" = "x23" ]; then | |
24 | echo "Neither python2 nor python3 found on executable search path. Aborting." | |
25 | exit 1 | |
26 | fi | |
27 | fi |