diff options
author | André Erdmann <dywi@mailerd.de> | 2013-09-11 16:22:22 +0200 |
---|---|---|
committer | André Erdmann <dywi@mailerd.de> | 2013-09-11 16:22:22 +0200 |
commit | d9be1d1fd540e7fa04f1de6b47b0394410a69b2e (patch) | |
tree | 835e2eacaf2fff3b2a5ab4d24ceacc8f3616356d /bin/invoke_pyscript_multi.bash | |
parent | move debug-scripts/, roverlay.py to bin/ (diff) | |
download | R_overlay-d9be1d1fd540e7fa04f1de6b47b0394410a69b2e.tar.gz R_overlay-d9be1d1fd540e7fa04f1de6b47b0394410a69b2e.tar.bz2 R_overlay-d9be1d1fd540e7fa04f1de6b47b0394410a69b2e.zip |
move run_tests to bin/
Diffstat (limited to 'bin/invoke_pyscript_multi.bash')
-rwxr-xr-x | bin/invoke_pyscript_multi.bash | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/invoke_pyscript_multi.bash b/bin/invoke_pyscript_multi.bash new file mode 100755 index 0000000..73711cd --- /dev/null +++ b/bin/invoke_pyscript_multi.bash @@ -0,0 +1,35 @@ +#!/bin/bash +# similar to invoke_pyscript.bash, but runs the python script once for +# each python implementation (PYTHON_IMPL). +# +# Also contains some script-specific code, +# e.g. creates a R-overlay.conf.tests file. +# + +: ${PYTHON_IMPL:="python2.7 python3"} + +readonly SCRIPT=$(readlink -f "${BASH_SOURCE[0]?}") +readonly SCRIPT_NAME="${BASH_SOURCE[0]##*/}" +readonly SCRIPT_DIR="${SCRIPT%/*}" + +readonly PRJROOT="${SCRIPT_DIR%/*}" +readonly PYSCRIPT="${SCRIPT_DIR}/py/${SCRIPT_NAME%.*}.py" + +readonly CONFIG_FILE="${PRJROOT}/R-overlay.conf" + +export PYTHONPATH="${PRJROOT}${PYTHONPATH:+:}${PYTHONPATH}" + + +cd "${PRJROOT}" || exit + + +[[ -e "${CONFIG_FILE}.tests" ]] || ln -vs -- "${CONFIG_FILE}"{,.tests} || exit 2 + +for _py in ${PYTHON_IMPL}; do + if which "${_py}" 1>/dev/null 2>/dev/null; then + echo "Running ${PYSCRIPT##*/} with PYTHON=${_py}" + "${_py}" "${PYSCRIPT}" || exit + else + echo "PYTHON=${_py} not found." 1>&2 + fi +done |