diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:47:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:47:37 +0000 |
commit | 00e2eb4fd0266c5be01e3a527a66aaad5ab4b634 (patch) | |
tree | a6a58bd544eb0b76b9d3acc678ea88791acca045 /bin/run-python.sh | |
parent | Initial commit. (diff) | |
download | libixion-00e2eb4fd0266c5be01e3a527a66aaad5ab4b634.tar.xz libixion-00e2eb4fd0266c5be01e3a527a66aaad5ab4b634.zip |
Adding upstream version 0.19.0.upstream/0.19.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin/run-python.sh')
-rwxr-xr-x | bin/run-python.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/bin/run-python.sh b/bin/run-python.sh new file mode 100755 index 0000000..ae8a53e --- /dev/null +++ b/bin/run-python.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +PYTHON=$(which python3) +PROGDIR=`dirname $0` +_PYTHONPATH="$PROGDIR/../src/python/.libs:$PROGDIR/../src/python" + +export PYTHONPATH=$_PYTHONPATH +export LD_LIBRARY_PATH="$PROGDIR/../src/libixion/.libs" +export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH + +if [ "$1" == "" ]; then + # No input file. Just invoke the interpreter. + $PYTHON + exit 0 +fi + +RUNMODE= + +if [ "$1" == "gdb" ]; then + RUNMODE=gdb + shift +elif [ "$1" == "valgrind" ]; then + RUNMODE=valgrind + shift +fi + +if [ ! -e "$1" ]; then + echo "file '$1' does not exist" + exit 1 +fi + +EXEC="$1" +shift + +case $RUNMODE in + gdb) + gdb --args $PYTHON "$PWD/$EXEC" "$@" + ;; + valgrind) + valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes $PYTHON "$PWD/$EXEC" "$@" + ;; + *) + exec "$PWD/$EXEC" "$@" + ;; +esac + +#CMD="$1" +#shift +#exec $PWD/$CMD "$@" + + |