diff options
author | Simon Sawicki <contact@grub4k.xyz> | 2024-05-26 21:27:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-26 21:27:21 +0200 |
commit | e897bd8292a41999cf51dba91b390db5643c72db (patch) | |
tree | 1279e992db6706675399485c93d3a0084e37ea27 /devscripts/install_deps.py | |
parent | a2e9031605d87c469be9ce98dbbdf4960b727338 (diff) |
[misc] Add `hatch`, `ruff`, `pre-commit` and improve dev docs (#7409)
Authored by: bashonly, seproDev, Grub4K
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
Co-authored-by: sepro <4618135+seproDev@users.noreply.github.com>
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 d33fc637c..d29250545 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] |