Skip to content

Commit

Permalink
pysim-run.sh: launches any app in BlockEditor
Browse files Browse the repository at this point in the history
Basically, this script acts as a launch wrapper around all .py
files in BlockEditor because of the exported PYTHONPATH envvar.

Signed-off-by: Stepan Pressl <[email protected]>
  • Loading branch information
zdebanos committed Jan 29, 2025
1 parent fbfe1f6 commit 482c59b
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion pysim-run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
#!/bin/sh

if [ $# -eq 0 ]; then
appname="pysimCoder"
else
# find all .py applications
applications=$(find BlockEditor -name "*.py" -execdir basename {} \; | sed s/.py//)
appname="$1"

# match whole words only
if ! echo $applications | grep -w "$appname" > /dev/null 2>&1 ; then
scriptname=$(basename $0)
echo "Usage: $scriptname APP APPARGS"
echo "APP is one of the following:"
echo "$applications"
exit 1
fi

# only APP arguments
shift
fi

export PYSUPSICTRL="$( cd "$(dirname "$0")" ; pwd )"

if [ -n "$PYTHONPATH" ] ; then
Expand All @@ -10,4 +30,4 @@ export PYTHONPATH=":$PYSUPSICTRL/resources/blocks/rcpBlk$PYTHONPATH"
export PYTHONPATH=":$PYSUPSICTRL/toolbox/supsictrl$PYTHONPATH"
export PYTHONPATH="$PYSUPSICTRL/toolbox/supsisim$PYTHONPATH"

/usr/bin/python3 "$PYSUPSICTRL/BlockEditor/pysimCoder.py" "$@"
/usr/bin/python3 "$PYSUPSICTRL/BlockEditor/$appname.py" "$@"

0 comments on commit 482c59b

Please sign in to comment.