FIXED: Start ioscopy from gschem in a $COLORTERM
[oscopy.git] / ioscopy_app.sh
blob292740b59fb8f06be4d822139f24a8d71322e56a
1 #!/bin/sh
2 #-*-Shell-*-
4 IPYTHON=ipython
5 IOSCOPY=ioscopy
6 PYTHON=python
7 IOCFG=--IOscopyConfig
8 REPS="'-b': '$IOCFG.b=True $IOCFG.f=',\
9 '-i': '$IOCFG.i=True',\
10 '-h': '$IOCFG.h=True',\
11 '-H': '-h',\
12 '-q': '--no-banner --IOscopyConfig.quiet=True'"
14 getprofd () {
15 profd=`$IPYTHON --quick --profile=$IOSCOPY --no-banner --quiet --no-confirm-exit --classic<< EOF| grep /
16 ip=get_ipython()
17 print "\n" + ip.profile_dir.location + "\n"
18 EOF`;
21 $IPYTHON profile list --log-level=40 | grep $IOSCOPY > /dev/null
22 if [ $? -ne 0 ]; then
23 echo IPython $IOSCOPY profile not found, creating it.
24 $IPYTHON profile create $IOSCOPY
25 getprofd
26 cp @datarootdir@/oscopy/ipython_config.py $profd
27 else
28 getprofd
29 if [ ! -f "$profd/ipython_config.py" ]; then
30 echo IPython $IOSCOPY profile file not found, copying it.
31 cp @datarootdir@/oscopy/ipython_config.py $profd
32 elif [ "$profd/ipython_config.py" -ot "@datarootdir@/oscopy/ipython_config.py" ]; then
33 echo
34 upd=0
35 read -p "IPython $IOSCOPY profile file is outdated, update [N/y] ? " upd
36 echo
37 if [ "$upd" = "Y" -o "$upd" = "y" ] ; then
38 echo Updating IPython $IOSCOPY profile.
39 echo
40 cp @datarootdir@/oscopy/ipython_config.py $profd
41 else
42 echo "skipping profile update."
43 echo
48 # Replace short args with their equivalent, and delete space between = and
49 # file name when needed
50 args=`$PYTHON <<EOF
51 reps={$REPS}
52 argout=[reps.get(s, s) for s in "$*".split()]
53 print " ".join(argout).replace(".f= ", ".f=")
54 EOF`
55 echo ///// $args +++++++++++++++++++++++
56 $IPYTHON --profile=$IOSCOPY $args