From 86cbb30464d80778b8d3d333b395db8769b6812c Mon Sep 17 00:00:00 2001 From: Lemon Rose <78662983+japandotorg@users.noreply.github.com> Date: Fri, 20 Sep 2024 01:46:41 +0530 Subject: [PATCH] [Screenshot] add aarch64 support --- screenshot/common/downloader.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/screenshot/common/downloader.py b/screenshot/common/downloader.py index 1ce7265..afc589a 100644 --- a/screenshot/common/downloader.py +++ b/screenshot/common/downloader.py @@ -113,7 +113,11 @@ async def get_driver_download_url(self) -> str: async with self.__session.get(self.RELEASE_TAG_URL.format(version=version)) as response: json = await response.json() assets = json["assets"] - name: str = "{}-{}-{}.".format("geckodriver", version, self.get_os()) + name: str = "{}-{}-{}.".format( + "geckodriver", + version, + "linux-aarch64" if platform.machine() == "aarch64" else self.get_os(), + ) output_dict = [asset for asset in assets if asset["name"].startswith(name)] url: str = output_dict[0]["browser_download_url"] log.debug("Downloading driver (%s) for [%s]" % (url, self.get_os())) @@ -140,7 +144,9 @@ async def download_and_extract_driver(self) -> None: raise DriverDownloadFailed("Failed to download the driver.") path: pathlib.Path = list(self.data_directory.glob("geckodriver*"))[0] idx: int = path.name.rfind(".") - name: str = path.name[:idx] + "-{}".format(self.get_os()) + name: str = path.name[:idx] + "-{}".format( + "linux-aarch64" if platform.machine() == "aarch64" else self.get_os() + ) os.rename( path, (