Changeset 689


Ignore:
Timestamp:
09/23/05 16:21:57 (19 years ago)
Author:
mar637
Message:

complete rewrite to use ipythonrc profile and revert to python if ipython isn't installed.
Remove checking of aips++ installation. data is now distibuted with asap.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bin/asap

    r656 r689  
    2828#                        AUSTRALIA
    2929#
    30 # $Id:
     30# $Id$
    3131#---------------------------------------------------------------------------
    3232[ -x /usr/bin/clear ] && /usr/bin/clear
     
    3434echo "Loading ASAP..."
    3535
    36 inprompt='ASAP>'
    37 outprompt='asap>'
     36prefix='/usr/local'
    3837
    39 p="`which ipython`"
    40 if [ ! -x "$p" ]; then
    41     echo "Can't find, or no execute permissions for 'ipython'"
     38# check if user set
     39if [ "x${ASAPDATA}" == "x" ]; then
     40    ASAPDATA="${prefix}/share/asap"
     41    export ASAPDATA
     42fi
     43
     44if [ ! -d "${ASAPDATA}" ]; then
     45    echo "Couldn't locate the asap data directory"
     46    ASAPDATA="/nfs/aips++"
     47    #export ASAPDATA
     48    #exit 1
     49fi
     50
     51# Keep casa measures happy
     52if test -d "${ASAPDATA}/data" ; then
     53    platform='Linux'
     54    if [ `uname -s` == 'Darwin' ]; then
     55        platform='darwin'
     56    fi
     57    AIPSPATH="${ASAPDATA} ${platform} somewhere localhost"     
     58    export AIPSPATH
     59else
     60    echo "Couldn't find the ASAP data directory"
    4261    exit 1
    4362fi
    4463
    45 
    46 # at the moment we need AIPS++ for measures tables and endian detection
    47 if [ "${AIPSPATH}" == "" ]; then
    48     aroot='/nfs/aips++'
    49     ASAPDATA='/usr/local/share/asap'
    50     if test -d ${ASAPDATA} ; then
    51         AIPSPATH="${ASAPDATA} linux_gnu somewhere localhost"   
    52         export AIPSPATH
    53     elif test -d ${aroot}/weekly ; then
    54         . ${aroot}/weekly/aipsinit.sh
    55     elif  test -d ${aroot}/daily ; then
    56         . ${aroot}/daily/aipsinit.sh
    57     elif  test -d /nfs/aips++/pks ; then
    58         . /nfs/aips++/pks/aipsinit.sh
    59     else
    60         echo "Cannot locate casa installation or ASAP data directory"
    61         exit 0
    62     fi
     64# started for the first time
     65ASAPUSERDIR="${HOME}/.asap"
     66if [ ! -d ${ASAPUSERDIR} ]; then
     67    echo 'First time ASAP use. Setting up ~/.asap'
     68    mkdir "${ASAPUSERDIR}"
     69    cp "/tmp/ipythonrc-asap" "${ASAPUSERDIR}/"
     70    #cp "${ASAPDATA}/ipythonrc-asap" "${ASAPUSERDIR}/"
     71    touch "${ASAPUSERDIR}/asapuserfuncs.py"
    6372fi
    6473
    65 #
    66 # FIXME - allow more than one argument and handle args gracefuly.
    67 #
     74ip="`which ipython`"
    6875
    69 $p -pi1 $inprompt -po $outprompt -nobanner -xmode "Plain" -c "from asap import *" $1
     76if [ ! -x "$ip" ]; then
     77    echo "Can't find, or no execute permissions for 'ipython'"
     78    echo "Running asap through 'python':"
     79    p="`which python`"
     80    $p -c 'from asap import *'
     81else   
     82    $ip -ipythondir "${ASAPUSERDIR}" -p 'asap' $*
     83fi
Note: See TracChangeset for help on using the changeset viewer.