Commit d5cfb8d817d31620f944728239ec3e4a434b104c

Authored by knodlseder
1 parent 337bfcbc

enforce static linking of ctatools library to enable checking without installation

Showing 1 changed file with 20 additions and 1 deletions
pyext/setup.py.in
@@ -2,11 +2,30 @@ from distutils.core import setup, Extension @@ -2,11 +2,30 @@ from distutils.core import setup, Extension
2 import glob 2 import glob
3 import os 3 import os
4 4
  5 +# Remove any existing symbolic link to libctatools.a
  6 +# This will prevent any exception in creating the symbolic link due to
  7 +# an already existing link.
  8 +try:
  9 + os.remove('../src/.libs/libctatools_python.a')
  10 + print 'Removed ../src/.libs/libctatools_python.a'
  11 +except:
  12 + pass
  13 +
  14 +# Create a symbolic link. This allows us to enforce static linking instead of
  15 +# dynamic linking. We prefer here static linking to avoid any problems with
  16 +# finding the gammalib shared library during checking.
  17 +try:
  18 + os.symlink('libctatools.a', '../src/.libs/libctatools_python.a')
  19 + print 'Created ../src/.libs/libctatools_python.a'
  20 + libcta='ctatools_python'
  21 +except:
  22 + libcta='ctatool'
  23 +
5 # Set default include directories and data files 24 # Set default include directories and data files
6 include_dirs = ['@prefix@/include/gammalib'] 25 include_dirs = ['@prefix@/include/gammalib']
7 data_files = glob.glob('@top_srcdir@/pyext/*.i') 26 data_files = glob.glob('@top_srcdir@/pyext/*.i')
8 library_dirs = ['../src/.libs','@prefix@/lib'] 27 library_dirs = ['../src/.libs','@prefix@/lib']
9 -libraries = ['ctatools','gamma','cfitsio'] 28 +libraries = [libcta,'gamma','cfitsio']
10 29
11 # Add application include files 30 # Add application include files
12 dirs = glob.glob('../src/ct*') 31 dirs = glob.glob('../src/ct*')