duckdb-cli 1.4.4__py3-none-win_arm64.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.
- duckdb_cli/__init__.py +0 -0
- duckdb_cli/__main__.py +13 -0
- duckdb_cli/downloader.py +107 -0
- duckdb_cli-1.4.4.data/scripts/duckdb.exe +0 -0
- duckdb_cli-1.4.4.dist-info/METADATA +24 -0
- duckdb_cli-1.4.4.dist-info/RECORD +8 -0
- duckdb_cli-1.4.4.dist-info/WHEEL +4 -0
- duckdb_cli-1.4.4.dist-info/top_level.txt +1 -0
duckdb_cli/__init__.py
ADDED
|
File without changes
|
duckdb_cli/__main__.py
ADDED
duckdb_cli/downloader.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Download the DuckDB CLI binary for the current or specified platform."""
|
|
3
|
+
|
|
4
|
+
import argparse
|
|
5
|
+
import io
|
|
6
|
+
import json
|
|
7
|
+
import os
|
|
8
|
+
import platform
|
|
9
|
+
import stat
|
|
10
|
+
import sys
|
|
11
|
+
import urllib.request
|
|
12
|
+
import zipfile
|
|
13
|
+
|
|
14
|
+
AVAILABLE_PLATFORMS = [
|
|
15
|
+
"linux-amd64",
|
|
16
|
+
"linux-arm64",
|
|
17
|
+
"osx-amd64",
|
|
18
|
+
"osx-arm64",
|
|
19
|
+
"windows-amd64",
|
|
20
|
+
"windows-arm64",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
_RELEASES_URL = "https://github.com/duckdb/duckdb/releases"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def detect_platform():
|
|
27
|
+
system = platform.system().lower()
|
|
28
|
+
machine = platform.machine().lower()
|
|
29
|
+
|
|
30
|
+
os_map = {"darwin": "osx", "linux": "linux", "windows": "windows"}
|
|
31
|
+
arch_map = {"x86_64": "amd64", "amd64": "amd64", "aarch64": "arm64", "arm64": "arm64"}
|
|
32
|
+
|
|
33
|
+
os_name = os_map.get(system)
|
|
34
|
+
arch = arch_map.get(machine)
|
|
35
|
+
if not os_name or not arch:
|
|
36
|
+
sys.exit(f"Unsupported platform: {platform.system()} {platform.machine()}")
|
|
37
|
+
|
|
38
|
+
return f"{os_name}-{arch}"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _get_latest_version():
|
|
42
|
+
url = "https://api.github.com/repos/duckdb/duckdb/releases/latest"
|
|
43
|
+
req = urllib.request.Request(url, headers={"Accept": "application/vnd.github+json"})
|
|
44
|
+
with urllib.request.urlopen(req) as resp:
|
|
45
|
+
return json.loads(resp.read().decode("utf-8"))["tag_name"]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def download(plat, version=None, out_dir="bin"):
|
|
49
|
+
if version is None:
|
|
50
|
+
version = _get_latest_version()
|
|
51
|
+
elif not version.startswith("v"):
|
|
52
|
+
version = "v" + version
|
|
53
|
+
|
|
54
|
+
asset = f"duckdb_cli-{plat}.zip"
|
|
55
|
+
url = f"{_RELEASES_URL}/download/{version}/{asset}"
|
|
56
|
+
|
|
57
|
+
print(f"Downloading DuckDB {version} for {plat}...")
|
|
58
|
+
with urllib.request.urlopen(url) as resp:
|
|
59
|
+
data = resp.read()
|
|
60
|
+
|
|
61
|
+
if not os.path.isdir(out_dir):
|
|
62
|
+
os.makedirs(out_dir)
|
|
63
|
+
|
|
64
|
+
extracted = []
|
|
65
|
+
with zipfile.ZipFile(io.BytesIO(data)) as zf:
|
|
66
|
+
for info in zf.infolist():
|
|
67
|
+
dest = os.path.join(out_dir, info.filename)
|
|
68
|
+
with open(dest, "wb") as f:
|
|
69
|
+
f.write(zf.read(info))
|
|
70
|
+
if sys.platform != "win32":
|
|
71
|
+
mode = os.stat(dest).st_mode
|
|
72
|
+
os.chmod(dest, mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
|
|
73
|
+
print(f" -> {dest}")
|
|
74
|
+
extracted.append(dest)
|
|
75
|
+
|
|
76
|
+
print("Done.")
|
|
77
|
+
return extracted
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def ensure_binary():
|
|
81
|
+
pkg_dir = os.path.dirname(__file__)
|
|
82
|
+
bin_name = "duckdb.exe" if sys.platform == "win32" else "duckdb"
|
|
83
|
+
bin_path = os.path.join(pkg_dir, "bin", bin_name)
|
|
84
|
+
|
|
85
|
+
if os.path.isfile(bin_path):
|
|
86
|
+
return bin_path
|
|
87
|
+
|
|
88
|
+
print("DuckDB CLI binary not found. Downloading...")
|
|
89
|
+
download(detect_platform(), out_dir=os.path.join(pkg_dir, "bin"))
|
|
90
|
+
return bin_path
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def _main():
|
|
94
|
+
parser = argparse.ArgumentParser(description="Download the DuckDB CLI binary.")
|
|
95
|
+
parser.add_argument(
|
|
96
|
+
"--platform",
|
|
97
|
+
choices=AVAILABLE_PLATFORMS,
|
|
98
|
+
default=None,
|
|
99
|
+
help="Target platform (default: auto-detect)",
|
|
100
|
+
)
|
|
101
|
+
args = parser.parse_args()
|
|
102
|
+
plat = args.platform or detect_platform()
|
|
103
|
+
download(plat)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
_main()
|
|
Binary file
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: duckdb-cli
|
|
3
|
+
Version: 1.4.4
|
|
4
|
+
Summary: The DuckDB CLI
|
|
5
|
+
Requires-Python: >=3.6
|
|
6
|
+
Author: DuckDB Foundation
|
|
7
|
+
Maintainer: DuckDB Foundation
|
|
8
|
+
Keywords: DuckDB,Database,SQL,OLAP
|
|
9
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Database
|
|
13
|
+
Classifier: Topic :: Database :: Database Engines/Servers
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Intended Audience :: Education
|
|
17
|
+
Classifier: Intended Audience :: Information Technology
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Classifier: Programming Language :: Python
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Project-URL: Documentation, https://duckdb.org/docs/
|
|
22
|
+
Project-URL: Source, https://github.com/duckdb/duckdb
|
|
23
|
+
Project-URL: Issues, https://github.com/duckdb/duckdb/issues
|
|
24
|
+
Project-URL: Changelog, https://github.com/duckdb/duckdb/releases
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
duckdb_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
duckdb_cli/__main__.py,sha256=Xtz2f9uoh2aKWBeu6ldVgB-Z2fpDlzoWMXARhJWV5Y0,210
|
|
3
|
+
duckdb_cli/downloader.py,sha256=QmV3dj8mkAu38gE6pPrkXNK-P7yMkBJDTv-7NbhqHcs,2998
|
|
4
|
+
duckdb_cli-1.4.4.data/scripts/duckdb.exe,sha256=WhiiRVoIrATSOn6LvcacG5Jp_2WsQWv81CFDs_Iy4HM,39065056
|
|
5
|
+
duckdb_cli-1.4.4.dist-info/METADATA,sha256=rjRWz2dRrCAq0DkbKYWL3jfazVpv1A6u1IbvL5xOgIY,996
|
|
6
|
+
duckdb_cli-1.4.4.dist-info/WHEEL,sha256=Xh7IeUVD_EWwAgziZIevhLkkPhuCQJsn09bZVTz5TC4,94
|
|
7
|
+
duckdb_cli-1.4.4.dist-info/top_level.txt,sha256=7XhuVrOt3jEw7J11y6J-iCD7yyxZM-Av91hMbqZ14_s,11
|
|
8
|
+
duckdb_cli-1.4.4.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
duckdb_cli
|