solti-cli 0.1.4__py3-none-any.whl
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.
- solti_cli/__init__.py +8 -0
- solti_cli/cli.py +49 -0
- solti_cli/vendor/cli.cjs +12299 -0
- solti_cli-0.1.4.dist-info/METADATA +92 -0
- solti_cli-0.1.4.dist-info/RECORD +8 -0
- solti_cli-0.1.4.dist-info/WHEEL +4 -0
- solti_cli-0.1.4.dist-info/entry_points.txt +2 -0
- solti_cli-0.1.4.dist-info/licenses/LICENSE +21 -0
solti_cli/__init__.py
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""Solti CLI — Python distribution of the Solti Platform CLI.
|
|
2
|
+
|
|
3
|
+
This PyPI package is a thin wrapper: it runs the same JavaScript CLI that
|
|
4
|
+
`@solti/cli` (npm) ships, via the Node.js runtime already on your PATH.
|
|
5
|
+
Requires Node.js >= 20.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.4"
|
solti_cli/cli.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Entry point for the `solti` console script.
|
|
2
|
+
|
|
3
|
+
Runs the vendored Node.js CLI bundle with the Node runtime on PATH.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import shutil
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
VENDOR_SCRIPT = Path(__file__).parent / "vendor" / "cli.cjs"
|
|
12
|
+
MIN_NODE_MAJOR = 20
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _node_major_version(node: str) -> int:
|
|
16
|
+
try:
|
|
17
|
+
output = subprocess.run(
|
|
18
|
+
[node, "--version"], capture_output=True, text=True, check=True
|
|
19
|
+
).stdout.strip()
|
|
20
|
+
return int(output.lstrip("v").split(".", 1)[0])
|
|
21
|
+
except (subprocess.CalledProcessError, ValueError):
|
|
22
|
+
return 0
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def main() -> int:
|
|
26
|
+
node = shutil.which("node")
|
|
27
|
+
if node is None:
|
|
28
|
+
print(
|
|
29
|
+
"solti (PyPI package) requires Node.js >= 20 on your PATH.\n"
|
|
30
|
+
"Install Node from https://nodejs.org, or use the Homebrew or npm\n"
|
|
31
|
+
"install of the Solti CLI instead:\n"
|
|
32
|
+
" brew install trysolti/tap/solti\n"
|
|
33
|
+
" npm install -g @solti/cli",
|
|
34
|
+
file=sys.stderr,
|
|
35
|
+
)
|
|
36
|
+
return 1
|
|
37
|
+
if _node_major_version(node) < MIN_NODE_MAJOR:
|
|
38
|
+
print(
|
|
39
|
+
f"solti requires Node.js >= {MIN_NODE_MAJOR} "
|
|
40
|
+
f"(found: {node} with an incompatible version).",
|
|
41
|
+
file=sys.stderr,
|
|
42
|
+
)
|
|
43
|
+
return 1
|
|
44
|
+
completed = subprocess.run([node, str(VENDOR_SCRIPT), *sys.argv[1:]])
|
|
45
|
+
return completed.returncode
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if __name__ == "__main__":
|
|
49
|
+
sys.exit(main())
|