| 1 | #!/bin/sh | 
|---|
| 2 |  | 
|---|
| 3 | ######################################## | 
|---|
| 4 | #                                      # | 
|---|
| 5 | #  Install the asap python module      # | 
|---|
| 6 | #                                      # | 
|---|
| 7 | ######################################## | 
|---|
| 8 |  | 
|---|
| 9 | # temporary check to allow the same file for Narrabri and Epping | 
|---|
| 10 | if [ x"$NARRABRI_ASAP" = xyes ]; | 
|---|
| 11 | then | 
|---|
| 12 | ASAPDIR='/DATA/KAPUTAR_2/vor010/ASAP/site-packages/asap' | 
|---|
| 13 | SRCDIR='/DATA/KAPUTAR_2/vor010/ASAP/asap' | 
|---|
| 14 | BINDIR='/DATA/KAPUTAR_2/vor010/ASAP/executables' | 
|---|
| 15 | else | 
|---|
| 16 | #ASAPDIR='/u/mar637/brage/apps/lib/python2.3/site-packages/asap' | 
|---|
| 17 | ASAPDIR='/usr/local/lib/python2.3/site-packages/asap' | 
|---|
| 18 | SRCDIR='/u/mar637/asap' | 
|---|
| 19 | BINDIR='/usr/local/bin' | 
|---|
| 20 | fi | 
|---|
| 21 | # | 
|---|
| 22 | # check to allow setup via command line parameters | 
|---|
| 23 | if [ x"$1" != x ]; | 
|---|
| 24 | then | 
|---|
| 25 | ASAPDIR=$1 | 
|---|
| 26 | echo "ASAP will be installed into "$ASAPDIR | 
|---|
| 27 | fi | 
|---|
| 28 |  | 
|---|
| 29 | if [ x"$2" != x ]; | 
|---|
| 30 | then | 
|---|
| 31 | SRCDIR=$2 | 
|---|
| 32 | echo "from "$SRCDIR | 
|---|
| 33 | fi | 
|---|
| 34 |  | 
|---|
| 35 | if [ x"$3" != x ]; | 
|---|
| 36 | then | 
|---|
| 37 | BINDIR=$3 | 
|---|
| 38 | echo "Executables go into $BINDIR" | 
|---|
| 39 | fi | 
|---|
| 40 |  | 
|---|
| 41 | # where the source python files are | 
|---|
| 42 | pydir='python' | 
|---|
| 43 | # where the library modules is | 
|---|
| 44 | libdir='lib' | 
|---|
| 45 | bindir='bin' | 
|---|
| 46 | # the python files to install | 
|---|
| 47 | srcfiles="__init__.py asapmath.py scantable.py asapreader.py asaplot.py asapfitter.py asapfit.py asapplotter.py asaplinefind.py" | 
|---|
| 48 |  | 
|---|
| 49 | # the libraries to install | 
|---|
| 50 | libfiles='_asap.so' | 
|---|
| 51 | binfiles='asap' | 
|---|
| 52 |  | 
|---|
| 53 | #if [ -d ${SHAREDIR} ] ; then | 
|---|
| 54 | #    echo "ASAP share dir already exists." | 
|---|
| 55 | #else | 
|---|
| 56 | #    mkdir ${SHAREDIR} | 
|---|
| 57 | #fi | 
|---|
| 58 |  | 
|---|
| 59 | # go to src dir | 
|---|
| 60 | if [ -d ${SRCDIR} ] ; then | 
|---|
| 61 | cd ${SRCDIR} | 
|---|
| 62 | else | 
|---|
| 63 | echo "No source directory found." | 
|---|
| 64 | exit 0 | 
|---|
| 65 | fi | 
|---|
| 66 |  | 
|---|
| 67 | # check if the site-packes directory exists and create if necessary | 
|---|
| 68 | if [ -d ${ASAPDIR} ] ; then | 
|---|
| 69 | echo "Using existing asap module dir." | 
|---|
| 70 | else | 
|---|
| 71 | mkdir ${ASAPDIR} | 
|---|
| 72 | fi | 
|---|
| 73 |  | 
|---|
| 74 | # install asap files | 
|---|
| 75 | for f in ${srcfiles} | 
|---|
| 76 | do | 
|---|
| 77 | cp -f ${SRCDIR}/${pydir}/${f} ${ASAPDIR}/ | 
|---|
| 78 | done | 
|---|
| 79 |  | 
|---|
| 80 | for f in ${libfiles} | 
|---|
| 81 | do | 
|---|
| 82 | cp -f ${SRCDIR}/${libdir}/${f} ${ASAPDIR}/ | 
|---|
| 83 | done | 
|---|
| 84 |  | 
|---|
| 85 | for f in ${binfiles} | 
|---|
| 86 | do | 
|---|
| 87 | cp -f ${SRCDIR}/${bindir}/${f} ${BINDIR}/ | 
|---|
| 88 | done | 
|---|
| 89 |  | 
|---|
| 90 | #chmod -R g+w ${ASAPDIR} | 
|---|
| 91 | echo "Successfully installed the asap module into ${ASAPDIR}" | 
|---|