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