summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Serwin <marcin@serwin.dev>2025-03-19 17:21:37 +0100
committerDylan Baker <dylan@pnwbakers.com>2025-03-20 09:23:28 -0700
commitad04f4ead91590ef17f8ec999b18bae2a41576e5 (patch)
treeeafc1e70a0d54b1757b896dc39ffa8e4711db126
parentd17df82efa5dd0b60b9b2a25f8a5e2f34477af6a (diff)
downloadmeson-ad04f4ead91590ef17f8ec999b18bae2a41576e5.tar.gz
hdf5: don't throw if the pkg-config doesn't support --list-all
-rw-r--r--mesonbuild/dependencies/hdf5.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/hdf5.py b/mesonbuild/dependencies/hdf5.py
index 622653025..7595c7cc6 100644
--- a/mesonbuild/dependencies/hdf5.py
+++ b/mesonbuild/dependencies/hdf5.py
@@ -153,10 +153,14 @@ def hdf5_factory(env: 'Environment', for_machine: 'MachineChoice',
pkgconfig_files = OrderedSet(['hdf5', 'hdf5-serial'])
pkg = PkgConfigInterface.instance(env, for_machine, silent=False)
if pkg:
- # some distros put hdf5-1.2.3.pc with version number in .pc filename.
- for mod in pkg.list_all():
- if mod.startswith('hdf5'):
- pkgconfig_files.add(mod)
+ try:
+ # old hdf5 versions put version number in .pc filename, e.g., hdf5-1.2.3.pc.
+ for mod in pkg.list_all():
+ if mod.startswith('hdf5'):
+ pkgconfig_files.add(mod)
+ except DependencyException:
+ # use just the standard files if pkg-config --list-all fails
+ pass
for mod in pkgconfig_files:
candidates.append(functools.partial(HDF5PkgConfigDependency, mod, env, kwargs, language))