From bb3682b5a9a4d0e8e45f74de8c21dba3d5e6e0ab Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:10:22 +0200 Subject: Adding upstream version 2024.05.26. Signed-off-by: Daniel Baumann --- devscripts/install_deps.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'devscripts/install_deps.py') diff --git a/devscripts/install_deps.py b/devscripts/install_deps.py index d33fc63..d292505 100755 --- a/devscripts/install_deps.py +++ b/devscripts/install_deps.py @@ -42,17 +42,25 @@ def parse_args(): def main(): args = parse_args() project_table = parse_toml(read_file(args.input))['project'] + recursive_pattern = re.compile(rf'{project_table["name"]}\[(?P[\w-]+)\]') optional_groups = project_table['optional-dependencies'] excludes = args.exclude or [] + def yield_deps(group): + for dep in group: + if mobj := recursive_pattern.fullmatch(dep): + yield from optional_groups.get(mobj.group('group_name'), []) + else: + yield dep + targets = [] if not args.only_optional: # `-o` should exclude 'dependencies' and the 'default' group targets.extend(project_table['dependencies']) if 'default' not in excludes: # `--exclude default` should exclude entire 'default' group - targets.extend(optional_groups['default']) + targets.extend(yield_deps(optional_groups['default'])) for include in filter(None, map(optional_groups.get, args.include or [])): - targets.extend(include) + targets.extend(yield_deps(include)) targets = [t for t in targets if re.match(r'[\w-]+', t).group(0).lower() not in excludes] -- cgit v1.2.3