jw.pkg.App: Code beautification

Major - but not yet sufficient - code beautification starting from
jw.pkg.App.

  - Make more methods private
  - Rename methods to be more self-explanatory
  - Same for method arguments, notably clean up some inconsistent
    uses of "module" vs "project"
  - Add more type hints

Fix API breakage in the command modules.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-01-29 10:58:51 +01:00
commit 6ca4af77d7
12 changed files with 204 additions and 209 deletions

View file

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from typing import Iterable
from argparse import Namespace, ArgumentParser
from ...App import Scope
@ -29,7 +30,7 @@ class CmdRequiredOsPkg(Cmd): # export
# TODO: This adds too much. Only the run dependencies of the build dependencies would be needed.
flavours.append('run')
log(DEBUG, "flavours = " + args.flavours)
deps = self.app.get_modules_from_project_txt(modules, ['pkg.requires.jw'], flavours,
deps = self.app.get_project_refs(modules, ['pkg.requires.jw'], flavours,
scope = Scope.Subtree, add_self=True, names_only=True)
if args.skip_excluded:
for d in deps:
@ -38,15 +39,12 @@ class CmdRequiredOsPkg(Cmd): # export
subsecs = self.app.os_cascade()
log(DEBUG, "subsecs = ", subsecs)
requires = []
for s in subsecs:
for f in flavours:
vals = self.app.collect_values(deps, 'pkg.requires.' + s, f)
for sec in subsecs:
for flavour in flavours:
vals = self.app.get_values(deps, ['pkg.requires.' + sec], [flavour])
if vals:
requires = requires + vals
if args.quote:
requires = [f'"{dep}"' for dep in requires]
# TODO: add all not in build tree as -devel
r = ''
for m in requires:
r = r + ' ' + m
print(r[1:])
print(' '.join(requires))