From cd07896241bf847ce43ccf04a27bafa3f9d2e3c6 Mon Sep 17 00:00:00 2001
From: knodlseder <>
Date: Fri, 21 Oct 2011 19:45:02 +0000
Subject: [PATCH] initial version
---
dev/license_new.txt | 13 +++++++++++++
dev/license_old.txt | 4 ++++
dev/macosx_package.sh | 210 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dev/macosx_testpkg.sh | 330 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dev/release_gammalib.sh | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dev/replace_license.py | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 787 insertions(+), 0 deletions(-)
create mode 100644 dev/license_new.txt
create mode 100644 dev/license_old.txt
create mode 100755 dev/macosx_package.sh
create mode 100755 dev/macosx_testpkg.sh
create mode 100755 dev/release_gammalib.sh
create mode 100755 dev/replace_license.py
diff --git a/dev/license_new.txt b/dev/license_new.txt
new file mode 100644
index 0000000..0a5cdb7
--- /dev/null
+++ b/dev/license_new.txt
@@ -0,0 +1,13 @@
+ * This program is free software: you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation, either version 3 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program. If not, see . *
+
diff --git a/dev/license_old.txt b/dev/license_old.txt
new file mode 100644
index 0000000..eade9d7
--- /dev/null
+++ b/dev/license_old.txt
@@ -0,0 +1,4 @@
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
diff --git a/dev/macosx_package.sh b/dev/macosx_package.sh
new file mode 100755
index 0000000..026517e
--- /dev/null
+++ b/dev/macosx_package.sh
@@ -0,0 +1,210 @@
+#!/bin/bash -f
+
+# Set parameters
+cfitsio=cfitsio3280
+ncurses=ncurses-5.9
+readline=readline-6.2
+gammalib=gammalib-00-04-12
+ctools=ctools-00-03-00
+installdir=/usr/local/gamma
+swig_path=/Users/jurgen/Software/swig/swig2.0.4/bin
+
+# Set flags
+do_delete=1
+do_cfitsio=1
+do_ncurses=1
+do_readline=1
+do_gammalib=1
+do_ctools=1
+do_python25=1
+do_python26=1
+do_python27=1
+
+# Set configuration
+export CFLAGS="-arch ppc -arch i386 -arch x86_64"
+export CXXFLAGS="-arch ppc -arch i386 -arch x86_64"
+export LDFLAGS="-arch ppc -arch i386 -arch x86_64"
+
+# Remove old installation
+if [ $do_delete -eq 1 ]; then
+ sudo rm -rf $installdir
+fi
+
+# Dump header
+rm install.log
+echo > "Mac OS X packaging" > install.log
+
+# Install cfitsio
+if [ $do_cfitsio -eq 1 ]; then
+ tar xfz $cfitsio.tar.gz
+ cd cfitsio
+ echo " " >> ../install.log
+ echo "cfitsio" >> ../install.log
+ ./configure --prefix=$installdir
+ make shared
+ sudo make install
+ file $installdir/lib/libcfitsio.a >> ../install.log
+ file $installdir/lib/libcfitsio.dylib >> ../install.log
+ otool -L $installdir/lib/libcfitsio.dylib >> ../install.log
+ cd ..
+fi
+
+# Install ncurses (not needed since available on Mac OS X)
+if [ $do_ncurses -eq 1 ]; then
+ tar xfz $ncurses.tar.gz
+ cd $ncurses
+ echo " " >> ../install.log
+ echo "Ncurses" >> ../install.log
+ ./configure --prefix=$installdir --with-shared
+ make
+ sudo make install
+ file $installdir/lib/libncurses.dylib >> ../install.log
+ otool -L $installdir/lib/libncurses.dylib >> ../install.log
+ cd ..
+fi
+
+# Install readline (not needed since available on Mac OS X)
+if [ $do_readline -eq 1 ]; then
+ tar xfz $readline.tar.gz
+ cd $readline
+ echo " " >> ../install.log
+ echo "Readline" >> ../install.log
+ ./configure --prefix=$installdir
+ make
+ sudo make install
+ file $installdir/lib/libreadline.dylib >> ../install.log
+ otool -L $installdir/lib/libreadline.dylib >> ../install.log
+ cd ..
+fi
+
+# Decide which Python versions to build
+VERSIONS=
+declare -a PYTHONS
+let count=0
+if [ $do_python25 -eq 1 ]; then
+ VERSIONS=$VERSIONS"2.5 "
+ PYTHONS[$count]="/System/Library/Frameworks/Python.framework/Versions/2.5/bin/python2.5"
+ ((count++))
+fi
+if [ $do_python26 -eq 1 ]; then
+ VERSIONS=$VERSIONS"2.6 "
+ PYTHONS[$count]="/System/Library/Frameworks/Python.framework/Versions/2.6/bin/python2.6"
+ ((count++))
+fi
+if [ $do_python27 -eq 1 ]; then
+ VERSIONS=$VERSIONS"2.7 "
+ PYTHONS[$count]="/Users/jurgen/Software/python/python27/10.5/3-way/bin/python2.7"
+ ((count++))
+fi
+
+# Install gammalib
+if [ $do_gammalib -eq 1 ]; then
+
+ # Secure PATH
+ OLD_PATH=$PATH
+
+ # Decompress tarball and step into GammaLib
+ tar xfz $gammalib.tar.gz
+ cd $gammalib
+
+ # Make GammaLib builds
+ let count=0
+ for VERSION in $VERSIONS; do
+
+ # Dump version
+ echo " " >> ../install.log
+ echo "GammaLib for Python $VERSION" >> install.log
+
+ # Create symbolic link for this Python version
+ rm -rf python$VERSION
+ mkdir -p python$VERSION
+ cd python$VERSION
+ ln -s ${PYTHONS[$count]} python
+ export PATH=$PWD:$swig_path:/usr/bin:/bin:/usr/sbin:/sbin
+ echo $PATH >> ../../install.log
+ cd ..
+
+ # Dump Python version
+ python -V >> ../install.log
+
+ # Remove pyext/build
+ rm -rf pyext/build
+
+ # Build GammaLib
+ ./configure --prefix=$installdir
+ make -j8
+ sudo make install
+ file $installdir/lib/libgamma.la >> ../install.log
+ file $installdir/lib/libgamma.dylib >> ../install.log
+ file $installdir/lib/python$VERSION/site-packages/_gammalib.so >> ../install.log
+ otool -L $installdir/lib/libgamma.dylib >> ../install.log
+ otool -L $installdir/lib/python$VERSION/site-packages/_gammalib.so >> ../install.log
+
+ # Increment version counter
+ ((count++))
+
+ done
+
+ # GammaLib post install
+ cd ..
+ sudo cp gammalib-setup $installdir/bin/gammalib-setup
+
+ # Recover PATH
+ export PATH=$OLD_PATH
+
+fi
+
+
+# Install ctools
+if [ $do_ctools -eq 1 ]; then
+
+ # Secure PATH
+ OLD_PATH=$PATH
+
+ # Decompress tarball and step into ctools
+ tar xfz $ctools.tar.gz
+ cd $ctools
+
+ # Make ctools builds
+ let count=0
+ for VERSION in $VERSIONS; do
+
+ # Dump version
+ echo " " >> ../install.log
+ echo "ctools for Python $VERSION" >> install.log
+
+ # Create symbolic link for this Python version
+ rm -rf python$VERSION
+ mkdir -p python$VERSION
+ cd python$VERSION
+ ln -s ${PYTHONS[$count]} python
+ export PATH=$PWD:$swig_path:/usr/bin:/bin:/usr/sbin:/sbin
+ echo $PATH >> ../../install.log
+ cd ..
+
+ # Dump Python version
+ python -V >> ../install.log
+
+ # Build ctools
+ make distclean
+ ./configure --prefix=$installdir
+ make
+ sudo make install
+ file $installdir/lib/libctools.la >> ../install.log
+ file $installdir/lib/libctools.dylib >> ../install.log
+ file $installdir/lib/python$VERSION/site-packages/_ctools.so >> ../install.log
+ otool -L $installdir/lib/libctools.dylib >> ../install.log
+ otool -L $installdir/lib/python$VERSION/site-packages/_ctools.so >> ../install.log
+
+ # Increment version counter
+ ((count++))
+
+ done
+
+ # ctools post install
+ cd ..
+
+ # Recover PATH
+ export PATH=$OLD_PATH
+
+fi
diff --git a/dev/macosx_testpkg.sh b/dev/macosx_testpkg.sh
new file mode 100755
index 0000000..92a66da
--- /dev/null
+++ b/dev/macosx_testpkg.sh
@@ -0,0 +1,330 @@
+#!/bin/bash -f
+#############################################################################
+# Test Mac OS X package #
+# ------------------------------------------------------------------------- #
+# Copyright (C) 2011 Jurgen Knodlseder #
+# ------------------------------------------------------------------------- #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see . #
+# #
+# ------------------------------------------------------------------------- #
+# This script tests a Mac OS X package prior to release. It is assumed that #
+# the package has been installed in ${GAMMALIB}. #
+#############################################################################
+
+# Set GAMMALIB environment variable
+export GAMMALIB=$HOME/ctools
+#GAMMALIB=$HOME/test/gamma
+#GAMMALIB=/usr/local/gamma
+
+# Set supported architectures (for command line tests)
+ARCHS="ppc i386 x86_64"
+
+# Set supported Python versions
+declare -a PYTHONS
+let count=0
+PYTHONS[$count]=/System/Library/Frameworks/Python.framework/Versions/2.5/bin
+((count++))
+PYTHONS[$count]=/System/Library/Frameworks/Python.framework/Versions/2.6/bin
+((count++))
+PYTHONS[$count]=/Users/jurgen/Software/python/python27/10.5/3-way/bin
+((count++))
+
+# Loop over Python versions
+let index=0
+while [ $index -lt $count ]; do
+
+ # Set PATH
+ export PATH=${PYTHONS[$index]}:/opt/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
+
+ # Reset PYTHONPATH
+ export PYTHONPATH=
+
+ # Source initialisation script
+ source $GAMMALIB/bin/gammalib-init.sh
+
+ # Determine Python version
+ PYTHON_VERSION=`python -c "import sys, string; \
+ ver=string.split(sys.version)[0].split('.'); \
+ print ver[0]+'.'+ver[1]"`
+
+ # Determine Python architectures
+ PYTHON_BIN=`which python`
+ PYTHON_ARCHS=
+ if [ "x`file $PYTHON_BIN | grep ppc`" != x ]; then
+ PYTHON_ARCHS=$PYTHON_ARCHS"ppc "
+ fi
+ if [ "x`file $PYTHON_BIN | grep i386`" != x ]; then
+ PYTHON_ARCHS=$PYTHON_ARCHS"i386 "
+ fi
+ if [ "x`file $PYTHON_BIN | grep x86_64`" != x ]; then
+ PYTHON_ARCHS=$PYTHON_ARCHS"x86_64 "
+ fi
+
+ # Loop over Python architectures
+ let goods=0
+ let bads=0
+ ARCH_GOOD=
+ ARCH_BAD=
+ for ARCH in $PYTHON_ARCHS; do
+
+ # Reset error counter
+ let errors=0
+
+ # Check if gammalib import works
+ RES=`arch -$ARCH python -c "from gammalib import *" 2>&1`
+ if [ "x$RES" != x ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): Unable to import gammalib ($RES)"
+ ((errors++))
+ fi
+
+ # Check if ctools import works
+ RES=`arch -$ARCH python -c "from ctools import *" 2>&1`
+ if [ "x$RES" != x ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): Unable to import ctools ($RES)"
+ ((errors++))
+ fi
+
+ # Check if gammalib and ctools import works
+ RES=`arch -$ARCH python -c "from ctools import *; from gammalib import *" 2>&1`
+ if [ "x$RES" != x ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): Unable to import ctools & gammalib ($RES)"
+ ((errors++))
+ fi
+
+ # Check if GModels() works
+ RES=`arch -$ARCH python -c "from gammalib import *; \
+ m=GModels(); \
+ print m" 2>&1`
+ if [ "x`echo $RES | grep Traceback`" != x ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): $RES"
+ ((errors++))
+ fi
+
+ # Remove existing result files
+ rm -f events.fits
+ rm -f cntmap.fits
+ rm -f selected_events.fits
+ rm -f results_unbinned.xml
+
+ # Check if ctobssim works in Python
+ RES=`arch -$ARCH python -c "from ctools import *; \
+ from gammalib import *; \
+ sim = ctobssim(); \
+ sim['infile'].filename('$GAMMALIB/share/models/crab.xml'); \
+ sim['outfile'].filename('events.fits'); \
+ sim['caldb'].string('$GAMMALIB/share/caldb/cta'); \
+ sim['irf'].string('kb_E_50h_v3'); \
+ sim['ra'].real(83.63); \
+ sim['dec'].real(22.01); \
+ sim['rad'].real(10.0); \
+ sim['tmin'].real(0.0); \
+ sim['tmax'].real(1800.0); \
+ sim['emin'].real(0.1); \
+ sim['emax'].real(100.0); \
+ sim.execute()" 2>&1`
+ if [ "x`echo $RES | grep Traceback`" != x ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): $RES"
+ ((errors++))
+ fi
+ if [ ! -s "events.fits" ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): ctobssim - No valid events.fits file."
+ ((errors++))
+ fi
+
+ # Check if ctbin works in Python
+ RES=`arch -$ARCH python -c "from ctools import *; \
+ from gammalib import *; \
+ bin = ctbin(); \
+ bin['evfile'].filename('events.fits'); \
+ bin['outfile'].filename('cntmap.fits'); \
+ bin['emin'].real(0.1); \
+ bin['emax'].real(100.0); \
+ bin['enumbins'].integer(20); \
+ bin['nxpix'].integer(200); \
+ bin['nypix'].integer(200); \
+ bin['binsz'].real(0.02); \
+ bin['coordsys'].string('CEL'); \
+ bin['xref'].real(83.63); \
+ bin['yref'].real(22.01); \
+ bin['proj'].string('CAR'); \
+ bin.execute()" 2>&1`
+ if [ "x`echo $RES | grep Traceback`" != x ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): $RES"
+ ((errors++))
+ fi
+ if [ ! -s "cntmap.fits" ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): ctbin - No valid cntmap.fits file."
+ ((errors++))
+ fi
+
+ # Check if ctselect works in Python
+ RES=`arch -$ARCH python -c "from ctools import *; \
+ from gammalib import *; \
+ select = ctselect(); \
+ select['infile'].filename('events.fits'); \
+ select['outfile'].filename('selected_events.fits'); \
+ select['ra'].real(83.63); \
+ select['dec'].real(22.01); \
+ select['rad'].real(4.0); \
+ select['emin'].real(0.1); \
+ select['emax'].real(100.0); \
+ select['tmin'].real(0.0); \
+ select['tmax'].real(1800); \
+ select.execute()" 2>&1`
+ if [ "x`echo $RES | grep Traceback`" != x ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): $RES"
+ ((errors++))
+ fi
+ if [ ! -s "selected_events.fits" ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): ctselect - No valid selected_events.fits file."
+ ((errors++))
+ fi
+
+ # Check if ctlike works in Python
+ RES=`arch -$ARCH python -c "from ctools import *; \
+ from gammalib import *; \
+ like = ctlike(); \
+ like['evfile'].filename('selected_events.fits'); \
+ like['srcmdl'].filename('$GAMMALIB/share/models/crab.xml'); \
+ like['outmdl'].filename('results_unbinned.xml'); \
+ like['caldb'].string('$GAMMALIB/share/caldb/cta'); \
+ like['irf'].string('kb_E_50h_v3'); \
+ like['method'].string('UNBINNED'); \
+ like.execute()" 2>&1`
+ if [ "x`echo $RES | grep Traceback`" != x ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): $RES"
+ ((errors++))
+ fi
+ if [ ! -s "results_unbinned.xml" ]; then
+ echo "ERROR (Python$PYTHON_VERSION-$ARCH): ctlike - No valid results_unbinned.xml file."
+ ((errors++))
+ fi
+
+ # Collect good and bad Python architectures
+ if [ $errors == 0 ]; then
+ ARCH_GOOD=$ARCH_GOOD" "$ARCH
+ ((goods++))
+ else
+ ARCH_BAD=$ARCH_BAD" "$ARCH
+ ((bads++))
+ fi
+
+ done
+
+ # Signal success and failures
+ if [ $goods -gt 0 ]; then
+ echo "Python$PYTHON_VERSION support works for$ARCH_GOOD."
+ fi
+ if [ $bads -gt 0 ]; then
+ echo "Python$PYTHON_VERSION support fails for$ARCH_BAD."
+ fi
+
+ # Increment index
+ ((index++))
+
+done
+
+#
+# Now test the command line interface
+#====================================
+
+# Source initialisation script
+source $GAMMALIB/bin/gammalib-init.sh
+
+# Create pfiles directory and set environment
+rm -rf pfiles
+mkdir -p pfiles
+export PFILES=pfiles
+
+# Loop over architectures
+for ARCH in $ARCHS; do
+
+ # Remove existing result files
+ rm -f events.fits
+ rm -f cntmap.fits
+ rm -f selected_events.fits
+ rm -f results_unbinned.xml
+
+ # Check if ctobssim works from command line
+ arch -$ARCH ctobssim \
+ infile="$GAMMALIB/share/models/crab.xml" \
+ outfile="events.fits" \
+ caldb="$GAMMALIB/share/caldb/cta" \
+ irf="kb_E_50h_v3" \
+ ra=83.63 \
+ dec=22.01 \
+ rad=10.0 \
+ tmin=0.0 \
+ tmax=1800.0 \
+ emin=0.1 \
+ emax=100.0
+ if [ -s "events.fits" ]; then
+ echo "ctobssim($ARCH): ok."
+ else
+ echo "ERROR ($ARCH): ctobssim failed."
+ fi
+
+ # Check if ctbin works from command line
+ arch -$ARCH ctbin \
+ evfile="events.fits" \
+ outfile="cntmap.fits" \
+ emin=0.1 \
+ emax=100.0 \
+ enumbins=20 \
+ nxpix=200 \
+ nypix=200 \
+ binsz=0.02 \
+ coordsys="CEL" \
+ xref=83.63 \
+ yref=22.01 \
+ proj="CAR"
+ if [ -s "cntmap.fits" ]; then
+ echo "ctbin($ARCH): ok."
+ else
+ echo "ERROR ($ARCH): ctbin failed."
+ fi
+
+ # Check if ctselect works from command line
+ arch -$ARCH ctselect \
+ infile="events.fits" \
+ outfile="selected_events.fits" \
+ ra=83.63 \
+ dec=22.01 \
+ rad=10.0 \
+ tmin=0.0 \
+ tmax=1800.0 \
+ emin=0.1 \
+ emax=100.0
+ if [ -s "selected_events.fits" ]; then
+ echo "ctselect($ARCH): ok."
+ else
+ echo "ERROR ($ARCH): ctselect failed."
+ fi
+
+ # Check if ctlike works from command line
+ arch -$ARCH ctlike evfile="selected_events.fits" \
+ srcmdl="$GAMMALIB/share/models/crab.xml" \
+ outmdl="results_unbinned.xml" \
+ method="UNBINNED" \
+ caldb="$GAMMALIB/share/caldb/cta" \
+ irf="kb_E_50h_v3"
+ if [ -s "results_unbinned.xml" ]; then
+ echo "ctlike($ARCH): ok."
+ else
+ echo "ERROR ($ARCH): ctlike failed."
+ fi
+
+done
+
diff --git a/dev/release_gammalib.sh b/dev/release_gammalib.sh
new file mode 100755
index 0000000..5a84d2a
--- /dev/null
+++ b/dev/release_gammalib.sh
@@ -0,0 +1,118 @@
+#! /bin/bash -f
+
+# Set parameters
+installdir=$(pwd)/build
+makedoc="no"
+
+echo "Checkout latest GammaLib"
+rm -rf gammalib
+cvs -Q -d /home/cvs export -N -r HEAD "gammalib"
+
+# Extract version number
+version=`cat gammalib/configure.ac | grep 'AC_INIT' | awk -F"[" '{print $3}' | sed 's/],//' | sed 's/\./ /g'`
+version=`printf "%2.2d-%2.2d-%2.2d" $version`
+echo "GammaLib version: "$version
+
+# Set source directory
+sourcedir=gammalib-$version
+rm -rf $sourcedir
+mv gammalib $sourcedir
+
+#
+echo "Create Makefile.in and configure scripts"
+cd $sourcedir
+./autogen.sh
+rm -f gammalib.sh
+rm -rf dev
+cd ..
+
+#
+echo "Create gammalib_wrap.cpp and gammalib.py files for python binding (making swig obsolete)"
+inc_inst="-I$sourcedir/inst/mwl/pyext -I$sourcedir/inst/lat/pyext -I$sourcedir/inst/cta/pyext"
+opt_inst="-DWITH_INST_MWL -DWITH_INST_LAT -DWITH_INST_CTA"
+swig -c++ -python -Wall -includeall -I$sourcedir/src $inc_inst $opt_inst -o $sourcedir/pyext/gammalib_wrap.cpp -outdir $sourcedir/pyext $sourcedir/pyext/gammalib.i
+
+#
+if [ "x$makedoc" == "xyes" ] ; then
+ echo "Create doxygen documentation"
+ cd $sourcedir/doc
+ doxygen Doxyfile
+ cd latex
+ make
+ make
+ dvips -o refman.ps refman
+ ps2pdf refman.ps
+ cd ../..
+fi
+
+#
+echo "Create LaTeX documentation"
+cd $sourcedir/doc
+#
+latex gammalib_um.tex
+dvips gammalib_um.dvi -o gammalib_um.ps
+ps2pdf gammalib_um.ps
+rm -f gammalib_um.dvi gammalib_um.aux gammalib_um.log gammalib_um.tex gammalib_um.toc manual.sty gammalib_um.ps
+#
+cd dev/coding
+latex gammalib_coding.tex
+dvips gammalib_coding.dvi -o gammalib_coding.ps
+ps2pdf gammalib_coding.ps
+cd ../..
+mv dev/coding/gammalib_coding.pdf .
+#
+cd dev/inst
+latex gammalib_inst.tex
+dvips gammalib_inst.dvi -o gammalib_inst.ps
+ps2pdf gammalib_inst.ps
+cd ../..
+mv dev/inst/gammalib_inst.pdf .
+#
+cd dev/maths
+latex gammalib_maths.tex
+dvips gammalib_maths.dvi -o gammalib_maths.ps
+ps2pdf gammalib_maths.ps
+cd ../..
+mv dev/maths/gammalib_maths.pdf .
+#
+cd dev/sdd
+latex gammalib_sdd.tex
+dvips gammalib_sdd.dvi -o gammalib_sdd.ps
+ps2pdf gammalib_sdd.ps
+cd ../..
+mv dev/sdd/gammalib_sdd.pdf .
+#
+cd dev/srs
+latex gammalib_srs.tex
+dvips gammalib_srs.dvi -o gammalib_srs.ps
+ps2pdf gammalib_srs.ps
+cd ../..
+mv dev/srs/gammalib_srs.pdf .
+#
+rm -rf dev
+cd ../..
+
+echo "Make files read/write"
+chmod -R u+rw $sourcedir
+
+echo "Create tarball"
+tar cvf - $sourcedir > $sourcedir.tar
+rm -f $sourcedir.tar.gz
+gzip $sourcedir.tar
+
+#
+echo "Configure GammaLib"
+cd $sourcedir
+./configure --prefix=$installdir
+
+#
+echo "Compile GammaLib"
+make -j10
+
+#
+echo "Check GammaLib"
+make check
+
+#
+echo "Install GammaLib"
+make install
diff --git a/dev/replace_license.py b/dev/replace_license.py
new file mode 100755
index 0000000..a3dd1ca
--- /dev/null
+++ b/dev/replace_license.py
@@ -0,0 +1,112 @@
+#! /usr/bin/env python
+
+import os
+import glob
+
+
+# =========================== #
+# Read license text from file #
+# =========================== #
+def read_license(filename):
+ """
+ Read license text from file.
+ """
+ # Initialise lines
+ lines = []
+
+ # Loop over file
+ for line in open(filename, 'r'):
+ if len(line.rstrip("\n").strip(" ")) > 0:
+ lines.append(line)
+
+ # Return lines
+ return lines
+
+
+# ==================== #
+# Replace license text #
+# ==================== #
+def replace_license(filename, license_old, license_new):
+ """
+ Replace license text in file.
+ """
+ # Set temporary name
+ tmpname = "test.txt"
+
+ # Open temporary file
+ file = open(tmpname, "w")
+
+ # Initialise old text line finder
+ ifind = 0
+
+ # Loop over file
+ for line in open(filename, 'r'):
+
+ # Search line for license text
+ if line == license_old[ifind]:
+ ifind += 1
+ if ifind >= len(license_old):
+ for replace in license_new:
+ file.write(replace)
+ print "License text upated in file "+filename+"."
+ ifind = 0
+
+ # Handle partial license text
+ elif ifind > 0:
+ print "Partial old license text found in file "+filename+". Ignored."
+ ifind = 0
+
+ # ... otherwise write out line
+ else:
+ file.write(line)
+
+ # Close temporary file
+ file.close()
+
+ # Replace input file
+ os.rename(tmpname, filename)
+
+ # Return
+ return
+
+
+# ======================================================== #
+# Replace license text in files with name given by pattern #
+# ======================================================== #
+def update_files(pattern, license_old, license_new):
+ """
+ Replace license text in files with name given by pattern.
+ """
+ # Get sorted list of files
+ files = glob.glob(pattern)
+ files.sort()
+
+ # Loop over all files
+ for file in files:
+ replace_license(file, license_old, license_new)
+
+ # Return
+ return
+
+
+# ======================== #
+# Main routine entry point #
+# ======================== #
+if __name__ == '__main__':
+ """
+ Replace old by new license text.
+ """
+ # Load license files
+ license_old = read_license("license_old.txt")
+ license_new = read_license("license_new.txt")
+
+ # Replace license text
+ update_files("include/*.hpp", license_old, license_new)
+ update_files("pyext/*.i", license_old, license_new)
+ update_files("src/*/*.*pp", license_old, license_new)
+ update_files("inst/*/include/*.hpp", license_old, license_new)
+ update_files("inst/*/pyext/*.i", license_old, license_new)
+ update_files("inst/*/src/*.cpp", license_old, license_new)
+ update_files("inst/*/test/*.*pp", license_old, license_new)
+ update_files("test/*.*pp", license_old, license_new)
+
--
libgit2 0.21.4