Commit 18921cff480d37b627bc73806c407805ecd427cd

Authored by knodlseder
1 parent 852b4e29

add prefix library directory only if it exists

Showing 1 changed file with 9 additions and 5 deletions
pyext/setup.py.in
... ... @@ -53,9 +53,13 @@ except:
53 53 # Set default include directories and data files
54 54 include_dirs = ['@prefix@/include/gammalib']
55 55 data_files = glob.glob('@top_srcdir@/pyext/*.i')
56   -library_dirs = ['../src/.libs','@prefix@/lib']
  56 +library_dirs = ['../src/.libs']
57 57 libraries = [libcta,'gamma']
58 58  
  59 +# Append prefix library directory if it exists
  60 +if os.path.exists('@prefix@/lib'):
  61 + library_dirs.append(['@prefix@/lib'])
  62 +
59 63 # Add application include files. The method we use here is not very
60 64 # intelligent as it simple will add all names that start with 'ct'
61 65 # in the src directory. Once we added the ctatools script we had to
... ... @@ -75,18 +79,18 @@ for extra_lib in extra_libs:
75 79 # Get extra library paths
76 80 extra_lib_paths = ('@LDFLAGS@').split(' ')
77 81 for extra_lib_path in extra_lib_paths:
78   - if extra_lib_path.lstrip().find('-L') == 0:
  82 + if extra_lib_path.lstrip().find('-L') != -1:
79 83 dir = extra_lib_path.lstrip().lstrip('-L')
80 84 if len(dir) > 0:
81   - library_dirs.append(extra_lib_path.lstrip('-L'))
  85 + library_dirs.append(dir)
82 86  
83 87 # Get extra include directories
84 88 extra_include_dirs = ('@CPPFLAGS@').split(' ')
85 89 for extra_include_dir in extra_include_dirs:
86   - if extra_include_dir.lstrip().find('-I') == 0:
  90 + if extra_include_dir.lstrip().find('-I') != -1:
87 91 dir = extra_include_dir.lstrip().lstrip('-I')
88 92 if len(dir) > 0:
89   - include_dirs.append(extra_include_dir.lstrip('-I'))
  93 + include_dirs.append(dir)
90 94  
91 95 # Setup
92 96 setup(name='@PACKAGE_NAME@',
... ...