Skip to content

Commit 8764e29

Browse files
cdeustclaude
andcommitted
refactor(launcher): move the post-commit pruning out of _commit_resolved_entries (#575)
The owners lookup pushed _commit_resolved_entries to 43 AST lines, over the craftsmanship gate's 40-line method limit when run with --base origin/main. The dist-info and foreign-ABI pruning now lives in _prune_after_full_commit, called at the same point, behaviour unchanged. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent 17dcc87 commit 8764e29

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎scripts/launcher_deps_install.py‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,23 @@ def _commit_resolved_entries(tmp_dir: str, deps_dir: str) -> tuple[bool, str | N
177177
return False, entry
178178
if entry.endswith(".dist-info"):
179179
committed_dist_infos.append(entry)
180-
# Residue 2: only reached once the WHOLE tmp_dir has committed.
180+
_prune_after_full_commit(deps_dir, committed_dist_infos)
181+
return True, None
182+
183+
184+
def _prune_after_full_commit(deps_dir: str, committed_dist_infos: list[str]) -> None:
185+
"""Prune what the commit loop leaves behind; only called once the WHOLE
186+
``tmp_dir`` has committed.
187+
188+
source: ADR-0748
189+
source: ADR-1061"""
190+
# Residue 2: every stale sibling of a freshly committed `.dist-info`.
181191
for entry in committed_dist_infos:
182192
_fs.prune_superseded_dist_info(deps_dir, entry)
183193
# Issue #540, second shape: a `--target` install can leave a loose
184194
# top-level extension file, tagged for an interpreter no longer
185-
# running, that no `.dist-info` owns and this loop never revisits.
195+
# running, that no `.dist-info` owns and the commit loop never revisits.
186196
_fs.prune_foreign_abi_extensions(deps_dir)
187-
return True, None
188197

189198

190199
def _cleanup_scratch(tmp_dir: str) -> None:

0 commit comments

Comments
 (0)