summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-06-13 12:57:41 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2024-02-26 10:03:51 -0500
commit5654f03450e6ed0745a9429e578344dd4e581fc9 (patch)
treef825b89658ca888dd8b0ff449d5999c0999c6a95 /mesonbuild
parent42944f72a438ea746dc6484b57bb0ffe429ea79f (diff)
downloadmeson-5654f03450e6ed0745a9429e578344dd4e581fc9.tar.gz
interpreter: Dependency variables can be empty string
There is no reason to forbid empty variables, PkgConfigCLI.variable() even has code specifically for handling that case.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter/interpreter.py2
-rw-r--r--mesonbuild/interpreter/type_checking.py2
-rw-r--r--mesonbuild/modules/pkgconfig.py2
3 files changed, 4 insertions, 2 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index aaffec0b9..99c4f9625 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -702,6 +702,8 @@ class Interpreter(InterpreterBase, HoldableObject):
srcdir = Path(self.environment.source_dir)
# convert variables which refer to an -uninstalled.pc style datadir
for k, v in variables.items():
+ if not v:
+ FeatureNew.single_use('empty variable value in declare_dependency', '1.4.0', self.subproject, location=node)
try:
p = Path(v)
except ValueError:
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index 616f4efbb..2ec7d58ce 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -144,8 +144,6 @@ def variables_validator(contents: T.Union[str, T.List[str], T.Dict[str, str]]) -
for k, v in variables.items():
if not k:
return 'empty variable name'
- if not v:
- return 'empty variable value'
if any(c.isspace() for c in k):
return f'invalid whitespace in variable name {k!r}'
return None
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index 3f9ce7b71..ebe0d92d5 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -680,6 +680,8 @@ class PkgConfigModule(NewExtensionModule):
reserved = ['prefix', 'libdir', 'includedir']
variables = []
for name, value in vardict.items():
+ if not value:
+ FeatureNew.single_use('empty variable value in pkg.generate', '1.4.0', state.subproject, location=state.current_node)
if not dataonly and name in reserved:
raise mesonlib.MesonException(f'Variable "{name}" is reserved')
variables.append((name, value))