| #! /bin/sh |
| |
| pycode=/bin/craftui.py |
| cw=/usr/catawampus |
| devcw=../../../../vendor/google/catawampus |
| tornado= |
| devtornado=../../../../vendor/opensource/tornado |
| localwww=./www |
| |
| # in developer environment if vendor/google/catawapus is above us |
| if [ -d "$devcw" ]; then |
| sim=1 |
| fi |
| |
| if [ -n "$sim" ] && [ "$1" = "-2" ]; then |
| sim=2 |
| shift |
| fi |
| |
| # if running from developer desktop, use simulated data |
| if [ -n "$sim" ]; then |
| cw="$devcw" |
| tornado="$devtornado" |
| args="$args --http-port=$((8888+2*($sim-1)))" |
| args="$args --https-port=$((8889+2*($sim-1)))" |
| args="$args --sim=./sim$sim" |
| pycode=./craftui_fortesting.py |
| export PATH="$PWD/sim1/bin:$PATH" |
| fi |
| |
| # for debugging on the device, use the local (/tmp/www?) web tree |
| if [ -d "$localwww" ]; then |
| args="$args --www=$localwww" |
| fi |
| |
| # command line parsing |
| while [ $# -gt 0 ]; do |
| # enable debugger |
| if [ "$1" = -d ]; then |
| debug="-m pdb" |
| shift |
| continue |
| fi |
| |
| echo "$0: '$1': unknown command line option" >&2 |
| exit 1 |
| done |
| |
| export PYTHONPATH="$tornado:$cw/tr/vendor/curtain:$PYTHONPATH" |
| exec python -u $debug $pycode $args $httpsmode |