-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmcumgr.sh
More file actions
32 lines (23 loc) · 819 Bytes
/
mcumgr.sh
File metadata and controls
32 lines (23 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
#
# wrapper to run cli.py in this dir and not the installed one, without
# modifications to pythons `sys.path` in source. for development and
# debug/test. (something about virtualenv...)
#
# note: could also run as module `python3 -m bblogger.cli` but that only works
# with correct PWD.
# `realpath` and `readlink -f` not on MacOS :(
_realpath()
{
python3 -c "import os; print(os.path.realpath('$1'))"
}
# Absolute path to this script
SCRIPT=$(_realpath "$0")
# Absolute path this script is in
SCRIPTPATH=$(dirname "$SCRIPT")
PYTHONPATH="$SCRIPTPATH:$PYTHONPATH"
# you can verify import paths with the following command
# PYTHONPATH="$PYTHONPATH" python3 -v $MCUMGR -h 2>&1
echo "PYTHONPATH: $PYTHONPATH" 1>&2
MCUMGR="$SCRIPTPATH/mcumgr/cli.py"
PYTHONPATH="$PYTHONPATH" python3 $MCUMGR "$@"