diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:21:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:21:11 +0000 |
commit | cdb4a4e19b096cdbf1356e28287238122fc3599c (patch) | |
tree | c5ed3b2b40e4725bbaaae0710d1cbec21b23f3b0 /tools/update_launchers.py | |
parent | Initial commit. (diff) | |
download | python-installer-upstream.tar.xz python-installer-upstream.zip |
Adding upstream version 0.6.0+dfsg1.upstream/0.6.0+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/update_launchers.py')
-rw-r--r-- | tools/update_launchers.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tools/update_launchers.py b/tools/update_launchers.py new file mode 100644 index 0000000..9411f30 --- /dev/null +++ b/tools/update_launchers.py @@ -0,0 +1,48 @@ +import asyncio +import pathlib +import sys + +import httpx + +DOWNLOAD_URL = "https://bitbucket.org/vinay.sajip/simple_launcher/downloads/{}" +VENDOR_DIR = ( + pathlib.Path(__file__) + .parent.parent.joinpath("src", "installer", "_scripts") + .resolve() +) + +LAUNCHERS = [ + "t32.exe", + "t64.exe", + "t_arm.exe", + "t64-arm.exe", + "w32.exe", + "w64.exe", + "w_arm.exe", + "w64-arm.exe", +] + + +async def _download(client: httpx.AsyncClient, name): + url = DOWNLOAD_URL.format(name) + print(f" Fetching {url}") + resp = await client.get(url) + data = await resp.aread() + VENDOR_DIR.joinpath(name).write_bytes(data) + + +async def main(): + print(f"Downloading into {VENDOR_DIR} ...") + async with httpx.AsyncClient() as client: + await asyncio.gather(*(_download(client, name) for name in LAUNCHERS)) + + +def _patch_windows_38(): + # https://github.com/encode/httpx/issues/914 + if sys.version_info >= (3, 8) and sys.platform.startswith("win"): + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + + +if __name__ == "__main__": + _patch_windows_38() + asyncio.run(main()) |