diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:10:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:10:22 +0000 |
commit | bb3682b5a9a4d0e8e45f74de8c21dba3d5e6e0ab (patch) | |
tree | d7890656a89a7d2f3497a5793dd65aa746f7cabd /devscripts/install_deps.py | |
parent | Adding upstream version 2024.04.09. (diff) | |
download | yt-dlp-bb3682b5a9a4d0e8e45f74de8c21dba3d5e6e0ab.tar.xz yt-dlp-bb3682b5a9a4d0e8e45f74de8c21dba3d5e6e0ab.zip |
Adding upstream version 2024.05.26.upstream/2024.05.26
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devscripts/install_deps.py')
-rwxr-xr-x | devscripts/install_deps.py | 12 |
1 files changed, 10 insertions, 2 deletions
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<group_name>[\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] |