From 6dcd891468779f499011c4722f6ce90e86df5221 Mon Sep 17 00:00:00 2001 From: Pierre LALET Date: Tue, 15 Mar 2016 09:08:41 +0100 Subject: [PATCH] Update scripts to call python2 instead of python when python is not version 2 --- run_scapy | 7 ++++++- test/run_tests | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/run_scapy b/run_scapy index c4723fe52..0f4611eee 100755 --- a/run_scapy +++ b/run_scapy @@ -1,3 +1,8 @@ #! /bin/sh DIR=$(dirname $0) -PYTHONPATH=$DIR exec python -m scapy.__init__ +if python --version | grep -q '^Python 2'; then + PYTHON=python +else + PYTHON=python2 +fi +PYTHONPATH=$DIR exec $PYTHON -m scapy.__init__ diff --git a/test/run_tests b/test/run_tests index 7df78972b..3f224ab6b 100755 --- a/test/run_tests +++ b/test/run_tests @@ -1,8 +1,13 @@ #! /bin/bash DIR=$(dirname $0)/.. +if python --version | grep -q '^Python 2'; then + PYTHON=python +else + PYTHON=python2 +fi if [ "$*" == "" ] then -PYTHONPATH=$DIR exec python ${DIR}/scapy/tools/UTscapy.py -t regression.uts -f html -l -o /tmp/scapy_regression_test_$(date +%Y%m%d-%H%M%S).html +PYTHONPATH=$DIR exec $PYTHON ${DIR}/scapy/tools/UTscapy.py -t regression.uts -f html -l -o /tmp/scapy_regression_test_$(date +%Y%m%d-%H%M%S).html else -PYTHONPATH=$DIR exec python ${DIR}/scapy/tools/UTscapy.py "$@" +PYTHONPATH=$DIR exec $PYTHON ${DIR}/scapy/tools/UTscapy.py "$@" fi