dataerai-cli-beta 0.1.1__py3-none-win_amd64.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.
- dataerai_cli/__init__.py +7 -0
- dataerai_cli/__main__.py +68 -0
- dataerai_cli/_bin/dataerai.exe +0 -0
- dataerai_cli_beta-0.1.1.dist-info/METADATA +6 -0
- dataerai_cli_beta-0.1.1.dist-info/RECORD +8 -0
- dataerai_cli_beta-0.1.1.dist-info/WHEEL +5 -0
- dataerai_cli_beta-0.1.1.dist-info/entry_points.txt +2 -0
- dataerai_cli_beta-0.1.1.dist-info/top_level.txt +1 -0
dataerai_cli/__init__.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""`dataerai-cli*` — a thin pip launcher for the bundled `dataerai` Go binary.
|
|
2
|
+
|
|
3
|
+
The wheel ships the platform `dataerai` binary in ``dataerai_cli/_bin/`` and
|
|
4
|
+
exposes it as the ``dataerai`` console command. The three environment packages
|
|
5
|
+
(`dataerai-cli`, `-beta`, `-dev`) are identical except for the DEFAULT_SERVER
|
|
6
|
+
baked into ``__main__.py`` at build time.
|
|
7
|
+
"""
|
dataerai_cli/__main__.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Console entry point for the bundled `dataerai` binary.
|
|
2
|
+
|
|
3
|
+
`pip install dataerai-cli[-beta|-dev]` exposes this as the `dataerai` command.
|
|
4
|
+
The only thing that differs between the three environment packages is
|
|
5
|
+
``DEFAULT_SERVER`` below, which ``packaging/build_cli_wheels.py`` rewrites at
|
|
6
|
+
build time. An explicit ``DATAERAI_SERVER`` in the environment always wins, so
|
|
7
|
+
a user can still point any wheel at any instance.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import stat
|
|
13
|
+
import sys
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
# >>> Rewritten per environment at build time — do not hand-edit. <<<
|
|
17
|
+
DEFAULT_SERVER = "https://beta.dataerai.com"
|
|
18
|
+
DEFAULT_CLIENT_ID = "dataerai-cli"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _binary_path() -> Path:
|
|
22
|
+
exe = "dataerai.exe" if os.name == "nt" else "dataerai"
|
|
23
|
+
return Path(__file__).resolve().with_name("_bin") / exe
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def main() -> int:
|
|
27
|
+
binary = _binary_path()
|
|
28
|
+
if not binary.exists():
|
|
29
|
+
sys.stderr.write(f"dataerai: bundled binary missing at {binary}\n")
|
|
30
|
+
return 1
|
|
31
|
+
|
|
32
|
+
# Default the target instance for this wheel; respect an explicit override.
|
|
33
|
+
# Use "empty counts as unset" (not setdefault) so `DATAERAI_SERVER=` from a
|
|
34
|
+
# Docker/k8s env block falls back to the baked default instead of an empty URL.
|
|
35
|
+
if not os.environ.get("DATAERAI_SERVER"):
|
|
36
|
+
os.environ["DATAERAI_SERVER"] = DEFAULT_SERVER
|
|
37
|
+
if not os.environ.get("DATAERAI_CLIENT_ID"):
|
|
38
|
+
os.environ["DATAERAI_CLIENT_ID"] = DEFAULT_CLIENT_ID
|
|
39
|
+
|
|
40
|
+
args = [str(binary), *sys.argv[1:]]
|
|
41
|
+
if os.name == "nt":
|
|
42
|
+
# Windows has no exec-replace; run as a child and propagate the code.
|
|
43
|
+
import subprocess
|
|
44
|
+
|
|
45
|
+
return subprocess.call(args)
|
|
46
|
+
|
|
47
|
+
# POSIX: ensure +x (wheels usually preserve it) then replace this process so
|
|
48
|
+
# signals / exit codes pass straight through. A read-only install may forbid
|
|
49
|
+
# chmod — try execv anyway rather than crashing on the chmod.
|
|
50
|
+
mode = binary.stat().st_mode
|
|
51
|
+
if not mode & stat.S_IXUSR:
|
|
52
|
+
try:
|
|
53
|
+
binary.chmod(mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
|
54
|
+
except OSError:
|
|
55
|
+
pass
|
|
56
|
+
try:
|
|
57
|
+
os.execv(str(binary), args) # never returns on success
|
|
58
|
+
except OSError as e:
|
|
59
|
+
# e.g. a noexec mount, EACCES, or an arch-mismatched binary: emit the
|
|
60
|
+
# same clean one-liner as the missing-binary case rather than crashing
|
|
61
|
+
# the user with a Python traceback.
|
|
62
|
+
sys.stderr.write(f"dataerai: failed to exec bundled binary at {binary}: {e}\n")
|
|
63
|
+
return 1
|
|
64
|
+
return 0 # pragma: no cover
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if __name__ == "__main__":
|
|
68
|
+
raise SystemExit(main())
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
dataerai_cli/__init__.py,sha256=oaujNEzObpAYMHUwl9854vVgpG7FtIskCrtCE8_EEXY,362
|
|
2
|
+
dataerai_cli/__main__.py,sha256=8uIQMDTpi90EBMI5-6tYkHID5aSq9oYDXnRSPtA8IbY,2570
|
|
3
|
+
dataerai_cli/_bin/dataerai.exe,sha256=sRdJ7N5ktoJJIz_3Uc9RXqtoo-xYlFRGnKxpCqX-yic,15443456
|
|
4
|
+
dataerai_cli_beta-0.1.1.dist-info/METADATA,sha256=Pc2SAzVuYiafSGAQbPkGG8-VommTXuBi39DQBKpDR-o,197
|
|
5
|
+
dataerai_cli_beta-0.1.1.dist-info/WHEEL,sha256=QR8DNjG6Lr6bNErJWJgF4dP2dJ2N7NpY-BWly1OvcTM,97
|
|
6
|
+
dataerai_cli_beta-0.1.1.dist-info/entry_points.txt,sha256=KWfMqpFV0JXartJM5jKkuyVFxLlhqzpAFCEZUL4bftw,56
|
|
7
|
+
dataerai_cli_beta-0.1.1.dist-info/top_level.txt,sha256=tQHodnDF9RMd7BHfPndAMC9EDQJULBWCjAPPWVb5ZFc,13
|
|
8
|
+
dataerai_cli_beta-0.1.1.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dataerai_cli
|