devjanitor 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- {devjanitor-0.1.0 → devjanitor-0.1.1}/PKG-INFO +1 -1
- {devjanitor-0.1.0 → devjanitor-0.1.1}/src/devjanitor/__init__.py +1 -1
- {devjanitor-0.1.0 → devjanitor-0.1.1}/src/devjanitor/cli.py +11 -1
- {devjanitor-0.1.0 → devjanitor-0.1.1}/src/devjanitor/scanner.py +2 -1
- {devjanitor-0.1.0 → devjanitor-0.1.1}/tests/test_devjanitor.py +2 -1
- {devjanitor-0.1.0 → devjanitor-0.1.1}/.github/workflows/ci.yml +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/.github/workflows/publish.yml +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/.gitignore +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/LICENSE +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/README.md +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/demo.tape +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/pyproject.toml +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/src/devjanitor/__main__.py +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/src/devjanitor/caches.py +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/src/devjanitor/targets.py +0 -0
- {devjanitor-0.1.0 → devjanitor-0.1.1}/src/devjanitor/utils.py +0 -0
|
@@ -165,7 +165,10 @@ def delete(items: List[Found]) -> int:
|
|
|
165
165
|
for item in items:
|
|
166
166
|
progress.update(task, description=item.path.name)
|
|
167
167
|
try:
|
|
168
|
-
|
|
168
|
+
if sys.version_info >= (3, 12):
|
|
169
|
+
shutil.rmtree(item.path, onexc=_make_writable_and_retry)
|
|
170
|
+
else:
|
|
171
|
+
shutil.rmtree(item.path, onerror=_make_writable_and_retry)
|
|
169
172
|
freed += item.size
|
|
170
173
|
except OSError as exc:
|
|
171
174
|
failed.append((item, exc))
|
|
@@ -262,6 +265,13 @@ def main(argv: Optional[List[str]] = None) -> int:
|
|
|
262
265
|
|
|
263
266
|
def run() -> None:
|
|
264
267
|
try:
|
|
268
|
+
# Legacy Windows code pages can't encode ✨ or box-drawing characters;
|
|
269
|
+
# replace them instead of crashing when output is redirected.
|
|
270
|
+
for stream in (sys.stdout, sys.stderr):
|
|
271
|
+
try:
|
|
272
|
+
stream.reconfigure(errors="replace")
|
|
273
|
+
except (AttributeError, ValueError):
|
|
274
|
+
pass
|
|
265
275
|
sys.exit(main())
|
|
266
276
|
except (KeyboardInterrupt, EOFError):
|
|
267
277
|
err.print("\n[dim]Interrupted, nothing more deleted.[/]")
|
|
@@ -51,7 +51,8 @@ def _disk_usage(st: os.stat_result) -> int:
|
|
|
51
51
|
def dir_size(path: Path) -> tuple:
|
|
52
52
|
"""Return ``(bytes, error_count)`` for everything under ``path``.
|
|
53
53
|
|
|
54
|
-
Symlinks are counted but not followed. Hard-linked files are counted once
|
|
54
|
+
Symlinks are counted but not followed. Hard-linked files are counted once
|
|
55
|
+
(except on Windows, where scandir() reports no link count).
|
|
55
56
|
"""
|
|
56
57
|
total = 0
|
|
57
58
|
errors = 0
|
|
@@ -40,7 +40,7 @@ def tree(tmp_path: Path) -> Path:
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def names(found, root):
|
|
43
|
-
return sorted(
|
|
43
|
+
return sorted(f.path.relative_to(root).as_posix() for f in found)
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
def test_finds_real_targets_only(tree):
|
|
@@ -85,6 +85,7 @@ def test_last_activity_ignores_target_dir(tmp_path):
|
|
|
85
85
|
assert abs(found.last_activity - old) < 5
|
|
86
86
|
|
|
87
87
|
|
|
88
|
+
@pytest.mark.skipif(os.name == "nt", reason="scandir() reports no inode or link count on Windows")
|
|
88
89
|
def test_dir_size_counts_hardlinks_once(tmp_path):
|
|
89
90
|
f = make(tmp_path / "d/a", b"y" * 8192)
|
|
90
91
|
os.link(f, tmp_path / "d/b")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|