aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-01-13 15:49:42 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2018-01-17 20:58:04 +0200
commit22a1596a9705218ff37a2629b5067b37a7631ede (patch)
treee2687b11c60c0968c120c47fc66d181863e0eadd
parentb37706737ce82a7b35810ae9843b6d654d6a7d14 (diff)
downloadmeson-22a1596a9705218ff37a2629b5067b37a7631ede.zip
meson-22a1596a9705218ff37a2629b5067b37a7631ede.tar.gz
meson-22a1596a9705218ff37a2629b5067b37a7631ede.tar.bz2
Warn about using non-existent pkgconfig variables
I'm not sure this is a good idea, but at the moment it seems a bit too easy to write something like dep.get_pkgconfig_variable('inculdedir:') (sic) and not notice it's not doing anything useful.
-rw-r--r--mesonbuild/dependencies/base.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index e29d4de..31b15d0 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -16,6 +16,7 @@
# Custom logic for several other packages are in separate files.
import os
+import re
import sys
import stat
import shlex
@@ -532,6 +533,14 @@ class PkgConfigDependency(ExternalDependency):
(self.type_string, self.name))
else:
variable = out.strip()
+
+ # pkg-config doesn't distinguish between empty and non-existent variables
+ # use the variable list to check for variable existence
+ if not variable:
+ ret, out = self._call_pkgbin(['--print-variables', self.name])
+ if not re.search(r'^' + variable_name + r'$', out, re.MULTILINE):
+ mlog.warning("pkgconfig variable '%s' not defined for dependency %s." % (variable_name, self.name))
+
mlog.debug('Got pkgconfig variable %s : %s' % (variable_name, variable))
return variable