|
1 | 1 | #!/bin/bash |
2 | 2 |
|
| 3 | +# Ugly way to get any python interpreter. This is necessary because the script will run |
| 4 | +# both with Python 2.7 and Python 3.x under Travis. |
| 5 | +PYTHONS=$(which python3 python2.7 python) |
| 6 | +PYTHON=$(echo $PYTHONS | cut -d" " -f1) |
| 7 | + |
| 8 | +if [ -z "${PYTHON}" ]; then |
| 9 | + echo "ERROR: no Python interpreter found." |
| 10 | + exit 1 |
| 11 | +fi |
| 12 | +echo "Using Python interpreter ${PYTHON}" |
| 13 | + |
| 14 | +# Return an error if any of the following commands fails. |
| 15 | +set -e |
3 | 16 | echo "example1.cmd, --show-all-calls" |
4 | | -python3 cmd-call-graph.py --show-all-calls < examples/example1.cmd > examples/example1.dot |
| 17 | +${PYTHON} cmd-call-graph.py --show-all-calls < examples/example1.cmd > examples/example1.dot |
5 | 18 | echo |
6 | 19 | echo "example1.cmd, --show-all-calls --show-node-stats" |
7 | | -python3 cmd-call-graph.py --show-all-calls --show-node-stats < examples/example1.cmd > examples/example1-nodestats.dot |
| 20 | +${PYTHON} cmd-call-graph.py --show-all-calls --show-node-stats < examples/example1.cmd > examples/example1-nodestats.dot |
8 | 21 | echo |
9 | 22 | echo "example1.cmd, without --show-all-calls" |
10 | | -python3 cmd-call-graph.py < examples/example1.cmd > examples/example1-noshowall.dot |
| 23 | +${PYTHON} cmd-call-graph.py < examples/example1.cmd > examples/example1-noshowall.dot |
11 | 24 | echo |
12 | 25 | echo "loc.cmd, with --show-node-status and without --show-all-calls" |
13 | | -python3 cmd-call-graph.py --show-node-stats < examples/loc.cmd > examples/loc.dot |
| 26 | +${PYTHON} cmd-call-graph.py --show-node-stats < examples/loc.cmd > examples/loc.dot |
14 | 27 |
|
15 | 28 | dot -Tpng examples/example1.dot > examples/example1.png |
16 | 29 | dot -Tpng examples/example1-nodestats.dot > examples/example1-nodestats.png |
|
0 commit comments