diff options
author | Peter Scheibel <scheibel1@llnl.gov> | 2019-09-17 15:45:21 -0700 |
---|---|---|
committer | Greg Becker <becker33@llnl.gov> | 2019-09-17 17:45:21 -0500 |
commit | 141a1648e682bebff3c705f8b60678c00fa2ff11 (patch) | |
tree | 7d8fe0504c1c89544a11a0f4bb596557f92d6702 /lib/spack/llnl/util/filesystem.py | |
parent | b11a98abf015d3af6b653eea98443708612ad9ea (diff) | |
download | spack-141a1648e682bebff3c705f8b60678c00fa2ff11.tar.gz spack-141a1648e682bebff3c705f8b60678c00fa2ff11.tar.bz2 spack-141a1648e682bebff3c705f8b60678c00fa2ff11.tar.xz spack-141a1648e682bebff3c705f8b60678c00fa2ff11.zip |
implicit rpaths filtering (#12789)
* implicit_rpaths are now removed from compilers.yaml config and are always instantiated dynamically, this occurs one time in the build_environment module
* per-compiler list required libraries (e.g. libstdc++, libgfortran) and whitelist directories from rpaths including those libraries. Remove non-whitelisted implicit rpaths. Some libraries default for all compilers.
* reintroduce 'implicit_rpaths' as a config variable that can be used to disable Spack insertion of compiler RPATHs generated at build time.
Diffstat (limited to 'lib/spack/llnl/util/filesystem.py')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 752aa0138e..762d851ec5 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -9,6 +9,7 @@ import hashlib import fileinput import glob import grp +import itertools import numbers import os import pwd @@ -68,6 +69,32 @@ def path_contains_subdirectory(path, root): return norm_path.startswith(norm_root) +def possible_library_filenames(library_names): + """Given a collection of library names like 'libfoo', generate the set of + library filenames that may be found on the system (e.g. libfoo.so). This + generates the library filenames that may appear on any OS. + """ + lib_extensions = ['a', 'la', 'so', 'tbd', 'dylib'] + return set( + '.'.join((lib, extension)) for lib, extension in + itertools.product(library_names, lib_extensions)) + + +def paths_containing_libs(paths, library_names): + """Given a collection of filesystem paths, return the list of paths that + which include one or more of the specified libraries. + """ + required_lib_fnames = possible_library_filenames(library_names) + + rpaths_to_include = [] + for path in paths: + fnames = set(os.listdir(path)) + if fnames & required_lib_fnames: + rpaths_to_include.append(path) + + return rpaths_to_include + + def same_path(path1, path2): norm1 = os.path.abspath(path1).rstrip(os.path.sep) norm2 = os.path.abspath(path2).rstrip(os.path.sep) |