aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2017-01-21 13:00:00 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-01-23 21:02:39 +0200
commit8e9f0c954c08d959eb5ed52b726ab03855968cec (patch)
treed09a553c9c3dcd733fcad36211cd8117c8c2df82
parent0a2daf84eb68526f0d689488230a8d63cf47836d (diff)
downloadmeson-8e9f0c954c08d959eb5ed52b726ab03855968cec.zip
meson-8e9f0c954c08d959eb5ed52b726ab03855968cec.tar.gz
meson-8e9f0c954c08d959eb5ed52b726ab03855968cec.tar.bz2
Gracefully fallback when cross pkg-config can not be found for an optional dependency.
-rw-r--r--mesonbuild/dependencies.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py
index 97aec7e..32c61c1 100644
--- a/mesonbuild/dependencies.py
+++ b/mesonbuild/dependencies.py
@@ -119,8 +119,10 @@ class PkgConfigDependency(Dependency):
if self.required:
raise DependencyException('Pkg-config binary missing from cross file')
else:
- self.pkgbin = environment.cross_info.config['binaries']['pkgconfig']
- PkgConfigDependency.class_pkgbin = self.pkgbin
+ potential_pkgbin = environment.cross_info.config['binaries'].get('pkgconfig', 'non_existing_binary')
+ if shutil.which(potential_pkgbin):
+ self.pkgbin = potential_pkgbin
+ PkgConfigDependency.class_pkgbin = self.pkgbin
# Only search for the native pkg-config the first time and
# store the result in the class definition
elif PkgConfigDependency.class_pkgbin is None: