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