haraka 0.2.31__py3-none-any.whl → 0.2.32__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/service/fileOps/purge.py +53 -36
- {haraka-0.2.31.dist-info → haraka-0.2.32.dist-info}/METADATA +1 -1
- {haraka-0.2.31.dist-info → haraka-0.2.32.dist-info}/RECORD +5 -5
- {haraka-0.2.31.dist-info → haraka-0.2.32.dist-info}/WHEEL +0 -0
- {haraka-0.2.31.dist-info → haraka-0.2.32.dist-info}/top_level.txt +0 -0
@@ -76,55 +76,72 @@ class ResourcePurger:
|
|
76
76
|
divider("Project tree after purge…")
|
77
77
|
self._f.print_tree(project_dir)
|
78
78
|
|
79
|
-
#
|
80
|
-
# internals #
|
81
|
-
# --------------------------------------------------------------------------- #
|
79
|
+
# ----------------------------- internals ------------------------------ #
|
82
80
|
def _purge_unrelated(self, root: Path, spec: PathSpec) -> None:
|
83
81
|
"""
|
84
|
-
Walk
|
85
|
-
|
82
|
+
Walk the project tree; delete every path NOT matched by *spec*.
|
83
|
+
|
84
|
+
Updated to align with the `test_java_manifest` logic for cleaner organization.
|
86
85
|
"""
|
87
|
-
all_paths = list(root.rglob("*"))
|
88
|
-
self._log.debug("📋 Scanning %d paths under %s", len(all_paths), root)
|
89
86
|
|
90
|
-
|
91
|
-
delete_files: list[str] = []
|
92
|
-
delete_dirs: list[str] = []
|
87
|
+
# Dictionaries to separate matches and non-matches for logging
|
93
88
|
|
89
|
+
# 1) Dump every path under root or state what was found
|
90
|
+
all_paths = list(root.rglob("*"))
|
91
|
+
if self._log.evm:
|
92
|
+
self._log.debug(f"📋 All paths under {root} (total {len(all_paths)}):")
|
93
|
+
for p in all_paths:
|
94
|
+
print(f"{p.relative_to(root)}")
|
95
|
+
else:
|
96
|
+
self._log.debug(f"Found {len(all_paths)} paths under {root})")
|
97
|
+
|
98
|
+
matches, non_matched_files, directories_skipped, non_matched_dirs = [], [], [], []
|
94
99
|
for path in all_paths:
|
100
|
+
self._log.debug(f"\nScanning path: {path}")
|
95
101
|
rel = path.relative_to(root).as_posix()
|
96
|
-
|
102
|
+
self._log.debug(f"Relative path for inspection: {rel}")
|
103
|
+
# Match file against the PathSpec
|
97
104
|
if spec.match_file(rel):
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
if path.is_dir():
|
102
|
-
if self._dir_has_kept_ancestor(rel, spec):
|
103
|
-
self._log.debug("⏭️ SKIP DIR (kept ancestor): %s", rel)
|
104
|
-
else:
|
105
|
-
self._log.debug("❌ DELETE DIR: %s", rel)
|
106
|
-
delete_dirs.append(rel)
|
105
|
+
self._log.debug(f"✅ KEEP: Path matches keep patterns: {rel}")
|
106
|
+
matches.append(path) # Collect paths to keep
|
107
107
|
else:
|
108
|
-
|
109
|
-
|
108
|
+
if path.is_dir():
|
109
|
+
if self._is_dir_protected(rel, spec):
|
110
|
+
self._log.debug(f"{"⏭️ SKIPPING DELETE: Protected ancestor found: %s", path}")
|
111
|
+
directories_skipped.append(rel)
|
112
|
+
else:
|
113
|
+
self._log.debug(f"{"❌ DELETE DIR: %s", rel}")
|
114
|
+
self._f.remove_dir(path)
|
115
|
+
non_matched_dirs.append(rel)
|
116
|
+
else:
|
117
|
+
non_matched_files.append(rel)
|
118
|
+
self._f.remove_file(path)
|
119
|
+
self._log.debug(f"{"❌ DELETE FILE: %s", rel}")
|
110
120
|
|
111
|
-
|
112
|
-
|
113
|
-
|
121
|
+
# Non-matching paths: collect and delete
|
122
|
+
self._log.debug(f"❌ DELETE: Path does not match keep patterns: {rel}")
|
123
|
+
|
124
|
+
if path.is_dir():
|
125
|
+
directories_skipped.append(path)
|
126
|
+
self._log.debug(f"⏭️ SKIPPING DELETE: Path is a directory: {path}")
|
114
127
|
|
115
|
-
#
|
116
|
-
|
117
|
-
|
128
|
+
# Print results cleanly for debugging/logging purposes
|
129
|
+
self._log.info("\nMATCHED PATHS:")
|
130
|
+
self._log.info("=" * 80)
|
131
|
+
for match in matches:
|
132
|
+
self._log.info(f"✅ {match}")
|
118
133
|
|
119
|
-
|
120
|
-
self._log.info("
|
121
|
-
|
122
|
-
|
134
|
+
self._log.info("\nNOT MATCHED PATHS:")
|
135
|
+
self._log.info("=" * 80)
|
136
|
+
for non_match in non_matched_files:
|
137
|
+
self._log.info(f"❌ {non_match}")
|
123
138
|
|
124
139
|
@staticmethod
|
125
|
-
def
|
140
|
+
def _is_dir_protected(relative_path: str, spec: PathSpec) -> bool:
|
126
141
|
"""
|
127
|
-
|
142
|
+
Walks from `path` up to `root`, and returns True if any ancestor
|
143
|
+
is matched by the spec.
|
128
144
|
"""
|
129
|
-
|
130
|
-
|
145
|
+
if spec.match_file(relative_path):
|
146
|
+
return True
|
147
|
+
return False
|
@@ -17,7 +17,7 @@ haraka/post_gen/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
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=UY4aq_o_lRi81ZNCPTl3DzmauOpn--WPhZ3BRFMXTL8,5686
|
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
|
@@ -29,7 +29,7 @@ haraka/utils/manifests/go-grpc-gateway-buf.yml,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
|
|
29
29
|
haraka/utils/manifests/go-grpc-protoc.yml,sha256=OaQlfW_S_OguhW_UcpBVdqdEtUMlg-SrT4bqLhQrY7Y,936
|
30
30
|
haraka/utils/manifests/java-springboot.yml,sha256=DTZoVrIDNVpq2AuuXjL2jAvPggeKWVuKJEKwFb90cz4,989
|
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.32.dist-info/METADATA,sha256=V5jL8pP4EBK4gORP9ikwBzon51MnwsS4RB90aZTL-ns,579
|
33
|
+
haraka-0.2.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
34
|
+
haraka-0.2.32.dist-info/top_level.txt,sha256=1khpwypLKWoklVd_CgFiwAfcctVSXRoRPc3BI9lyIXo,7
|
35
|
+
haraka-0.2.32.dist-info/RECORD,,
|
File without changes
|
File without changes
|