From 3858d4a3a354facf4bce66567c07d2d229f9d98a Mon Sep 17 00:00:00 2001 From: Veselin Dobrev Date: Thu, 22 Mar 2018 17:43:23 -0700 Subject: [PATCH] [hypre] add the 'headers' property (#7278) * [hypre] Add the 'headers' property plus a small tweak in the 'libs' property. * [hypre] Add fallbacks for searching for '.libs' in 'prefix.lib64' and in all of 'prefix'. * [hypre] Fix style. * [hypre] Use find_headers instead of find + HeaderList. --- .../repos/builtin/packages/hypre/package.py | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index d17da61a1b..6f41e3840b 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -110,8 +110,26 @@ def install(self, spec, prefix): '-rhsone') make("install") + @property + def headers(self): + """Export the main hypre header, HYPRE.h; all other headers can be found + in the same directory. + Sample usage: spec['hypre'].headers.cpp_flags + """ + hdrs = find_headers('HYPRE', self.prefix.include, recursive=False) + return hdrs or None + @property def libs(self): - is_shared = self.spec.satisfies('+shared') - return find_libraries('libHYPRE', root=self.prefix, - shared=is_shared, recursive=True) + """Export the hypre library. + Sample usage: spec['hypre'].libs.ld_flags + """ + search_paths = [[self.prefix.lib, False], [self.prefix.lib64, False], + [self.prefix, True]] + is_shared = '+shared' in self.spec + for path, recursive in search_paths: + libs = find_libraries('libHYPRE', root=path, + shared=is_shared, recursive=recursive) + if libs: + return libs + return None