aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2022-03-09 12:47:00 -0800
committerEli Schwartz <eschwartz93@gmail.com>2022-08-18 21:57:36 -0400
commit3f63827527e1f9a6175e3457a0a0902825d4b79e (patch)
treee56d47026a55dc89ea7949de99d536a24f8eabdc
parent26f02f50b823af5ef6025e62bf7d6943d00ef2bc (diff)
downloadmeson-3f63827527e1f9a6175e3457a0a0902825d4b79e.zip
meson-3f63827527e1f9a6175e3457a0a0902825d4b79e.tar.gz
meson-3f63827527e1f9a6175e3457a0a0902825d4b79e.tar.bz2
modules/pkgconfig: ensure "name" is not None
The name can be None if a library is not passed as a positional argument, and the name keyword argument is not provided. We shouldn't allow that to happen.
-rw-r--r--mesonbuild/modules/pkgconfig.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index a113d13..aeb77c6 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -615,8 +615,14 @@ class PkgConfigModule(ExtensionModule):
install_dir = mainlib.get_custom_install_dir()
if install_dir and isinstance(install_dir[0], str):
default_install_dir = os.path.join(install_dir[0], 'pkgconfig')
- elif kwargs['version'] is None:
- FeatureNew.single_use('pkgconfig.generate implicit version keyword', '0.46.0', state.subproject)
+ else:
+ if kwargs['version'] is None:
+ FeatureNew.single_use('pkgconfig.generate implicit version keyword', '0.46.0', state.subproject)
+ if kwargs['name'] is None:
+ raise build.InvalidArguments(
+ 'pkgconfig.generate: if a library is not passed as a '
+ 'positional argument, the name keyword argument is '
+ 'required.')
dataonly = kwargs['dataonly']
if dataonly:
@@ -629,6 +635,7 @@ class PkgConfigModule(ExtensionModule):
subdirs = kwargs['subdirs'] or default_subdirs
version = kwargs['version'] if kwargs['version'] is not None else default_version
name = kwargs['name'] if kwargs['name'] is not None else default_name
+ assert isinstance(name, str), 'for mypy'
filebase = kwargs['filebase'] if kwargs['filebase'] is not None else name
description = kwargs['description'] if kwargs['description'] is not None else default_description
url = kwargs['url']