wakethemup 0.2.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.
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: wakethemup
3
+ Version: 0.2.1
4
+ Summary: Manage systemd user timers from TOML configs
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/smm-h/wakethemup
7
+ Project-URL: Repository, https://github.com/smm-h/wakethemup
8
+ Keywords: systemd,timer,toml,scheduler,cron,cli,rlsbl
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Classifier: Environment :: Console
11
+ Classifier: Topic :: System :: Systems Administration
12
+ Requires-Python: >=3.9
@@ -0,0 +1,26 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "wakethemup"
7
+ version = "0.2.1"
8
+ description = "Manage systemd user timers from TOML configs"
9
+ license = "MIT"
10
+ requires-python = ">=3.9"
11
+ keywords = ["systemd", "timer", "toml", "scheduler", "cron", "cli", "rlsbl"]
12
+ classifiers = [
13
+ "Operating System :: POSIX :: Linux",
14
+ "Environment :: Console",
15
+ "Topic :: System :: Systems Administration",
16
+ ]
17
+
18
+ [project.urls]
19
+ Homepage = "https://github.com/smm-h/wakethemup"
20
+ Repository = "https://github.com/smm-h/wakethemup"
21
+
22
+ [tool.setuptools]
23
+ packages = ["wakethemup"]
24
+
25
+ [project.scripts]
26
+ wake = "wakethemup:main"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,82 @@
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.2.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 = "wake"
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/wakethemup/releases/download/v{__version__}/"
34
+ f"wakethemup_{__version__}_{os_name}_{arch}.tar.gz"
35
+ )
36
+
37
+ print(f"Downloading wake 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 wake: {e}", file=sys.stderr)
44
+ print(f"URL: {url}", file=sys.stderr)
45
+ print(
46
+ "Download manually from https://github.com/smm-h/wakethemup/releases",
47
+ file=sys.stderr,
48
+ )
49
+ sys.exit(1)
50
+
51
+ with tarfile.open(fileobj=io.BytesIO(data), mode="r:gz") as tar:
52
+ for member in tar.getmembers():
53
+ if member.name == name or member.name.endswith(f"/{name}"):
54
+ member.name = name
55
+ tar.extract(member, _BIN_DIR)
56
+ break
57
+
58
+ os.chmod(bin_path, 0o755)
59
+ return bin_path
60
+
61
+
62
+ def _detect_os():
63
+ s = platform.system().lower()
64
+ if s == "linux":
65
+ return "linux"
66
+ raise RuntimeError(
67
+ f"Unsupported OS: {s}. "
68
+ "wakethemup currently supports Linux only. "
69
+ "Download manually from https://github.com/smm-h/wakethemup/releases"
70
+ )
71
+
72
+
73
+ def _detect_arch():
74
+ m = platform.machine().lower()
75
+ if m in ("x86_64", "amd64"):
76
+ return "amd64"
77
+ if m in ("arm64", "aarch64"):
78
+ return "arm64"
79
+ raise RuntimeError(
80
+ f"Unsupported architecture: {m}. "
81
+ "Download manually from https://github.com/smm-h/wakethemup/releases"
82
+ )
@@ -0,0 +1,3 @@
1
+ from wakethemup import main
2
+
3
+ main()
@@ -0,0 +1,12 @@
1
+ Metadata-Version: 2.4
2
+ Name: wakethemup
3
+ Version: 0.2.1
4
+ Summary: Manage systemd user timers from TOML configs
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/smm-h/wakethemup
7
+ Project-URL: Repository, https://github.com/smm-h/wakethemup
8
+ Keywords: systemd,timer,toml,scheduler,cron,cli,rlsbl
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Classifier: Environment :: Console
11
+ Classifier: Topic :: System :: Systems Administration
12
+ Requires-Python: >=3.9
@@ -0,0 +1,8 @@
1
+ pyproject.toml
2
+ wakethemup/__init__.py
3
+ wakethemup/__main__.py
4
+ wakethemup.egg-info/PKG-INFO
5
+ wakethemup.egg-info/SOURCES.txt
6
+ wakethemup.egg-info/dependency_links.txt
7
+ wakethemup.egg-info/entry_points.txt
8
+ wakethemup.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ wake = wakethemup:main
@@ -0,0 +1 @@
1
+ wakethemup