summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSergey Kosukhin <skosukhin@gmail.com>2017-08-03 09:17:07 +0200
committerMassimiliano Culpo <massimiliano.culpo@googlemail.com>2017-08-03 09:17:07 +0200
commit963eb99b7f7306d69a755ddd50bd8b8fca0076c3 (patch)
tree24427784d84648fdb36f468bd21c86b991c3e07b /lib
parent269925f77539436045d8a1c2a7d8325d3e8d8c7f (diff)
downloadspack-963eb99b7f7306d69a755ddd50bd8b8fca0076c3.tar.gz
spack-963eb99b7f7306d69a755ddd50bd8b8fca0076c3.tar.bz2
spack-963eb99b7f7306d69a755ddd50bd8b8fca0076c3.tar.xz
spack-963eb99b7f7306d69a755ddd50bd8b8fca0076c3.zip
Account for hyphens in package names when searching for libraries. (#4948)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py13
1 files changed, 12 insertions, 1 deletions
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(