summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2022-02-16 07:07:44 -0600
committerGitHub <noreply@github.com>2022-02-16 14:07:44 +0100
commit3c1b2c0fc965c8ca2ad2d62a359af4150520f383 (patch)
treec0f9bd31ab770ed6886c0a3a6fd14faf4f4adca8 /lib
parente6ea4c788a862c62a737b0e941bfdc830ffd2ec8 (diff)
downloadspack-3c1b2c0fc965c8ca2ad2d62a359af4150520f383.tar.gz
spack-3c1b2c0fc965c8ca2ad2d62a359af4150520f383.tar.bz2
spack-3c1b2c0fc965c8ca2ad2d62a359af4150520f383.tar.xz
spack-3c1b2c0fc965c8ca2ad2d62a359af4150520f383.zip
find_libraries: search for both .so and .dylib on macOS (#28924)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/llnl/util/filesystem.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index f9f2b3162f..be24f9e53f 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -1638,12 +1638,18 @@ def find_libraries(libraries, root, shared=True, recursive=False):
raise TypeError(message)
# Construct the right suffix for the library
- if shared is True:
- suffix = 'dylib' if sys.platform == 'darwin' else 'so'
+ if shared:
+ # Used on both Linux and macOS
+ suffixes = ['so']
+ if sys.platform == 'darwin':
+ # Only used on macOS
+ suffixes.append('dylib')
else:
- suffix = 'a'
+ suffixes = ['a']
+
# List of libraries we are searching with suffixes
- libraries = ['{0}.{1}'.format(lib, suffix) for lib in libraries]
+ libraries = ['{0}.{1}'.format(lib, suffix) for lib in libraries
+ for suffix in suffixes]
if not recursive:
# If not recursive, look for the libraries directly in root