jw.pkg.App.get_modules_from_project_txt(): Add Scope

Add the Enum "Scope" to denote the scope argument of jw.pkg.App.get_modules_from_project_txt(), because it explains itself better than an integer.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-01-26 13:13:12 +01:00
commit f6ed191d73
11 changed files with 36 additions and 24 deletions

View file

@ -3,6 +3,7 @@
from argparse import Namespace, ArgumentParser
from ..Cmd import Cmd
from ...App import Scope
class CmdLdflags(Cmd): # export
@ -19,7 +20,7 @@ class CmdLdflags(Cmd): # export
# -L needs to contain more paths than libs linked with -l would require
def __get_ldpathflags(self, names: list[str], exclude: list[str] = []) -> str:
deps = self.app.get_modules_from_project_txt(names, ['pkg.requires.jw'], 'build',
scope = 2, add_self=True, names_only=True)
scope = Scope.Subtree, add_self=True, names_only=True)
ret = []
for m in deps:
if m in exclude:
@ -37,7 +38,7 @@ class CmdLdflags(Cmd): # export
def _run(self, args: Namespace) -> None:
deps = self.app.get_modules_from_project_txt(args.module, ['pkg.requires.jw'], 'build',
scope = 1, add_self=args.add_self, names_only=True)
scope = Scope.One, add_self=args.add_self, names_only=True)
out = []
for m in reversed(deps):
if m in args.exclude: