summaryrefslogtreecommitdiff
path: root/mesonbuild/modules/pkgconfig.py
diff options
context:
space:
mode:
authorEyal Itkin <eyal.itkin@gmail.com>2025-10-13 16:51:02 +0300
committerXavier Claessens <xclaesse@gmail.com>2025-10-14 10:58:14 -0400
commit6f4bcf1d0f2eb99336c9e75b7bf34e7e5010a43d (patch)
tree0809f802cb09a1fcd43d536996dfd8074d442e02 /mesonbuild/modules/pkgconfig.py
parent71a204f878f76e684f8740c2e91789d5699e6c43 (diff)
downloadmeson-6f4bcf1d0f2eb99336c9e75b7bf34e7e5010a43d.tar.gz
pkgconfig: Improve handling of empty string deps
Fix the original bug fix for #13950 to only warn about empty required strings, instead of failing the entire build. This will simplify the workflow for users that build the string from a possibly empty list, and save them the need for the added if-check. Signed-off-by: Eyal Itkin <eyal.itkin@gmail.com>
Diffstat (limited to 'mesonbuild/modules/pkgconfig.py')
-rw-r--r--mesonbuild/modules/pkgconfig.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index 1295cea50..7d5bc913e 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -150,6 +150,8 @@ class DependenciesHelper:
self.add_version_reqs(obj.name, obj.version_reqs)
elif isinstance(obj, str):
name, version_req = self.split_version_req(obj)
+ if name is None:
+ continue
processed_reqs.append(name)
self.add_version_reqs(name, [version_req] if version_req is not None else None)
elif isinstance(obj, dependencies.Dependency) and not obj.found():
@@ -298,10 +300,11 @@ class DependenciesHelper:
# foo, bar' is ok, but 'foo,bar' is not.
self.version_reqs[name].update(version_reqs)
- def split_version_req(self, s: str) -> T.Tuple[str, T.Optional[str]]:
+ def split_version_req(self, s: str) -> T.Tuple[T.Optional[str], T.Optional[str]]:
stripped_str = s.strip()
if not stripped_str:
- raise mesonlib.MesonException(f'required dependency must not be empty, "{s}" was provided.')
+ mlog.warning('Required dependency was found to be an empty string. Did you mean to pass an empty array?')
+ return None, None
for op in ['>=', '<=', '!=', '==', '=', '>', '<']:
pos = stripped_str.find(op)
if pos < 0: