delayed-rm 2.9.1__tar.gz → 2.9.2__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.
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/PKG-INFO +1 -1
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/delayed_rm/delayed_rm.py +7 -8
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/delayed_rm.egg-info/PKG-INFO +1 -1
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/LICENSE +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/README.md +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/delayed_rm/__init__.py +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/delayed_rm/py.typed +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/delayed_rm.egg-info/SOURCES.txt +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/delayed_rm.egg-info/dependency_links.txt +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/delayed_rm.egg-info/entry_points.txt +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/delayed_rm.egg-info/top_level.txt +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/pyproject.toml +0 -0
- {delayed_rm-2.9.1 → delayed_rm-2.9.2}/setup.cfg +0 -0
|
@@ -3,16 +3,16 @@ from collections import defaultdict
|
|
|
3
3
|
from tempfile import gettempdir
|
|
4
4
|
from datetime import datetime
|
|
5
5
|
from pathlib import Path
|
|
6
|
+
from os import environ
|
|
6
7
|
import subprocess
|
|
7
8
|
import argparse
|
|
8
9
|
import tempfile
|
|
9
10
|
import shutil
|
|
10
11
|
import time
|
|
11
12
|
import sys
|
|
12
|
-
import os
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
__version__ = "2.9.
|
|
15
|
+
__version__ = "2.9.2"
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
#
|
|
@@ -83,9 +83,8 @@ def _prep(paths: list[Path], rf: bool) -> list[Path]:
|
|
|
83
83
|
# Normalize paths and error checking
|
|
84
84
|
try:
|
|
85
85
|
paths = [i.parent.resolve(strict=True) / i.name for i in paths]
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
raise RMError("duplicate items passed")
|
|
86
|
+
if len(paths) != len({i.stat(follow_symlinks=False).st_ino for i in paths}):
|
|
87
|
+
raise RMError("duplicate or hardlinked items passed")
|
|
89
88
|
except (FileNotFoundError, RuntimeError) as e:
|
|
90
89
|
raise RMError(e) from e
|
|
91
90
|
for i in paths:
|
|
@@ -231,7 +230,7 @@ def delayed_rm_raw(delay: int, log: bool, r: bool, f: bool, paths: list[Path]) -
|
|
|
231
230
|
|
|
232
231
|
|
|
233
232
|
def main(prog: str, *args: str) -> bool:
|
|
234
|
-
base: str =
|
|
233
|
+
base: str = Path(prog).name
|
|
235
234
|
parser = argparse.ArgumentParser(prog=base)
|
|
236
235
|
parser.add_argument("--version", action="version", version=f"{base} {__version__}")
|
|
237
236
|
parser.add_argument("--delay", "--ttl", type=int, default=900, help="The deletion delay in seconds")
|
|
@@ -259,12 +258,12 @@ def cli() -> None:
|
|
|
259
258
|
def _secret_cli():
|
|
260
259
|
"""
|
|
261
260
|
This CLI is invoked on import and not will do nothing by default
|
|
262
|
-
This CLI will only
|
|
261
|
+
This CLI will only activate if argv was intentionally configured to do so
|
|
263
262
|
This entrypoint is for the spawned process to act
|
|
264
263
|
"""
|
|
265
264
|
try:
|
|
266
265
|
if len(sys.argv) == 4 and sys.argv[1] == _Secret.value:
|
|
267
|
-
if
|
|
266
|
+
if environ.get(_Secret.key, None) == _Secret.value:
|
|
268
267
|
delay = int(sys.argv[2])
|
|
269
268
|
d = Path(sys.argv[3]).resolve()
|
|
270
269
|
time.sleep(delay)
|
|
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
|