-
Notifications
You must be signed in to change notification settings - Fork 6
/
install_casanova
executable file
·88 lines (71 loc) · 3.05 KB
/
install_casanova
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#! /bin/sh
########################################################################
# Edit these paths to your own situation #
########################################################################
# Where this file is located:
infodir=~/Documents/MA-project-2/casanova
# Where you install casa
casainstalldir=/net/dedemsvaart/data2/kvdam/casa_installation2
# Create python_packages directory, don't change this line
mkdir -m 777 $casainstalldir/python_packages
# Note that your release may differ, so possibly edit the path
casa=$casainstalldir/casa-release-4.5.2-el6
python=$casainstalldir/python_packages
########################################################################
# Only change the paths above #
# No need to change anything below this block #
########################################################################
# Copy the casat dependency files
cd $casa/lib/python2.7
xargs cp -rt $python < $infodir/dependencies.txt
# Copy the casa tasks (casat)
mkdir -m 777 $python/casat
xargs cp -rt $python/casat < $infodir/tasks.txt
# Copy the updated files to python_packages and casat
cp $infodir/code/TablePlotTkAgg.* $python
cp $infodir/code/taskinit.* $python
cp $infodir/code/__init__.py $python/casat
# Symlinks
# I don't really recall why I needed these but beter safe than sorry
ln -s $casa/data/geodetic/Observatories $casa/data/Observatories
ln -s $casa/data $casainstalldir
# Copy the startup script to the casa install directory
cp $infodir/casanova_startup $casainstalldir
# Add the new ftw() task
cp $infodir/code/task_ftw.* $python
cp $infodir/code/ftw.p* $python/casat
cp $infodir/code/ftw.xml $casa/xml
########################################################################
# The following is based on Dr. Peter K. G. Williams work #
# See: https://newton.cx/~peter/2014/02/casa-in-python-without-casapy/ #
# This concerns the installation of the casa toolkit (casac) #
########################################################################
cd $casa/lib
# copy basic Python files
cp -a python2.7/casac.py python2.7/__casac__ $python
# copy dependent libraries, with moderate sophistication
for f in lib*.so* ; do
if [ -h $f ] ; then
cp -a $f $python/__casac__ # copy symlinks as links
else
case $f in
*_debug.so) ;; # skip -- actually text files
libgomp.*)
# somehow patchelf fries this particular file
cp -a $f $python/__casac__ ;;
*)
cp -a $f $python/__casac__
patchelf --set-rpath '$ORIGIN' $python/__casac__/$f ;;
esac
fi
done
# patch rpaths of Python module binary files
cd $python/__casac__
for f in _*.so ; do
patchelf --set-rpath '$ORIGIN' $f
done
# Remove libgfortran from casac since it conflicts with already installed
# libgfortran. Comes down to removing the two files from __casac__ folder
# (and possibly store them somewhere else).
# This step is even more hacky than the things above so do this manually
# Hopefully someone will find a better, more elegant fix.