diff --git a/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py b/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py index 808db79a..8f36ff9f 100644 --- a/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py +++ b/src/python/jw/pkg/cmds/projects/BaseCmdPkgRelations.py @@ -5,6 +5,7 @@ from argparse import Namespace, ArgumentParser from enum import Enum, auto from ...lib.log import * +from ...App import Scope from ..Cmd import Cmd from ..CmdProjects import CmdProjects @@ -30,6 +31,7 @@ class BaseCmdPkgRelations(Cmd): dont_expand_version_macros: bool=False, ignore: set[str] = set(), quote: bool = False, + skip_excluded: bool = False, ) -> list[str]: if subsections is None: @@ -42,6 +44,11 @@ class BaseCmdPkgRelations(Cmd): if syntax == self.Syntax.debian: expand_semver_revision_range = True + if skip_excluded: + excluded = self.app.get_project_refs(modules, ['build'], 'exclude', + scope = Scope.One, add_self=False, names_only=True) + ignore |= set(excluded) + log(DEBUG, f'flavours="{", ".join(flavours)}", subsecs="{", ".join(subsecs)}", "ignore="{", ".join(ignore)}"') version_pattern = re.compile("[0-9-.]*") @@ -150,6 +157,7 @@ class BaseCmdPkgRelations(Cmd): dont_expand_version_macros = args.dont_expand_version_macros, ignore = set(args.ignore.split(',')), quote = args.quote, + skip_excluded = args.skip_excluded, ) ) @@ -180,6 +188,8 @@ class BaseCmdPkgRelations(Cmd): default=False, help='Don\'t expand VERSION and REVISION macros') parser.add_argument('--ignore', nargs='?', default='', help='Packages that ' 'should be ignored together with their dependencies') + 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') parser.add_argument('--quote', action='store_true', default=False, help='Put double quotes around each listed dependency')