-
Notifications
You must be signed in to change notification settings - Fork 8
/
logos
executable file
·84 lines (77 loc) · 2.2 KB
/
logos
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
SCRIPT_NAME=`readlink $0`
if test -x "$SCRIPT_NAME";
then
LOGOS_DIRNAME=`dirname $SCRIPT_NAME`
else
LOGOS_DIRNAME=`dirname $0`
fi
LOGOS_DIR=`(cd $LOGOS_DIRNAME; pwd)`
# set up run keywords
# "ARGS" stores command line arguments not treated in this file (passed through)
declare -a ARGS
# by default run in "dev" mode
MODE='dev'
# loop through arguments and look for those that are handled before Python is called
while test $# -gt 0
do
case "$1" in
-D)
# run in development mode (assertions not stripped)
MODE='dev'
;;
--help)
# display "help" print
MODE='help'
;;
*)
# otherwise, pass through arguments to logos_main.py
ARGS[${#ARGS[@]}]="$1"
esac
shift
done
PYTHON_COMMAND=${PYTHON_COMMAND:=python}
# if there's no file to run after parsing arguments, run "help" after warning of the problem.
if [ ${#ARGS[@]} -eq 0 ]; then
echo ''
echo 'ERROR: No input file specified! See options below.'
MODE='help'
fi
# run Driver.py based on the mode chosen
case $MODE in
'opt' )
echo 'Running LOGOS in "opt" mode.'
$PYTHON_COMMAND -O $LOGOS_DIR/src/logos_main.py "${ARGS[@]}"
;;
'dev' )
echo 'Running LOGOS in "dev" mode.'
$PYTHON_COMMAND $LOGOS_DIR/src/logos_main.py "${ARGS[@]}"
;;
'help' )
echo ''
echo ' ------------------------------------------'
echo ' Default usage:'
echo ' logos -i filename.xml -o outputfilename.o'
echo ''
echo ' Description:'
echo ' This will run LOGOS in "opt" mode using "filename.xml" as the input. This should be'
echo ' sufficient for the majority of LOGOS calculations. For more options, see below.'
echo ' ------------------------------------------'
echo ''
echo ' Advanced usage:'
echo ' logos filename [-D]'
echo ''
echo ' Description:'
echo ' Runs LOGOS using the input file given by "filename".'
echo ''
echo ' Options:'
echo ' -D'
echo ' Development mode. Turns Python "assert" statements on.'
echo ''
echo ' --help'
echo ' Shows this description and exits.'
echo ''
;;
*)
echo 'Unrecognized MODE "'${MODE}'" in LOGOS_framework! Exiting ...'
esac