[sdk/kde-builder] kde_builder_lib: refactor: Use name field directly in OptionsBase class
Andrew Shark <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 3d67920bc9c03db12186a0a4363162e568de29de by Andrew Shark.
Committed on 29/07/2026 at 22:13.
Pushed by ashark into branch 'master'.
refactor: Use name field directly in OptionsBase class
M +1 -1 kde_builder_lib/build_context.py
M +1 -4 kde_builder_lib/module/module.py
M +2 -4 kde_builder_lib/module_set/module_set.py
M +2 -1 kde_builder_lib/options_base.py
https://invent.kde.org/sdk/kde-builder/-/commit/3d67920bc9c03db12186a0a4363162e568de29de
diff --git a/kde_builder_lib/build_context.py b/kde_builder_lib/build_context.py
index e19d27ee..64a817e1 100644
--- a/kde_builder_lib/build_context.py
+++ b/kde_builder_lib/build_context.py
@@ -67,7 +67,7 @@ class BuildContext(Module):
PERSISTENT_FILE_NAME = "kde-builder-persistent-data.json"
def __init__(self):
- Module.__init__(self, None, "global")
+ super().__init__(ctx=None, name="global")
# There doesn't seem to be a great way to get this from CMake easily, but we can
# reason that if there is a /usr/lib64 (and it's not just a compat symlink),
diff --git a/kde_builder_lib/module/module.py b/kde_builder_lib/module/module.py
index ededd17d..e2f4d32b 100644
--- a/kde_builder_lib/module/module.py
+++ b/kde_builder_lib/module/module.py
@@ -63,8 +63,7 @@ class Module(OptionsBase):
"""
def __init__(self, ctx: BuildContext, name: str):
- OptionsBase.__init__(self)
- self.name = name
+ super().__init__(ctx=ctx, name=name)
if not self.name:
raise ProgramError("Empty Module constructed")
@@ -86,10 +85,8 @@ class Module(OptionsBase):
phases = copy.copy(ctx.phases)
self.phases: PhaseList = phases
- # newOptions:
self.scm: Updater = Updater(self)
self.build_system: BuildSystem | None = None
- self.context = ctx
self.module_set: ModuleSet | None = None # in perl it was called module-set (i.e. via "-")
self.post_build_msgs: list[str] = []
self.env: dict[str, str] = {}
diff --git a/kde_builder_lib/module_set/module_set.py b/kde_builder_lib/module_set/module_set.py
index 7a9c7086..3a682258 100644
--- a/kde_builder_lib/module_set/module_set.py
+++ b/kde_builder_lib/module_set/module_set.py
@@ -43,19 +43,17 @@ class ModuleSet(OptionsBase):
See also: git-repository-base, use-projects
"""
- def __init__(self, ctx: BuildContext, name: str):
- OptionsBase.__init__(self)
+ def __init__(self, ctx: BuildContext, name: str = ""):
+ super().__init__(ctx=ctx, name=name)
self.start_for_create_id: int = 0
self.options["repository"] = "kde-projects"
- self.name: str = name or ""
self.modules_to_find: list[str] = []
self.modules_to_ignore: list[str] = []
self.module_order: dict[str, int] = {}
"""Maps module names to position in list."""
- self.context: BuildContext = ctx
self.project_objects_list: list[Module] = []
def __str__(self): # pl2py: In perl there were no stringify for module-set, but we will make it, for convenience.
diff --git a/kde_builder_lib/options_base.py b/kde_builder_lib/options_base.py
index ae684e2a..f19c56ad 100644
--- a/kde_builder_lib/options_base.py
+++ b/kde_builder_lib/options_base.py
@@ -35,9 +35,10 @@ class OptionsBase:
what options to set, see :class:`Application` and its friends.
"""
- def __init__(self, ctx: BuildContext | None = None):
+ def __init__(self, ctx: BuildContext | None = None, name: str = ""):
self.options = {"set-env": {}}
self.context = ctx
+ self.name = name
def has_option(self, key: str) -> bool:
"""