summaryrefslogtreecommitdiffstats
path: root/scripts/find_python.sh
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-01-18 22:00:51 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-01-18 22:00:51 +0200
commiteee866f42bd0fc8472e6295b4f26bd0697e59f1f (patch)
treeb16947052643d6a0c7dd20012f0a1d664d044444 /scripts/find_python.sh
parentc88f411b3a69d6ea56c6b9758b10c30b87a6c94b (diff)
regression:
corrections of benchmarks move packet builder tests to functional folder add CPU utilization boundries for more tests print Skipping message fix relative drop counting API: convert hostname to IP at init of client side (trex_client.py) various: move python path determination to external common file add functional tests running bash script add sudo check to t-rex-64
Diffstat (limited to 'scripts/find_python.sh')
-rwxr-xr-xscripts/find_python.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/find_python.sh b/scripts/find_python.sh
new file mode 100755
index 00000000..260ddaf7
--- /dev/null
+++ b/scripts/find_python.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+# if no variable of $PYTHON is define - we try to find it
+function find_python {
+ # two candidates - machine python and cisco linux python
+ MACHINE_PYTHON=python
+ CEL_PYTHON=/router/bin/python
+
+ # try the machine python
+ PYTHON=$MACHINE_PYTHON
+ PCHECK=`$PYTHON -c "import sys; ver = sys.version_info[0] * 10 + sys.version_info[1];sys.exit(ver < 27)"`
+ if [ $? -eq 0 ]; then
+ return
+ fi
+
+ # try the CEL python
+ PYTHON=$CEL_PYTHON
+ PCHECK=`$PYTHON -c "import sys; ver = sys.version_info[0] * 10 + sys.version_info[1];sys.exit(ver < 27)"`
+ if [ $? -eq 0 ]; then
+ return
+ fi
+
+ echo "*** $PYTHON - python version is too old, 2.7 at least is required"
+ exit -1
+}
+
+if [ -z "$PYTHON" ]; then
+ find_python
+fi
+