saferm 0.1.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.
saferm-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: saferm
3
+ Version: 0.1.2
4
+ Summary: AI-first safe rm replacement
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/smm-h/saferm
7
+ Project-URL: Repository, https://github.com/smm-h/saferm
8
+ Keywords: rm,safe,delete,trash,undelete,cli,rlsbl
9
+ Requires-Python: >=3.8
@@ -0,0 +1,18 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "saferm"
7
+ version = "0.1.2"
8
+ description = "AI-first safe rm replacement"
9
+ license = "MIT"
10
+ requires-python = ">=3.8"
11
+ keywords = ["rm", "safe", "delete", "trash", "undelete", "cli", "rlsbl"]
12
+
13
+ [project.urls]
14
+ Homepage = "https://github.com/smm-h/saferm"
15
+ Repository = "https://github.com/smm-h/saferm"
16
+
17
+ [project.scripts]
18
+ saferm = "saferm:main"
@@ -0,0 +1,88 @@
1
+ import io
2
+ import os
3
+ import platform
4
+ import subprocess
5
+ import sys
6
+ import tarfile
7
+ import urllib.request
8
+
9
+
10
+ VERSION = "0.1.1"
11
+ _BIN_DIR = os.path.join(os.path.dirname(__file__), "_bin")
12
+
13
+
14
+ def main():
15
+ bin_path = _ensure_binary()
16
+ result = subprocess.run([bin_path] + sys.argv[1:])
17
+ sys.exit(result.returncode)
18
+
19
+
20
+ def _ensure_binary():
21
+ """Download the binary on first run if not present."""
22
+ name = "saferm"
23
+ bin_path = os.path.join(_BIN_DIR, name)
24
+ if os.path.exists(bin_path):
25
+ return bin_path
26
+
27
+ os.makedirs(_BIN_DIR, exist_ok=True)
28
+
29
+ os_name = _detect_os()
30
+ arch = _detect_arch()
31
+
32
+ url = (
33
+ f"https://github.com/smm-h/saferm/releases/download/v{VERSION}/"
34
+ f"saferm_{VERSION}_{os_name}_{arch}.tar.gz"
35
+ )
36
+
37
+ print(f"Downloading saferm v{VERSION} for {os_name}/{arch}...", file=sys.stderr)
38
+
39
+ try:
40
+ response = urllib.request.urlopen(url)
41
+ data = response.read()
42
+ except Exception as e:
43
+ print(f"Failed to download saferm: {e}", file=sys.stderr)
44
+ print(f"URL: {url}", file=sys.stderr)
45
+ print(
46
+ "Download manually from https://github.com/smm-h/saferm/releases",
47
+ file=sys.stderr,
48
+ )
49
+ print(
50
+ "Or install via Go: go install github.com/smm-h/saferm@latest",
51
+ file=sys.stderr,
52
+ )
53
+ sys.exit(1)
54
+
55
+ with tarfile.open(fileobj=io.BytesIO(data), mode="r:gz") as tar:
56
+ for member in tar.getmembers():
57
+ if member.name == "saferm" or member.name.endswith("/saferm"):
58
+ member.name = name
59
+ tar.extract(member, _BIN_DIR)
60
+ break
61
+
62
+ os.chmod(bin_path, 0o755)
63
+ return bin_path
64
+
65
+
66
+ def _detect_os():
67
+ s = platform.system().lower()
68
+ if s == "linux":
69
+ return "linux"
70
+ if s == "darwin":
71
+ return "darwin"
72
+ raise RuntimeError(
73
+ f"Unsupported OS: {s}. "
74
+ "saferm currently supports Linux and macOS only. "
75
+ "Download manually from https://github.com/smm-h/saferm/releases"
76
+ )
77
+
78
+
79
+ def _detect_arch():
80
+ m = platform.machine().lower()
81
+ if m in ("x86_64", "amd64"):
82
+ return "amd64"
83
+ if m in ("arm64", "aarch64"):
84
+ return "arm64"
85
+ raise RuntimeError(
86
+ f"Unsupported architecture: {m}. "
87
+ "Download manually from https://github.com/smm-h/saferm/releases"
88
+ )
@@ -0,0 +1,3 @@
1
+ from saferm import main
2
+
3
+ main()
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.4
2
+ Name: saferm
3
+ Version: 0.1.2
4
+ Summary: AI-first safe rm replacement
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/smm-h/saferm
7
+ Project-URL: Repository, https://github.com/smm-h/saferm
8
+ Keywords: rm,safe,delete,trash,undelete,cli,rlsbl
9
+ Requires-Python: >=3.8
@@ -0,0 +1,8 @@
1
+ pyproject.toml
2
+ saferm/__init__.py
3
+ saferm/__main__.py
4
+ saferm.egg-info/PKG-INFO
5
+ saferm.egg-info/SOURCES.txt
6
+ saferm.egg-info/dependency_links.txt
7
+ saferm.egg-info/entry_points.txt
8
+ saferm.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ saferm = saferm:main
@@ -0,0 +1 @@
1
+ saferm
saferm-0.1.2/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+