haraka 0.2.37__py3-none-any.whl → 0.2.39__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- haraka/post_gen/config/config.py +16 -5
- haraka/post_gen/service/fileOps/purge.py +11 -7
- haraka/utils/manifests/java-springboot.yml +4 -0
- {haraka-0.2.37.dist-info → haraka-0.2.39.dist-info}/METADATA +1 -1
- {haraka-0.2.37.dist-info → haraka-0.2.39.dist-info}/RECORD +7 -7
- {haraka-0.2.37.dist-info → haraka-0.2.39.dist-info}/WHEEL +0 -0
- {haraka-0.2.37.dist-info → haraka-0.2.39.dist-info}/top_level.txt +0 -0
haraka/post_gen/config/config.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
from dataclasses import dataclass
|
2
2
|
from pathlib import Path
|
3
|
-
from typing import Iterable
|
3
|
+
from typing import Iterable, List, Tuple
|
4
4
|
import yaml
|
5
5
|
from pathspec import PathSpec
|
6
6
|
|
@@ -18,7 +18,7 @@ class PostGenConfig:
|
|
18
18
|
evm: bool = False # Extreme Verbosity Mode - For in depth debugging
|
19
19
|
|
20
20
|
|
21
|
-
def load_manifest(variant: str) ->
|
21
|
+
def load_manifest(variant: str) -> Tuple[List[str], List[str]]:
|
22
22
|
"""Return the `keep:` pattern list from `<variant>.yml`."""
|
23
23
|
manifest_path = _MANIFEST_DIR / f"{variant}.yml"
|
24
24
|
if not manifest_path.exists():
|
@@ -27,12 +27,23 @@ def load_manifest(variant: str) -> list[str]:
|
|
27
27
|
f"(expected {manifest_path})"
|
28
28
|
)
|
29
29
|
doc = yaml.safe_load(manifest_path.read_text())
|
30
|
-
if not isinstance(doc, dict)
|
31
|
-
|
30
|
+
if not isinstance(doc, dict):
|
31
|
+
if "keep" not in doc:
|
32
|
+
raise ValueError(f"Manifest {manifest_path} missing a `keep:` section")
|
33
|
+
|
34
|
+
if "protected" not in doc:
|
35
|
+
raise ValueError(f"Manifest {manifest_path} missing a `protected:` section")
|
36
|
+
|
32
37
|
keep_patterns = doc["keep"]
|
38
|
+
protected_dirs = doc.get("protected", [])
|
39
|
+
|
33
40
|
if not isinstance(keep_patterns, Iterable):
|
34
41
|
raise TypeError(f"`keep` section in {manifest_path} must be a list")
|
35
|
-
|
42
|
+
|
43
|
+
if not isinstance(protected_dirs, Iterable):
|
44
|
+
raise TypeError(f"`protected` section in {manifest_path} must be a list")
|
45
|
+
|
46
|
+
return list(keep_patterns), list(protected_dirs)
|
36
47
|
|
37
48
|
|
38
49
|
def build_spec(patterns: Iterable[str]) -> PathSpec:
|
@@ -65,12 +65,14 @@ class ResourcePurger:
|
|
65
65
|
self._log.info(f"Starting purge for variant: {variant}")
|
66
66
|
self._log.debug(f"Loaded variant for purge: {variant}")
|
67
67
|
|
68
|
-
raw_patterns = config.load_manifest(variant)
|
68
|
+
raw_patterns, raw_protected_dirs = config.load_manifest(variant)
|
69
69
|
keep_patterns = [p.rstrip("/") for p in raw_patterns]
|
70
|
+
protected_dirs = [p.rstrip("/") for p in raw_protected_dirs]
|
70
71
|
|
71
72
|
self._log.debug(f"Loaded manifest for variant '{variant}': {keep_patterns}")
|
72
73
|
|
73
74
|
spec = config.build_spec(keep_patterns)
|
75
|
+
protected_spec = config.build_spec(protected_dirs)
|
74
76
|
self._log.debug(f"Built PathSpec for keep patterns. Total patterns: {len(keep_patterns)}")
|
75
77
|
|
76
78
|
self._log.info(f"Keeping {len(keep_patterns)} pattern(s)")
|
@@ -81,7 +83,7 @@ class ResourcePurger:
|
|
81
83
|
|
82
84
|
matched, non_dirs, non_files, _ = self.classify_paths(all_paths, project_dir, spec)
|
83
85
|
|
84
|
-
self._purge_unrelated(project_dir, matched, non_dirs, non_files)
|
86
|
+
self._purge_unrelated(project_dir, matched, non_dirs, non_files, protected_spec)
|
85
87
|
|
86
88
|
self._log.debug(f"Finished purging unrelated paths in project directory: {project_dir}")
|
87
89
|
|
@@ -146,13 +148,14 @@ class ResourcePurger:
|
|
146
148
|
self._log.info(" (none)")
|
147
149
|
self._log.info("-" * 70)
|
148
150
|
|
149
|
-
def _dir_batch_delete(self, title: str, items: List[str], root: Path) -> None:
|
151
|
+
def _dir_batch_delete(self, title: str, items: List[str], root: Path, protected_spec: PathSpec) -> None:
|
150
152
|
self._log.info(f"{title} — {len(items)}")
|
151
153
|
if items:
|
152
154
|
for p in sorted(items):
|
153
|
-
|
154
|
-
|
155
|
-
|
155
|
+
if not protected_spec.match_file(p):
|
156
|
+
full_path = root / Path(p)
|
157
|
+
self._f.remove_dir(full_path)
|
158
|
+
self._log.debug(f" 🗑️ DELETED DIR {p}")
|
156
159
|
else:
|
157
160
|
self._log.info(" (none)")
|
158
161
|
self._log.info("-" * 70)
|
@@ -174,11 +177,12 @@ class ResourcePurger:
|
|
174
177
|
matched: List[str],
|
175
178
|
non_matched_dirs: List[str],
|
176
179
|
non_matched_files: List[str],
|
180
|
+
protected_spec: PathSpec,
|
177
181
|
) -> None:
|
178
182
|
"""Human-friendly digest of keep/delete results."""
|
179
183
|
self._log.info("\n" + "=" * 70)
|
180
184
|
self._print_matches("✅ MATCHED (keep)", matched)
|
181
|
-
self._dir_batch_delete("🗂️ NON-MATCHED DIRECTORIES (delete)", non_matched_dirs, root)
|
185
|
+
self._dir_batch_delete("🗂️ NON-MATCHED DIRECTORIES (delete)", non_matched_dirs, root, protected_spec)
|
182
186
|
self._file_batch_delete("📄 NON-MATCHED FILES (delete)", non_matched_files, root)
|
183
187
|
self._log.info("=" * 70)
|
184
188
|
|
@@ -10,14 +10,14 @@ haraka/art/ascii/frame/width_utils.py,sha256=in4AV3gTBBXUX6N01j67Icu9vsHFomybBN8
|
|
10
10
|
haraka/post_gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
haraka/post_gen/runner.py,sha256=CgC3-mOA6dOovJBCLykrec_Segitbu0XesMH6jsl6lM,3271
|
12
12
|
haraka/post_gen/config/__init__.py,sha256=-_XkJ_Dni28yJCMfIceQSiH1wa_hHsZMoBTyvR9Ikbc,62
|
13
|
-
haraka/post_gen/config/config.py,sha256=
|
13
|
+
haraka/post_gen/config/config.py,sha256=G6Y3a_kjDXjynYi-d3z2oQ8rsp0WSn68TcyNaJZrpN8,1758
|
14
14
|
haraka/post_gen/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
15
15
|
haraka/post_gen/resources/assets.py,sha256=-oz3vlBaVOjeCOO2QHRvOmfyurR1KgihqXqbTtxDNG4,461
|
16
16
|
haraka/post_gen/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
17
|
haraka/post_gen/service/command.py,sha256=yvEzW9rMSXWeQ_2DXuQNtGH6sRuZnK6viMud-amFQXw,2348
|
18
18
|
haraka/post_gen/service/fileOps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
haraka/post_gen/service/fileOps/files.py,sha256=Jm_0bhvVnNqSPGKQ2RnMpx8JLV74M-IXMmwly9fpmVw,3020
|
20
|
-
haraka/post_gen/service/fileOps/purge.py,sha256=
|
20
|
+
haraka/post_gen/service/fileOps/purge.py,sha256=lZ7I98J0UTxU0VAM5pNLjImUluIyzhyLN0Skh4quQ0o,7562
|
21
21
|
haraka/post_gen/service/gitOps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
22
|
haraka/post_gen/service/gitOps/gitops.py,sha256=clWny1m9qB4yr8asba8JwqBjewlMVsJUmIOCLtAL8RI,4052
|
23
23
|
haraka/utils/__init__.py,sha256=3Cp4u0dyAGcmqes-tIr95KFsNsJx5Ji5Yzkto9546Hs,168
|
@@ -27,9 +27,9 @@ haraka/utils/logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
27
27
|
haraka/utils/logging/log_util.py,sha256=UQq2E24q3brvXqcyGCjfSxxHH48JF_BMg54TKdl1SHk,1049
|
28
28
|
haraka/utils/manifests/go-grpc-gateway-buf.yml,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
29
29
|
haraka/utils/manifests/go-grpc-protoc.yml,sha256=OaQlfW_S_OguhW_UcpBVdqdEtUMlg-SrT4bqLhQrY7Y,936
|
30
|
-
haraka/utils/manifests/java-springboot.yml,sha256=
|
30
|
+
haraka/utils/manifests/java-springboot.yml,sha256=AF4ebSqKj2AG4dlTfgJJjzG7Nke4wknRshROHbSL_dc,961
|
31
31
|
haraka/utils/manifests/python-fastapi.yml,sha256=nhO6S9j_r-S10nM8nuw7PtR247-ePhBXHvaXg74CjWw,922
|
32
|
-
haraka-0.2.
|
33
|
-
haraka-0.2.
|
34
|
-
haraka-0.2.
|
35
|
-
haraka-0.2.
|
32
|
+
haraka-0.2.39.dist-info/METADATA,sha256=EMQWLHjXM7S594H9hC54Msg_850T2mbsuK64mGihfgA,579
|
33
|
+
haraka-0.2.39.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
34
|
+
haraka-0.2.39.dist-info/top_level.txt,sha256=1khpwypLKWoklVd_CgFiwAfcctVSXRoRPc3BI9lyIXo,7
|
35
|
+
haraka-0.2.39.dist-info/RECORD,,
|
File without changes
|
File without changes
|