diff options
author | imarom <imarom@cisco.com> | 2015-12-27 07:26:45 -0500 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2015-12-27 07:27:36 -0500 |
commit | 0313eff6cf984bd2a5289091299da79eccfc4bc8 (patch) | |
tree | 61f44c8d61724ac5f80171969c8695acdf5131a9 | |
parent | aec3c8f4a0fe4da9a964a051d86fae808f336a55 (diff) |
script to support CEL python
-rwxr-xr-x | scripts/trex-console | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/scripts/trex-console b/scripts/trex-console index 22a47eb8..9e01dd16 100755 --- a/scripts/trex-console +++ b/scripts/trex-console @@ -1,2 +1,31 @@ #!/bin/bash -automation/trex_control_plane/console/trex_console.py $@ + +# 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 [ $? -ne 0 ]; then + PYTHON=$CEL_PYTHON + PCHECK=`$PYTHON -c "import sys; ver = sys.version_info[0] * 10 + sys.version_info[1];sys.exit(ver < 27)"` + + if [ $? -ne 0 ]; then + echo "*** $PYTHON - python version is too old, 2.7 at least is required" + exit -1 + fi + + fi + +} + +if [ -z "$PYTHON" ]; then + find_python +fi + +$PYTHON automation/trex_control_plane/console/trex_console.py $@ + |