@ahqstore/cli 0.10.1 → 0.10.3
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.
- package/Cargo.toml +1 -1
- package/package.json +1 -1
- package/go/go.exe +0 -0
- package/go/go.mod +0 -3
- package/go/main.go +0 -7
- package/python/.vscode/settings.json +0 -4
- package/python/cli.py +0 -124
- package/python/pyproject.toml +0 -27
- package/python/setup.py +0 -3
package/Cargo.toml
CHANGED
package/package.json
CHANGED
package/go/go.exe
DELETED
|
Binary file
|
package/go/go.mod
DELETED
package/go/main.go
DELETED
package/python/cli.py
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
from cffi import FFI
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
from requests import get
|
|
4
|
-
|
|
5
|
-
import importlib.metadata
|
|
6
|
-
|
|
7
|
-
import os
|
|
8
|
-
import platform
|
|
9
|
-
import sys
|
|
10
|
-
|
|
11
|
-
ffi = FFI()
|
|
12
|
-
|
|
13
|
-
ffi.cdef("""
|
|
14
|
-
char* get_ver();
|
|
15
|
-
void init_args();
|
|
16
|
-
void add_arg(char*);
|
|
17
|
-
void node_entrypoint(bool);
|
|
18
|
-
""")
|
|
19
|
-
|
|
20
|
-
ver = importlib.metadata.version("ahqstore-cli")
|
|
21
|
-
|
|
22
|
-
def rust_target():
|
|
23
|
-
os = platform.system().lower()
|
|
24
|
-
arch = platform.machine().lower()
|
|
25
|
-
|
|
26
|
-
if os == "windows":
|
|
27
|
-
if arch == "i686":
|
|
28
|
-
return "i686-pc-windows-msvc"
|
|
29
|
-
elif arch in ("x86_64", "amd64"):
|
|
30
|
-
return "x86_64-pc-windows-msvc"
|
|
31
|
-
elif arch == "aarch64":
|
|
32
|
-
return "aarch64-pc-windows-msvc"
|
|
33
|
-
elif os == "darwin":
|
|
34
|
-
if arch in ("x86_64", "amd64"):
|
|
35
|
-
return "x86_64-apple-darwin"
|
|
36
|
-
elif arch == "aarch64":
|
|
37
|
-
return "aarch64-apple-darwin"
|
|
38
|
-
elif os == "linux":
|
|
39
|
-
if arch == "i686":
|
|
40
|
-
return "i686-unknown-linux-gnu"
|
|
41
|
-
elif arch in ("x86_64", "amd64"):
|
|
42
|
-
return "x86_64-unknown-linux-gnu"
|
|
43
|
-
elif arch == "armv7l":
|
|
44
|
-
return "armv7-unknown-linux-gnueabihf"
|
|
45
|
-
elif arch == "aarch64":
|
|
46
|
-
return "aarch64-unknown-linux-gnu"
|
|
47
|
-
|
|
48
|
-
# Error out for unsupported systems
|
|
49
|
-
print(f"Error: Unsupported platform: {os} {arch}")
|
|
50
|
-
sys.exit(1)
|
|
51
|
-
|
|
52
|
-
def get_prefix_suffix():
|
|
53
|
-
os = platform.system().lower()
|
|
54
|
-
prefix = ""
|
|
55
|
-
suffix = ""
|
|
56
|
-
|
|
57
|
-
if os == "windows":
|
|
58
|
-
suffix = ".dll"
|
|
59
|
-
elif os == "darwin":
|
|
60
|
-
prefix = "lib"
|
|
61
|
-
suffix = ".dylib"
|
|
62
|
-
elif os == "linux":
|
|
63
|
-
prefix = "lib"
|
|
64
|
-
suffix = ".so"
|
|
65
|
-
else:
|
|
66
|
-
# Default to a generic UNIX-like system
|
|
67
|
-
prefix = "lib"
|
|
68
|
-
suffix = ".so"
|
|
69
|
-
|
|
70
|
-
return (prefix, suffix)
|
|
71
|
-
|
|
72
|
-
def dlib():
|
|
73
|
-
(prefix, suffix) = get_prefix_suffix()
|
|
74
|
-
|
|
75
|
-
return f"{prefix}ahqstore_cli_rs{suffix}"
|
|
76
|
-
|
|
77
|
-
dylib = Path.home().joinpath("ahqstore-py")
|
|
78
|
-
|
|
79
|
-
if not dylib.exists():
|
|
80
|
-
dylib.mkdir()
|
|
81
|
-
|
|
82
|
-
dylib = dylib.joinpath(dlib())
|
|
83
|
-
|
|
84
|
-
def dwnl():
|
|
85
|
-
(prefix, suffix) = get_prefix_suffix()
|
|
86
|
-
|
|
87
|
-
return f"https://github.com/ahqstore/cli/releases/download/{ver}/{prefix}ahqstore_cli_rs-{rust_target()}{suffix}"
|
|
88
|
-
|
|
89
|
-
def dwn():
|
|
90
|
-
url = dwnl()
|
|
91
|
-
|
|
92
|
-
resp = get(url)
|
|
93
|
-
|
|
94
|
-
resp.raise_for_status()
|
|
95
|
-
|
|
96
|
-
with open(dylib, "wb") as f:
|
|
97
|
-
f.write(resp.content)
|
|
98
|
-
|
|
99
|
-
def main():
|
|
100
|
-
C = None
|
|
101
|
-
|
|
102
|
-
try:
|
|
103
|
-
C = ffi.dlopen(str(dylib))
|
|
104
|
-
|
|
105
|
-
ver_ptr = C.get_ver()
|
|
106
|
-
|
|
107
|
-
version = ffi.string(ver_ptr)
|
|
108
|
-
|
|
109
|
-
if not version == bytes(ver, "utf-8"):
|
|
110
|
-
raise BufferError("This was an error comapring them")
|
|
111
|
-
except:
|
|
112
|
-
dwn()
|
|
113
|
-
C = ffi.dlopen(str(dylib))
|
|
114
|
-
|
|
115
|
-
C.init_args()
|
|
116
|
-
|
|
117
|
-
for item in sys.argv[1:]:
|
|
118
|
-
arg = ffi.new("char[]", bytes(item, "ascii"))
|
|
119
|
-
|
|
120
|
-
C.add_arg(arg)
|
|
121
|
-
|
|
122
|
-
C.node_entrypoint(
|
|
123
|
-
os.environ.get("CI") == "true"
|
|
124
|
-
)
|
package/python/pyproject.toml
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "ahqstore-cli"
|
|
7
|
-
version = "0.10.1"
|
|
8
|
-
authors = [{ name = "AHQ Softwares", email = "ahqsecret@gmail.com" }]
|
|
9
|
-
description = "A modern Python wrapper for the ahqstore CLI"
|
|
10
|
-
readme = "../README.md"
|
|
11
|
-
requires-python = ">=3.8"
|
|
12
|
-
classifiers = [
|
|
13
|
-
"Programming Language :: Python :: 3",
|
|
14
|
-
"License :: OSI Approved :: MIT License",
|
|
15
|
-
"Operating System :: OS Independent",
|
|
16
|
-
]
|
|
17
|
-
dependencies = [
|
|
18
|
-
# List your Python dependencies here, e.g.,
|
|
19
|
-
"requests>=2.25.1",
|
|
20
|
-
"cffi>=1.17.0",
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
[tool.hatch.build.targets.wheel]
|
|
24
|
-
packages = ["."]
|
|
25
|
-
|
|
26
|
-
[project.scripts]
|
|
27
|
-
ahqstore = "cli:main"
|
package/python/setup.py
DELETED