From 11c1f0a58ec63d447f48eda049377dc1a6cbbde0 Mon Sep 17 00:00:00 2001 From: Jace Browning Date: Sun, 19 May 2024 18:50:37 -0400 Subject: [PATCH] Update nested config lookup to ignore certain directories --- CHANGELOG.md | 4 ++++ docs/requirements.txt | 2 +- gitman/commands.py | 1 + gitman/models/config.py | 14 +++++++------- poetry.lock | 1 - pyproject.toml | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ba06174..379f212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 3.5.1 (2024-05-19) + +- Updated nested config lookup to ignore build and package directories. + # 3.5 (2024-04-27) - Added `--no-scripts` option to skip install/update scripts. diff --git a/docs/requirements.txt b/docs/requirements.txt index c18c010..91c8707 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -22,7 +22,7 @@ idna==3.3 ; python_version >= "3.8" and python_version < "4.0" importlib-metadata==4.12.0 ; python_version >= "3.8" and python_version < "4.0" iniconfig==1.1.1 ; python_version >= "3.8" and python_version < "4.0" isort==5.10.1 ; python_version >= "3.8" and python_version < "4.0" -jinja2==3.1.3 ; python_version >= "3.8" and python_version < "4.0" +jinja2==3.1.4 ; python_version >= "3.8" and python_version < "4.0" lazy-object-proxy==1.4.3 ; python_version >= "3.8" and python_version < "4.0" macfsevents==0.8.1 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "darwin" macholib==1.16 ; python_version >= "3.8" and python_version < "4.0" and sys_platform == "darwin" diff --git a/gitman/commands.py b/gitman/commands.py index dfe2c54..f6e91fd 100644 --- a/gitman/commands.py +++ b/gitman/commands.py @@ -171,6 +171,7 @@ def update( config = load_config(root) configs = [config] if config else [] configs.extend(find_nested_configs(root, depth, [])) + if configs: count = 0 common.newline() diff --git a/gitman/models/config.py b/gitman/models/config.py index e64ff04..3dcd1c2 100644 --- a/gitman/models/config.py +++ b/gitman/models/config.py @@ -431,17 +431,17 @@ def find_nested_configs( log.debug(f"Searching for nested project in: {root}") for name in os.listdir(root): - if name.startswith("."): + if name[0] in {".", "_", "@"}: + continue + if name in {"build", "dist", "node_modules", "venv"}: continue path = os.path.join(root, name) - if os.path.isdir(path) and path not in skip_paths and not os.path.islink(path): - config = load_config(path, search=False) - if config: + if path in skip_paths: + continue + if os.path.isdir(path) and not os.path.islink(path): + if config := load_config(path, search=False): configs.append(config) - if os.path.islink(path): - continue - if depth is not None: configs.extend(find_nested_configs(path, depth - 1, skip_paths)) else: diff --git a/poetry.lock b/poetry.lock index 54f83c0..2f39fd3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1101,7 +1101,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, diff --git a/pyproject.toml b/pyproject.toml index 77bdd07..465f116 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "gitman" -version = "3.5" +version = "3.5.1" description = "A language-agnostic dependency manager using Git." license = "MIT"