Allow find_libraries to accept lists or strings (#3363)
* Allow find_libraries to accept lists or strings * Convert one more example from list to string
This commit is contained in:
parent
192a4b30f0
commit
a2d70a45fb
@ -568,20 +568,22 @@ def find_libraries(args, root, shared=True, recurse=False):
|
|||||||
"""Returns an iterable object containing a list of full paths to
|
"""Returns an iterable object containing a list of full paths to
|
||||||
libraries if found.
|
libraries if found.
|
||||||
|
|
||||||
Args:
|
:param args: Library name(s) to search for
|
||||||
args: iterable object containing a list of library names to \
|
:type args: str or collections.Sequence
|
||||||
search for (e.g. 'libhdf5')
|
:param str root: The root directory to start searching from
|
||||||
root: root folder where to start searching
|
:param bool shared: if True searches for shared libraries,
|
||||||
shared: if True searches for shared libraries, otherwise for static
|
otherwise for static
|
||||||
recurse: if False search only root folder, if True descends top-down \
|
:param bool recurse: if False search only root folder,
|
||||||
from the root
|
if True descends top-down from the root
|
||||||
|
|
||||||
Returns:
|
:returns: The libraries that have been found
|
||||||
list of full paths to the libraries that have been found
|
:rtype: LibraryList
|
||||||
"""
|
"""
|
||||||
if not isinstance(args, collections.Sequence) or isinstance(args, str):
|
if isinstance(args, str):
|
||||||
message = '{0} expects a sequence of strings as first argument'
|
args = [args]
|
||||||
message += ' [got {1} instead]'
|
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)))
|
raise TypeError(message.format(find_libraries.__name__, type(args)))
|
||||||
|
|
||||||
# Construct the right suffix for the library
|
# Construct the right suffix for the library
|
||||||
|
@ -767,7 +767,7 @@ def _libs_default_handler(descriptor, spec, cls):
|
|||||||
name = 'lib' + spec.name
|
name = 'lib' + spec.name
|
||||||
shared = '+shared' in spec
|
shared = '+shared' in spec
|
||||||
return find_libraries(
|
return find_libraries(
|
||||||
[name], root=spec.prefix, shared=shared, recurse=True
|
name, root=spec.prefix, shared=shared, recurse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,9 +47,9 @@ class Armadillo(Package):
|
|||||||
depends_on('hdf5', when='+hdf5')
|
depends_on('hdf5', when='+hdf5')
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
arpack = find_libraries(['libarpack'], root=spec[
|
arpack = find_libraries('libarpack', root=spec[
|
||||||
'arpack-ng'].prefix.lib, shared=True)
|
'arpack-ng'].prefix.lib, shared=True)
|
||||||
superlu = find_libraries(['libsuperlu'], root=spec[
|
superlu = find_libraries('libsuperlu', root=spec[
|
||||||
'superlu'].prefix, shared=False, recurse=True)
|
'superlu'].prefix, shared=False, recurse=True)
|
||||||
cmake_args = [
|
cmake_args = [
|
||||||
# ARPACK support
|
# ARPACK support
|
||||||
|
@ -92,7 +92,7 @@ def install(self, spec, prefix):
|
|||||||
]
|
]
|
||||||
fcflags = copy.deepcopy(optflags[self.spec.compiler.name])
|
fcflags = copy.deepcopy(optflags[self.spec.compiler.name])
|
||||||
fcflags.append(spec['fftw'].cppflags)
|
fcflags.append(spec['fftw'].cppflags)
|
||||||
fftw = find_libraries(['libfftw3'], root=spec['fftw'].prefix.lib)
|
fftw = find_libraries('libfftw3', root=spec['fftw'].prefix.lib)
|
||||||
ldflags = [fftw.search_flags]
|
ldflags = [fftw.search_flags]
|
||||||
libs = [
|
libs = [
|
||||||
join_path(spec['libint'].prefix.lib, 'libint.so'),
|
join_path(spec['libint'].prefix.lib, 'libint.so'),
|
||||||
|
@ -82,7 +82,7 @@ class Elemental(CMakePackage):
|
|||||||
def elemental_libs(self):
|
def elemental_libs(self):
|
||||||
shared = True if '+shared' in self.spec else False
|
shared = True if '+shared' in self.spec else False
|
||||||
return find_libraries(
|
return find_libraries(
|
||||||
['libEl'], root=self.prefix, shared=shared, recurse=True
|
'libEl', root=self.prefix, shared=shared, recurse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def build_type(self):
|
def build_type(self):
|
||||||
|
@ -74,14 +74,14 @@ def patch(self):
|
|||||||
def blas_libs(self):
|
def blas_libs(self):
|
||||||
shared = True if '+shared' in self.spec else False
|
shared = True if '+shared' in self.spec else False
|
||||||
return find_libraries(
|
return find_libraries(
|
||||||
['libblas'], root=self.prefix, shared=shared, recurse=True
|
'libblas', root=self.prefix, shared=shared, recurse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lapack_libs(self):
|
def lapack_libs(self):
|
||||||
shared = True if '+shared' in self.spec else False
|
shared = True if '+shared' in self.spec else False
|
||||||
return find_libraries(
|
return find_libraries(
|
||||||
['liblapack'], root=self.prefix, shared=shared, recurse=True
|
'liblapack', root=self.prefix, shared=shared, recurse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def install_one(self, spec, prefix, shared):
|
def install_one(self, spec, prefix, shared):
|
||||||
|
@ -62,7 +62,7 @@ class NetlibScalapack(Package):
|
|||||||
def scalapack_libs(self):
|
def scalapack_libs(self):
|
||||||
shared = True if '+shared' in self.spec else False
|
shared = True if '+shared' in self.spec else False
|
||||||
return find_libraries(
|
return find_libraries(
|
||||||
['libscalapack'], root=self.prefix, shared=shared, recurse=True
|
'libscalapack', root=self.prefix, shared=shared, recurse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
|
@ -69,7 +69,7 @@ def url_for_version(self, version):
|
|||||||
# feast, libfm, pfft, isf, pnfft
|
# feast, libfm, pfft, isf, pnfft
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
arpack = find_libraries(['libarpack'], root=spec[
|
arpack = find_libraries('libarpack', root=spec[
|
||||||
'arpack-ng'].prefix.lib, shared=True)
|
'arpack-ng'].prefix.lib, shared=True)
|
||||||
lapack = spec['lapack'].libs
|
lapack = spec['lapack'].libs
|
||||||
blas = spec['blas'].libs
|
blas = spec['blas'].libs
|
||||||
|
@ -230,7 +230,7 @@ def setup_environment(self, spack_env, run_env):
|
|||||||
# set the DYNINSTAPI_RT_LIB library which is
|
# set the DYNINSTAPI_RT_LIB library which is
|
||||||
# required for OpenSpeedShop to find loop level
|
# required for OpenSpeedShop to find loop level
|
||||||
# performance information
|
# performance information
|
||||||
dyninst_libdir = find_libraries(['libdyninstAPI_RT'],
|
dyninst_libdir = find_libraries('libdyninstAPI_RT',
|
||||||
root=self.spec['dyninst'].prefix,
|
root=self.spec['dyninst'].prefix,
|
||||||
shared=True, recurse=True)
|
shared=True, recurse=True)
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ def setup_environment(self, spack_env, run_env):
|
|||||||
run_env.set('DYNINSTAPI_RT_LIB', dyninst_libdir)
|
run_env.set('DYNINSTAPI_RT_LIB', dyninst_libdir)
|
||||||
|
|
||||||
# Find openspeedshop library path
|
# Find openspeedshop library path
|
||||||
oss_libdir = find_libraries(['libopenss-framework'],
|
oss_libdir = find_libraries('libopenss-framework',
|
||||||
root=self.spec['openspeedshop'].prefix,
|
root=self.spec['openspeedshop'].prefix,
|
||||||
shared=True, recurse=True)
|
shared=True, recurse=True)
|
||||||
run_env.prepend_path('LD_LIBRARY_PATH',
|
run_env.prepend_path('LD_LIBRARY_PATH',
|
||||||
|
@ -47,7 +47,7 @@ class Veclibfort(Package):
|
|||||||
def libs(self):
|
def libs(self):
|
||||||
shared = True if '+shared' in self.spec else False
|
shared = True if '+shared' in self.spec else False
|
||||||
return find_libraries(
|
return find_libraries(
|
||||||
['libvecLibFort'], root=self.prefix, shared=shared, recurse=True
|
'libvecLibFort', root=self.prefix, shared=shared, recurse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
|
Loading…
Reference in New Issue
Block a user