Part of: #1409
Depends on: #6809.
Problem
beets.util.components, beets.util.ancestry, and the byte-compatible prune_dirs implementation duplicate behavior that Path already provides. Keeping these helpers after runtime paths are Path-native makes utility code harder to reason about and leaves another place where bytes can enter filesystem logic.
Expected behavior
- Replace
components callers with Path.parts or equivalent local Path operations.
- Replace
ancestry callers with Path.parents or equivalent local Path operations.
- Make
prune_dirs accept Path for both the target directory and optional root.
- Keep clutter matching behavior unchanged.
- Remove tests that only validate the deleted compatibility helpers, while preserving coverage for the behavior that still exists.
Suggested fix
Remove the obsolete decomposition helpers first, then simplify prune_dirs around Path.exists, Path.iterdir, Path.parents, and shutil.rmtree.
Acceptance criteria
- No production or test code imports
components or ancestry.
prune_dirs callers pass Path.
- Directory pruning behavior remains covered by tests.
poe test and poe lint pass with coverage at or above 80%.
Part of: #1409
Depends on: #6809.
Problem
beets.util.components,beets.util.ancestry, and the byte-compatibleprune_dirsimplementation duplicate behavior thatPathalready provides. Keeping these helpers after runtime paths are Path-native makes utility code harder to reason about and leaves another place where bytes can enter filesystem logic.Expected behavior
componentscallers withPath.partsor equivalent localPathoperations.ancestrycallers withPath.parentsor equivalent localPathoperations.prune_dirsacceptPathfor both the target directory and optional root.Suggested fix
Remove the obsolete decomposition helpers first, then simplify
prune_dirsaroundPath.exists,Path.iterdir,Path.parents, andshutil.rmtree.Acceptance criteria
componentsorancestry.prune_dirscallers passPath.poe testandpoe lintpass with coverage at or above 80%.