Compare commits

..

No commits in common. "df00e6b679dc7791fdf8ed125f5e89d2e072c13c" and "fba2063bce1c6cb8a959fed8d649fdb8af7422c8" have entirely different histories.

4 changed files with 13 additions and 25 deletions

View File

@ -10,9 +10,9 @@ README = (HERE / "README.md").read_text()
setup( setup(
name='worthless', name='worthless',
version='2.2.22', version='2.2.21',
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'], packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
url='https://git.tretrauit.me/tretrauit/worthless-launcher', url='https://git.froggi.es/tretrauit/worthless-launcher',
license='MIT License', license='MIT License',
author='tretrauit', author='tretrauit',
author_email='tretrauit@gmail.org', author_email='tretrauit@gmail.org',

View File

@ -4,4 +4,4 @@ Launcher = launcher.Launcher
Installer = installer.Installer Installer = installer.Installer
__version__ = "2.2.22" __version__ = "2.2.20"

0
worthless/cli.py Executable file → Normal file
View File

View 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:
file_path.unlink(missing_ok=True) await 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,28 +78,19 @@ 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 processor: match platform.architecture()[0]:
case "i386": case "32bit":
return "windows32" return "windows32"
case "x86_64": case "64bit":
return "windows64" return "windows64"
case "arm":
return "windows_arm32"
case "arm64":
return "windows_arm64"
case "Linux": case "Linux":
match processor: match platform.architecture()[0]:
case "i386": case "32bit":
return "linux32" return "linux32"
case "x86_64": case "64bit":
return "linux64" return "linux64"
case "arm":
return "linux_arm32"
case "arm64":
return "linux_arm64"
case "Darwin": case "Darwin":
return "macos" return "macos"
@ -149,12 +140,9 @@ 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 not asset["name"].endswith(".zip"): if asset["name"].endswith(".zip") and "linux" not in asset["name"] and "windows" not in asset["name"] \
continue and "macos" not in asset["name"] and "android" not in asset["name"]:
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):