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