App.__get_project_refs(): Fix broken detection of missing build dependencies #94

Merged
Jan Lindemann merged 4 commits from jan/fix/20260910-broken-detection-of-missing-build-dependencies into master 2026-09-10 13:15:30 +02:00 AGit
Showing only changes of commit 7c76abed33 - Show all commits

App.find_dir(): Allow restricting the project roots

find_dir() and its helpers resolve a project name against the workspace
root and /opt. The build iteration needs to resolve a module against the
workspace only, to tell buildable projects apart from installed ones.

Add a projs_roots parameter to find_dir(), __find_dir() and __proj_dir()
that restricts the search to the given roots. With the parameter omitted
the previous behavior is unchanged.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Jan Lindemann 2026-09-06 17:18:32 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -21,7 +21,7 @@ if TYPE_CHECKING:
import argparse
from argparse import ArgumentParser
from typing import TypeAlias
from typing import Iterable, TypeAlias
from .lib.PackageFilter import PackageFilter
@ -77,12 +77,17 @@ class App(Base):
raise Exception('Tried to access undefined pretty top directory')
return self.___pretty_topdir
def __proj_dir(self, name: str, pretty: bool) -> str | None:
def __proj_dir(
self,
name: str,
pretty: bool,
projs_roots: Iterable[str | None] | None = None,
) -> str | None:
if name == self.__top_name:
if pretty:
return self.__pretty_topdir
return self.__topdir
for d in [self.__projs_root, self.___opt_root]:
for d in projs_roots or [self.__projs_root, self.___opt_root]:
if d is None:
continue
ret = d + '/' + name
@ -99,6 +104,7 @@ class App(Base):
search_subdirs: list[str] | None = None,
search_absdirs: list[str] | None = None,
pretty: bool = True,
projs_roots: Iterable[str | None] | None = None,
) -> str | None:
if search_subdirs is None:
search_subdirs = []
@ -134,7 +140,7 @@ class App(Base):
f'Tried to pretty-format directory {pd}, not implemented'
)
pd = self.__proj_dir(name, False)
pd = self.__proj_dir(name, pretty = False, projs_roots = projs_roots)
if pd is None:
return None
if not search_subdirs and not search_absdirs:
@ -405,8 +411,9 @@ class App(Base):
search_absdirs: list[str] | None = None,
pretty: bool = True,
throw: bool = False,
projs_roots: Iterable[str | None] | None = None,
) -> str | None:
ret = self.__find_dir(name, search_subdirs, search_absdirs, pretty)
ret = self.__find_dir(name, search_subdirs, search_absdirs, pretty, projs_roots)
if ret is not None:
return ret
if not throw: