App.get_libname(): Don't use get_proj_refs() #7

Merged
Jan Lindemann merged 2 commits from jan/feature/20260608-app-get-libname-don-t-use-get-proj-refs into master 2026-06-08 20:49:04 +02:00 AGit
Showing only changes of commit c538447cc5 - Show all commits

App.__get_project_refs(): Code beautification

In __get_project_refs():

- Rename variable dep and deps to val and vals, respectively, because that's more what they are values of key-value pairs. In some cases that can represent dependencies, in some case other things.
- Make a scope case distinction a little clearer by mentioning all possible cases in a match / case block
Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann 2026-06-06 14:53:02 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -188,33 +188,34 @@ class App(Base):
buf.append(spec)
return
visited.add(spec)
deps = self.get_value(name, section, key)
vals = self.get_value(name, section, key)
log(
DEBUG,
(
f'name={name}, section={section}, key={key}, deps={deps}, '
f'name={name}, section={section}, key={key}, deps={vals}, '
f'scope={scope.name}, visited={visited}'
),
)
if deps and scope != Scope.Self:
if scope == Scope.One:
subscope = Scope.Self
else:
subscope = Scope.Subtree
for dep in deps.split(','):
dep = dep.strip()
if not (len(dep)):
continue
self.__get_project_refs_cached(
buf,
visited,
dep,
section,
key,
add_self = True,
scope = subscope,
names_only = names_only,
)
vals_list = vals.split(',') if vals else []
match scope:
case Scope.Self:
buf += vals_list
case Scope.One | Scope.Subtree:
subscope = scope.Self if scope == Scope.One else scope
for val in vals_list:
val = val.strip()
if not (len(val)):
continue
self.__get_project_refs_cached(
buf,
visited,
val,
section,
key,
add_self = True,
scope = subscope,
names_only = names_only,
)
if add_self:
buf.append(spec)