fix: hdiffpatch download
This commit is contained in:
parent
fba2063bce
commit
07f6ce6317
@ -4,4 +4,4 @@ Launcher = launcher.Launcher
|
|||||||
Installer = installer.Installer
|
Installer = installer.Installer
|
||||||
|
|
||||||
|
|
||||||
__version__ = "2.2.20"
|
__version__ = "2.2.22"
|
||||||
|
0
worthless/cli.py
Normal file → Executable file
0
worthless/cli.py
Normal file → Executable file
@ -26,7 +26,7 @@ async def _download_file(file_url: str, file_name: str, file_path: Path | str, f
|
|||||||
headers = {}
|
headers = {}
|
||||||
file_path = Path(file_path).joinpath(file_name)
|
file_path = Path(file_path).joinpath(file_name)
|
||||||
if overwrite:
|
if overwrite:
|
||||||
await file_path.unlink(missing_ok=True)
|
file_path.unlink(missing_ok=True)
|
||||||
if file_path.exists():
|
if file_path.exists():
|
||||||
cur_len = (file_path.stat()).st_size
|
cur_len = (file_path.stat()).st_size
|
||||||
headers |= {
|
headers |= {
|
||||||
@ -78,19 +78,28 @@ class HDiffPatch:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_platform_arch():
|
def _get_platform_arch():
|
||||||
|
processor = platform.machine()
|
||||||
match platform.system():
|
match platform.system():
|
||||||
case "Windows":
|
case "Windows":
|
||||||
match platform.architecture()[0]:
|
match processor:
|
||||||
case "32bit":
|
case "i386":
|
||||||
return "windows32"
|
return "windows32"
|
||||||
case "64bit":
|
case "x86_64":
|
||||||
return "windows64"
|
return "windows64"
|
||||||
|
case "arm":
|
||||||
|
return "windows_arm32"
|
||||||
|
case "arm64":
|
||||||
|
return "windows_arm64"
|
||||||
case "Linux":
|
case "Linux":
|
||||||
match platform.architecture()[0]:
|
match processor:
|
||||||
case "32bit":
|
case "i386":
|
||||||
return "linux32"
|
return "linux32"
|
||||||
case "64bit":
|
case "x86_64":
|
||||||
return "linux64"
|
return "linux64"
|
||||||
|
case "arm":
|
||||||
|
return "linux_arm32"
|
||||||
|
case "arm64":
|
||||||
|
return "linux_arm64"
|
||||||
case "Darwin":
|
case "Darwin":
|
||||||
return "macos"
|
return "macos"
|
||||||
|
|
||||||
@ -140,9 +149,12 @@ class HDiffPatch:
|
|||||||
rsp = await session.get("https://api.github.com/repos/{}/{}/releases/latest".format(owner, repo),
|
rsp = await session.get("https://api.github.com/repos/{}/{}/releases/latest".format(owner, repo),
|
||||||
params={"Headers": "Accept: application/vnd.github.v3+json"})
|
params={"Headers": "Accept: application/vnd.github.v3+json"})
|
||||||
rsp.raise_for_status()
|
rsp.raise_for_status()
|
||||||
|
archive_processor = self._get_platform_arch()
|
||||||
for asset in (await rsp.json())["assets"]:
|
for asset in (await rsp.json())["assets"]:
|
||||||
if asset["name"].endswith(".zip") and "linux" not in asset["name"] and "windows" not in asset["name"] \
|
if not asset["name"].endswith(".zip"):
|
||||||
and "macos" not in asset["name"] and "android" not in asset["name"]:
|
continue
|
||||||
|
if archive_processor not in asset["name"]:
|
||||||
|
continue
|
||||||
return asset
|
return asset
|
||||||
|
|
||||||
async def get_latest_release_url(self):
|
async def get_latest_release_url(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user