Skip to content

Commit b251a6e

Browse files
bbaylesanonrig
authored andcommitted
Add script to update the Ada single header package
1 parent 5135c3f commit b251a6e

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["cffi", "setuptools", "wheel"]
2+
requires = ["cffi", "setuptools", "urllib3>=2.0.2", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.black]

update_ada.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
update_ada.py
3+
4+
Run this script to pull in the latest version of `ada-url/ada` single
5+
header package.
6+
"""
7+
from io import BytesIO
8+
from os.path import dirname, join
9+
from zipfile import ZipFile
10+
11+
from certifi import where
12+
from urllib3 import PoolManager
13+
14+
15+
RELEASE_URL = 'https://github.com/ada-url/ada/releases/latest/download/singleheader.zip'
16+
TARGET_DIR = join(dirname(__file__), 'ada_url/')
17+
18+
19+
def main():
20+
http_client = PoolManager(cert_reqs='CERT_REQUIRED', ca_certs=where())
21+
resp = http_client.request('GET', RELEASE_URL)
22+
with BytesIO(resp.data) as f, ZipFile(f) as z:
23+
for file_name in ('ada.cpp', 'ada.h', 'ada_c.h'):
24+
z.extract(file_name, TARGET_DIR)
25+
26+
27+
if __name__ == '__main__':
28+
main()

0 commit comments

Comments
 (0)