Fail gracefully detecting hdf5 if pkg-config is not available.

pull/6366/head
Jussi Pakkanen 5 years ago
parent 58999cad91
commit 39db7b1afc
  1. 19
      mesonbuild/dependencies/hdf5.py

@ -33,14 +33,17 @@ class HDF5Dependency(ExternalDependency):
# 1. pkg-config
pkgconfig_files = ['hdf5', 'hdf5-serial']
# some distros put hdf5-1.2.3.pc with version number in .pc filename.
ret = subprocess.run(['pkg-config', '--list-all'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
universal_newlines=True)
if ret.returncode == 0:
for pkg in ret.stdout.split('\n'):
if pkg.startswith(('hdf5')):
pkgconfig_files.append(pkg.split(' ', 1)[0])
pkgconfig_files = list(set(pkgconfig_files)) # dedupe
try:
ret = subprocess.run(['pkg-config', '--list-all'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
universal_newlines=True)
if ret.returncode == 0:
for pkg in ret.stdout.split('\n'):
if pkg.startswith(('hdf5')):
pkgconfig_files.append(pkg.split(' ', 1)[0])
pkgconfig_files = list(set(pkgconfig_files)) # dedupe
except FileNotFoundError:
# pkg-config was not available
pass
if language not in ('c', 'cpp', 'fortran'):
raise DependencyException('Language {} is not supported with HDF5.'.format(language))

Loading…
Cancel
Save