diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2017-04-21 12:11:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-21 12:11:29 -0500 |
commit | 5250e8ee8966b1e7c8be2f13277bc785d5af8e73 (patch) | |
tree | d3a0e145ed7cecc19cd87287e0620c333dc46458 /lib | |
parent | 41efada340ec7a57544ce8299427676c53d88025 (diff) | |
download | spack-5250e8ee8966b1e7c8be2f13277bc785d5af8e73.tar.gz spack-5250e8ee8966b1e7c8be2f13277bc785d5af8e73.tar.bz2 spack-5250e8ee8966b1e7c8be2f13277bc785d5af8e73.tar.xz spack-5250e8ee8966b1e7c8be2f13277bc785d5af8e73.zip |
Fix HPL build, convert to MakefilePackage (#3777)
* Fix HPL build, convert to MakefilePackage
* Flake8 fix
* Fix: spec -> self.spec
* Properly query for system libraries
* Update Intel-MKL as well
* Recurse in system libs, fix MKL path, fixes lapack_libs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/llnl/util/filesystem.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 71d5096523..86122f42c8 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -47,6 +47,7 @@ __all__ = [ 'copy_mode', 'filter_file', 'find_libraries', + 'find_system_libraries', 'fix_darwin_install_name', 'force_remove', 'force_symlink', @@ -583,6 +584,54 @@ class LibraryList(collections.Sequence): return self.joined() +def find_system_libraries(args, shared=True): + """Searches the usual system library locations for the libraries + specified in args. + + Search order is as follows: + + 1. /lib64 + 2. /lib + 3. /usr/lib64 + 4. /usr/lib + 5. /usr/local/lib64 + 6. /usr/local/lib + + :param args: Library name(s) to search for + :type args: str or collections.Sequence + :param bool shared: if True searches for shared libraries, + + :returns: The libraries that have been found + :rtype: LibraryList + """ + if isinstance(args, str): + args = [args] + elif not isinstance(args, collections.Sequence): + message = '{0} expects a string or sequence of strings as the ' + message += 'first argument [got {1} instead]' + message = message.format(find_system_libraries.__name__, type(args)) + raise TypeError(message) + + libraries_found = [] + search_locations = [ + '/lib64', + '/lib', + '/usr/lib64', + '/usr/lib', + '/usr/local/lib64', + '/usr/local/lib', + ] + + for library in args: + for root in search_locations: + result = find_libraries(library, root, shared, recurse=True) + if result: + libraries_found += result + break + + return libraries_found + + def find_libraries(args, root, shared=True, recurse=False): """Returns an iterable object containing a list of full paths to libraries if found. |