summaryrefslogtreecommitdiffstats
path: root/bin/run-python.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/run-python.sh')
-rwxr-xr-xbin/run-python.sh51
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 "$@"
+
+