App.get_project_refs(): Fix multi-section results #117
1 changed files with 29 additions and 26 deletions
|
|
@ -203,7 +203,7 @@ class App(Base):
|
|||
buf: list[str],
|
||||
visited: set[str],
|
||||
spec: str,
|
||||
section: str,
|
||||
sections: list[str],
|
||||
key: str,
|
||||
add_self: bool,
|
||||
scope: Scope,
|
||||
|
|
@ -230,29 +230,33 @@ class App(Base):
|
|||
f'Unmet dependency on {mod}: the -{needed_subpackage} package '
|
||||
f'of project {name} is not installed'
|
||||
)
|
||||
vals = self.get_value(name, section, key)
|
||||
log(
|
||||
DEBUG,
|
||||
(
|
||||
f'name={name}, section={section}, key={key}, deps={vals}, '
|
||||
f'scope={scope.name}, visited={visited}'
|
||||
),
|
||||
)
|
||||
vals_list = vals.split(',') if vals else []
|
||||
vals_list: list[str] = []
|
||||
for section in sections:
|
||||
vals = self.get_value(name, section, key)
|
||||
log(
|
||||
DEBUG,
|
||||
(
|
||||
f'name={name}, section={section}, key={key}, deps={vals}, '
|
||||
f'scope={scope.name}, visited={visited}'
|
||||
),
|
||||
)
|
||||
if not vals:
|
||||
continue
|
||||
for val in vals.split(','):
|
||||
val = val.strip()
|
||||
if (len(val)) and (val not in vals_list):
|
||||
vals_list.append(val)
|
||||
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(
|
||||
buf,
|
||||
visited,
|
||||
val,
|
||||
section,
|
||||
sections,
|
||||
key,
|
||||
add_self = True,
|
||||
scope = subscope,
|
||||
|
|
@ -559,18 +563,17 @@ class App(Base):
|
|||
if isinstance(keys, str):
|
||||
keys = [keys]
|
||||
ret: list[str] = []
|
||||
for section in sections:
|
||||
for key in keys:
|
||||
visited: set[str] = set()
|
||||
for name in projects:
|
||||
rr: list[str] = []
|
||||
self.__get_project_refs(
|
||||
rr, visited, name, section, key, add_self, scope, names_only
|
||||
)
|
||||
# TODO: this looks like a performance hogger
|
||||
for m in rr:
|
||||
if m not in ret:
|
||||
ret.append(m)
|
||||
for key in keys:
|
||||
visited: set[str] = set()
|
||||
for name in projects:
|
||||
rr: list[str] = []
|
||||
self.__get_project_refs(
|
||||
rr, visited, name, sections, key, add_self, scope, names_only
|
||||
)
|
||||
# TODO: this looks like a performance hogger
|
||||
for m in rr:
|
||||
if m not in ret:
|
||||
ret.append(m)
|
||||
return ret
|
||||
|
||||
def get_libname(self, spec: str) -> str | None:
|
||||
|
|
|
|||
Loading…
Reference in a new issue