cmds.projects.BaseCmdPkgRelations: Support --hide-self

To support the pkg-install-testbuild-deps target, a selector is
needed listing all prerequisites to be installed except the project
under test. --hide-self should be useful for that.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-03-15 16:34:30 +01:00
commit d7e4bd9e33

View file

@ -32,6 +32,7 @@ class BaseCmdPkgRelations(Cmd):
ignore: set[str] = set(), ignore: set[str] = set(),
quote: bool = False, quote: bool = False,
skip_excluded: bool = False, skip_excluded: bool = False,
hide_self = False,
) -> list[str]: ) -> list[str]:
if subsections is None: if subsections is None:
@ -122,6 +123,8 @@ class BaseCmdPkgRelations(Cmd):
case _: case _:
raise NotImplementedError(f'Expanding SemVer range "{dep[0]} {dep[1]} {dep[3]}" is not yet implemented') raise NotImplementedError(f'Expanding SemVer range "{dep[0]} {dep[1]} {dep[3]}" is not yet implemented')
for expanded_dep in expanded_deps: for expanded_dep in expanded_deps:
if hide_self and dep_name in modules:
continue
match syntax: match syntax:
case self.Syntax.semver: case self.Syntax.semver:
pass pass
@ -158,6 +161,7 @@ class BaseCmdPkgRelations(Cmd):
ignore = set(args.ignore.split(',')), ignore = set(args.ignore.split(',')),
quote = args.quote, quote = args.quote,
skip_excluded = args.skip_excluded, skip_excluded = args.skip_excluded,
hide_self = args.hide_self,
) )
) )
@ -190,6 +194,8 @@ class BaseCmdPkgRelations(Cmd):
'should be ignored together with their dependencies') 'should be ignored together with their dependencies')
parser.add_argument('--skip-excluded', action='store_true', default=False, parser.add_argument('--skip-excluded', action='store_true', default=False,
help='Don\'t consider or output modules matching the os cascade in their [build].exclude config') help='Don\'t consider or output modules matching the os cascade in their [build].exclude config')
parser.add_argument('--hide-self', action='store_true', default=False,
help='Don\'t include any of the projects listed in <modules> in the output')
parser.add_argument('--quote', action='store_true', default=False, parser.add_argument('--quote', action='store_true', default=False,
help='Put double quotes around each listed dependency') help='Put double quotes around each listed dependency')