From 97bc822e9a765ef2e62b1b4a256c456068b82e05 Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Mon, 20 May 2024 18:40:45 -0400 Subject: [PATCH 1/2] Loop through all nested configs --- gitman/commands.py | 4 +--- gitman/models/config.py | 18 ------------------ gitman/tests/test_models_config.py | 16 +--------------- pyproject.toml | 2 +- 4 files changed, 3 insertions(+), 37 deletions(-) diff --git a/gitman/commands.py b/gitman/commands.py index f6e91fd..1fae2dc 100644 --- a/gitman/commands.py +++ b/gitman/commands.py @@ -8,7 +8,6 @@ from . import common from .decorators import preserve_cwd from .models import Config, Source, find_nested_configs, load_config -from .models.config import filter_nested_configs def init(*, force: bool = False): @@ -93,7 +92,6 @@ def install( config = load_config(root) configs = [config] if config else [] configs.extend(find_nested_configs(root, depth, [])) - configs = filter_nested_configs(configs) if configs: count = 0 @@ -277,7 +275,7 @@ def lock(*names, depth=None, root=None): config = load_config(root) configs = [config] if config else [] configs.extend(find_nested_configs(root, depth, [])) - configs = filter_nested_configs(configs) + if configs: count = 0 common.newline() diff --git a/gitman/models/config.py b/gitman/models/config.py index 3dcd1c2..57e23fe 100644 --- a/gitman/models/config.py +++ b/gitman/models/config.py @@ -1,6 +1,5 @@ import os import sys -from pathlib import Path from typing import Iterator, List, Optional import log @@ -465,20 +464,3 @@ def _valid_filename(filename): if name.startswith("."): name = name[1:] return name in {"gitman", "gdm"} and ext in {".yml", ".yaml"} - - -def filter_nested_configs(configs: List[Config]) -> List[Config]: - """Filter subdirectories inside of parent config.""" - filtered_configs = [] - for config_a in configs: - is_nested = False - for config_b in configs: - if config_a == config_b: - continue - if Path(config_b.location_path) in Path(config_a.location_path).parents: - is_nested = True - break - if not is_nested: - filtered_configs.append(config_a) - - return filtered_configs diff --git a/gitman/tests/test_models_config.py b/gitman/tests/test_models_config.py index ea87b6a..9c1c2ba 100644 --- a/gitman/tests/test_models_config.py +++ b/gitman/tests/test_models_config.py @@ -5,8 +5,7 @@ import pytest from expecter import expect -from gitman.models import Config, find_nested_configs, load_config -from gitman.models.config import filter_nested_configs +from gitman.models import Config, load_config from .conftest import FILES @@ -149,16 +148,3 @@ def test_load_from_directory_without_config_file(self, tmpdir): config = load_config() assert None is config - - @pytest.mark.integration - def test_filter_nested_config(self): - """Verify that filter_nested_config removes nested configs""" - config = load_config(FILES) - assert None is not config - count = config.install_dependencies(depth=2) - assert 5 == count - configs = [config] if config else [] - configs.extend(find_nested_configs(FILES, depth=2, skip_paths=[])) - assert 2 == len(configs) - configs = filter_nested_configs(configs) - assert 1 == len(configs) diff --git a/pyproject.toml b/pyproject.toml index 465f116..848f9e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "gitman" -version = "3.5.1" +version = "3.5.2a1" description = "A language-agnostic dependency manager using Git." license = "MIT" From d1c1917a4f934175a16b69469b1ceeac95929d69 Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Wed, 22 May 2024 07:16:10 -0400 Subject: [PATCH 2/2] Bump version to 3.5.2 --- CHANGELOG.md | 4 ++++ pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 379f212..e5e9577 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 3.5.2 (2024-06-22) + +- Fixed logic to included all nested configs. + # 3.5.1 (2024-05-19) - Updated nested config lookup to ignore build and package directories. diff --git a/pyproject.toml b/pyproject.toml index 848f9e7..14176bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "gitman" -version = "3.5.2a1" +version = "3.5.2" description = "A language-agnostic dependency manager using Git." license = "MIT"