diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2019-12-17 01:39:09 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-12-17 15:10:13 +0200 |
commit | 39db7b1afc3ba92056c49546482daed8820f26be (patch) | |
tree | d30027df2370e593ca0771d463b9d3ad9a3f08db /mesonbuild/dependencies/hdf5.py | |
parent | 58999cad913681f5f1ad434a0409fa3019794cfb (diff) | |
download | meson-39db7b1afc3ba92056c49546482daed8820f26be.zip meson-39db7b1afc3ba92056c49546482daed8820f26be.tar.gz meson-39db7b1afc3ba92056c49546482daed8820f26be.tar.bz2 |
Fail gracefully detecting hdf5 if pkg-config is not available.
Diffstat (limited to 'mesonbuild/dependencies/hdf5.py')
-rw-r--r-- | mesonbuild/dependencies/hdf5.py | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/mesonbuild/dependencies/hdf5.py b/mesonbuild/dependencies/hdf5.py index b73e424..1ceb15f 100644 --- a/mesonbuild/dependencies/hdf5.py +++ b/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)) |