[sdk/kde-builder] kde_builder_lib: fix: Resolve LSP violation in Module.get_option return type
Andrew Shark <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit b86a46ab91e63427ce1363b798c0724bd1db35f9 by Andrew Shark.
Committed on 31/07/2026 at 20:20.
Pushed by ashark into branch 'master'.
fix: Resolve LSP violation in Module.get_option return type
M +1 -3 kde_builder_lib/build_system/autotools.py
M +3 -10 kde_builder_lib/module/module.py
https://invent.kde.org/sdk/kde-builder/-/commit/b86a46ab91e63427ce1363b798c0724bd1db35f9
diff --git a/kde_builder_lib/build_system/autotools.py b/kde_builder_lib/build_system/autotools.py
index 88820e9e..2a531a17 100644
--- a/kde_builder_lib/build_system/autotools.py
+++ b/kde_builder_lib/build_system/autotools.py
@@ -73,9 +73,7 @@ class BuildSystemAutotools(BuildSystem):
builddir = module.fullpath("build")
installdir = module.installation_path()
- # "module"-limited option grabbing can return None, so use Logical Defined-Or
- # to convert to empty string in that case.
- bootstrap_options = Util.split_quoted_on_whitespace(module.get_option("configure-flags", "module") or "")
+ bootstrap_options = Util.split_quoted_on_whitespace(module.get_option("configure-flags", "module"))
try:
configure_command = self._autogen()
exitcode = Util.run_logged(module, "configure", builddir, [f"{sourcedir}/{configure_command}", f"--prefix={installdir}", *bootstrap_options])
diff --git a/kde_builder_lib/module/module.py b/kde_builder_lib/module/module.py
index 517db27e..2fb875f1 100644
--- a/kde_builder_lib/module/module.py
+++ b/kde_builder_lib/module/module.py
@@ -603,24 +603,18 @@ class Module(PathResolvingOptions):
super().set_option(opt_name, opt_val)
- # @override(check_signature=False)
- def get_option(self, key: str, level_limit="allow-inherit") -> str | dict | None:
+ # @override
+ def get_option(self, key: str, level_limit="allow-inherit") -> str | dict:
"""
Return an option value for a given module.
Some globals can't be overridden by a module's choice (but see level_limit parameter below).
If so, the module's choice will be ignored, and a warning will be issued.
- Option names are case-sensitive!
-
Some options (e.g. cmake-options, configure-flags, meson-options) have the global value
and then the module's own value appended together. To get the actual
module setting you must use the level limit parameter set to "module".
- Likewise, some qt module options do not obey the previous proviso since
- Qt options are not likely to agree nicely with generic KDE build_system
- options.
-
Options starting with "#" can only be set internally (i.e. not from rc-file
or cmdline) so this can be used as a way to tag modules with data meant not
to be user-accessible.
@@ -635,7 +629,6 @@ class Module(PathResolvingOptions):
buildContext).
Returned type - for example used in
- None - unexisting key in module-only level
dict - "set-env"
str - almost everything else
"""
@@ -645,7 +638,7 @@ class Module(PathResolvingOptions):
# If module-only, check that first.
if level_limit == "module":
- return self.options[key] if key in self.options else None
+ return self.options[key] if key in self.options else ""
ctx_value = ctx.get_option(key) # we'll use this a lot from here