App.__get_project_refs(): Fix broken detection of missing build dependencies #94
1 changed files with 12 additions and 5 deletions
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
commit
7c76abed33
|
|
@ -21,7 +21,7 @@ if TYPE_CHECKING:
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from typing import TypeAlias
|
from typing import Iterable, TypeAlias
|
||||||
|
|
||||||
from .lib.PackageFilter import PackageFilter
|
from .lib.PackageFilter import PackageFilter
|
||||||
|
|
||||||
|
|
@ -77,12 +77,17 @@ class App(Base):
|
||||||
raise Exception('Tried to access undefined pretty top directory')
|
raise Exception('Tried to access undefined pretty top directory')
|
||||||
return self.___pretty_topdir
|
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 name == self.__top_name:
|
||||||
if pretty:
|
if pretty:
|
||||||
return self.__pretty_topdir
|
return self.__pretty_topdir
|
||||||
return self.__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:
|
if d is None:
|
||||||
continue
|
continue
|
||||||
ret = d + '/' + name
|
ret = d + '/' + name
|
||||||
|
|
@ -99,6 +104,7 @@ class App(Base):
|
||||||
search_subdirs: list[str] | None = None,
|
search_subdirs: list[str] | None = None,
|
||||||
search_absdirs: list[str] | None = None,
|
search_absdirs: list[str] | None = None,
|
||||||
pretty: bool = True,
|
pretty: bool = True,
|
||||||
|
projs_roots: Iterable[str | None] | None = None,
|
||||||
) -> str | None:
|
) -> str | None:
|
||||||
if search_subdirs is None:
|
if search_subdirs is None:
|
||||||
search_subdirs = []
|
search_subdirs = []
|
||||||
|
|
@ -134,7 +140,7 @@ class App(Base):
|
||||||
f'Tried to pretty-format directory {pd}, not implemented'
|
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:
|
if pd is None:
|
||||||
return None
|
return None
|
||||||
if not search_subdirs and not search_absdirs:
|
if not search_subdirs and not search_absdirs:
|
||||||
|
|
@ -405,8 +411,9 @@ class App(Base):
|
||||||
search_absdirs: list[str] | None = None,
|
search_absdirs: list[str] | None = None,
|
||||||
pretty: bool = True,
|
pretty: bool = True,
|
||||||
throw: bool = False,
|
throw: bool = False,
|
||||||
|
projs_roots: Iterable[str | None] | None = None,
|
||||||
) -> str | 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:
|
if ret is not None:
|
||||||
return ret
|
return ret
|
||||||
if not throw:
|
if not throw:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue