From e0947bfd8dd9abcfef232b3fcf77705cd1130e77 Mon Sep 17 00:00:00 2001 From: davidvujic Date: Mon, 13 Mar 2023 17:10:22 +0100 Subject: [PATCH] fix(poly info): exclude common Python cache folders when listing bricks --- components/polylith/bricks/component.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/components/polylith/bricks/component.py b/components/polylith/bricks/component.py index 59c99d3a..f3b8e168 100644 --- a/components/polylith/bricks/component.py +++ b/components/polylith/bricks/component.py @@ -7,11 +7,17 @@ from polylith.test import create_test -def create_component(path: Path, namespace: str, package: str, description: Union[str, None]) -> None: +def create_component( + path: Path, namespace: str, package: str, description: Union[str, None] +) -> None: create_brick(path, components_dir, namespace, package, description) create_test(path, components_dir, namespace, package) +def is_brick_dir(p: Path) -> bool: + return p.is_dir() and p.name not in {"__pycache__", ".venv", ".mypy_cache"} + + def get_component_dirs(root: Path, top_dir, ns) -> list: theme = workspace.parser.get_theme_from_config(root) dirs = top_dir if theme == "tdd" else f"{top_dir}/{ns}" @@ -21,7 +27,7 @@ def get_component_dirs(root: Path, top_dir, ns) -> list: if not component_dir.exists(): return [] - return [f for f in component_dir.iterdir() if f.is_dir()] + return [f for f in component_dir.iterdir() if is_brick_dir(f)] def get_components_data(