summaryrefslogtreecommitdiff
path: root/lib/spack
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack')
-rw-r--r--lib/spack/llnl/util/filesystem.py28
-rw-r--r--lib/spack/spack/spec.py2
2 files changed, 16 insertions, 14 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index 79f15f9a21..7f6773266d 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -568,20 +568,22 @@ def find_libraries(args, root, shared=True, recurse=False):
"""Returns an iterable object containing a list of full paths to
libraries if found.
- Args:
- args: iterable object containing a list of library names to \
- search for (e.g. 'libhdf5')
- root: root folder where to start searching
- shared: if True searches for shared libraries, otherwise for static
- recurse: if False search only root folder, if True descends top-down \
- from the root
-
- Returns:
- list of full paths to the libraries that have been found
+ :param args: Library name(s) to search for
+ :type args: str or collections.Sequence
+ :param str root: The root directory to start searching from
+ :param bool shared: if True searches for shared libraries,
+ otherwise for static
+ :param bool recurse: if False search only root folder,
+ if True descends top-down from the root
+
+ :returns: The libraries that have been found
+ :rtype: LibraryList
"""
- if not isinstance(args, collections.Sequence) or isinstance(args, str):
- message = '{0} expects a sequence of strings as first argument'
- message += ' [got {1} instead]'
+ 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]'
raise TypeError(message.format(find_libraries.__name__, type(args)))
# Construct the right suffix for the library
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index c0ee8486db..9fc2c99e4a 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -767,7 +767,7 @@ def _libs_default_handler(descriptor, spec, cls):
name = 'lib' + spec.name
shared = '+shared' in spec
return find_libraries(
- [name], root=spec.prefix, shared=shared, recurse=True
+ name, root=spec.prefix, shared=shared, recurse=True
)