Skip to content

Commit 0185f2e

Browse files
xclaessejpakkane
authored andcommitted
Fix dep.get_variable() with empty string default_value
1 parent 5778429 commit 0185f2e

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

mesonbuild/dependencies/pkgconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def get_pkgconfig_variable(self, variable_name: str,
402402
if not variable:
403403
ret, out, _ = self._call_pkgbin(['--print-variables', self.name])
404404
if not re.search(r'^' + variable_name + r'$', out, re.MULTILINE):
405-
if default:
405+
if default is not None:
406406
variable = default
407407
else:
408408
mlog.warning(f"pkgconfig variable '{variable_name}' not defined for dependency {self.name}.")

test cases/common/211 dependency get_variable method/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ else
1919
'pkg-config didn\'t get default when we should have.')
2020
assert(dep.get_variable(pkgconfig : 'prefix', default_value : default) != default,
2121
'pkg-config got default when we shouldn\'t have.')
22+
assert(dep.get_variable(pkgconfig : 'pkgvarnotfound', default_value : '') == '')
2223
endif
2324

2425
dep_ct = dependency('llvm', method : 'config-tool', required : false)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"stdout": [
3+
{
4+
"line": ".*pkgvarnotfound.*",
5+
"match": "re",
6+
"count": 0
7+
}
8+
]
9+
}

0 commit comments

Comments
 (0)