Fix dep.get_variable() with empty string default_value

pull/9920/head
Xavier Claessens 3 years ago committed by Jussi Pakkanen
parent 5778429122
commit 0185f2ed61
  1. 2
      mesonbuild/dependencies/pkgconfig.py
  2. 1
      test cases/common/211 dependency get_variable method/meson.build
  3. 9
      test cases/common/211 dependency get_variable method/test.json

@ -402,7 +402,7 @@ class PkgConfigDependency(ExternalDependency):
if not variable:
ret, out, _ = self._call_pkgbin(['--print-variables', self.name])
if not re.search(r'^' + variable_name + r'$', out, re.MULTILINE):
if default:
if default is not None:
variable = default
else:
mlog.warning(f"pkgconfig variable '{variable_name}' not defined for dependency {self.name}.")

@ -19,6 +19,7 @@ else
'pkg-config didn\'t get default when we should have.')
assert(dep.get_variable(pkgconfig : 'prefix', default_value : default) != default,
'pkg-config got default when we shouldn\'t have.')
assert(dep.get_variable(pkgconfig : 'pkgvarnotfound', default_value : '') == '')
endif
dep_ct = dependency('llvm', method : 'config-tool', required : false)

@ -0,0 +1,9 @@
{
"stdout": [
{
"line": ".*pkgvarnotfound.*",
"match": "re",
"count": 0
}
]
}
Loading…
Cancel
Save