From 963eb99b7f7306d69a755ddd50bd8b8fca0076c3 Mon Sep 17 00:00:00 2001 From: Sergey Kosukhin Date: Thu, 3 Aug 2017 09:17:07 +0200 Subject: Account for hyphens in package names when searching for libraries. (#4948) --- lib/spack/spack/spec.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 54939d7a6b..cbbd48d9fa 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -802,7 +802,18 @@ def _libs_default_handler(descriptor, spec, cls): Raises: RuntimeError: If no libraries are found """ - name = 'lib' + spec.name + + # Variable 'name' is passed to function 'find_libraries', which supports + # glob characters. For example, we have a package with a name 'abc-abc'. + # Now, we don't know if the original name of the package is 'abc_abc' + # (and it generates a library 'libabc_abc.so') or 'abc-abc' (and it + # generates a library 'libabc-abc.so'). So, we tell the function + # 'find_libraries' to give us anything that matches 'libabc?abc' and it + # gives us either 'libabc-abc.so' or 'libabc_abc.so' (or an error) + # depending on which one exists (there is a possibility, of course, to + # get something like 'libabcXabc.so, but for now we consider this + # unlikely). + name = 'lib' + spec.name.replace('-', '?') if '+shared' in spec: libs = find_libraries( -- cgit v1.2.3-60-g2f50