Skip to content

Commit 3b2ffab

Browse files
authored
Proton-CachyOS: Override __get_data instead of get_tool (#523)
1 parent 3beb3ba commit 3b2ffab

File tree

2 files changed

+14
-34
lines changed

2 files changed

+14
-34
lines changed

pupgui2/resources/ctmods/ctmod_00protonge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from PySide6.QtCore import QObject, QCoreApplication, Signal, Property
1111

1212
from pupgui2.datastructures import Launcher
13-
from pupgui2.util import fetch_project_releases, get_launcher_from_installdir, ghapi_rlcheck, extract_tar
13+
from pupgui2.util import fetch_project_releases, get_launcher_from_installdir, extract_tar
1414
from pupgui2.util import build_headers_with_authorization
1515
from pupgui2.networkutil import download_file
1616

pupgui2/resources/ctmods/ctmod_protoncachyos.py

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ class CtInstaller(ProtonGECtInstaller):
3232
CT_URL = 'https://api.github.com/repos/CachyOS/proton-cachyos/releases'
3333
CT_INFO_URL = 'https://github.com/CachyOS/proton-cachyos/releases/tag/'
3434

35+
def __init__(self, main_window = None) -> None:
36+
37+
super().__init__(main_window)
38+
39+
self.release_format = 'tar.xz'
40+
3541
def __fetch_github_data(self, tag: str, arch: str) -> dict | None:
3642
"""
3743
Fetch GitHub release information
@@ -91,49 +97,23 @@ def fetch_releases(self, count: int = 100, page: int = 1) -> list:
9197
assets.append(name)
9298
return assets
9399

94-
def get_tool(self, version: str, install_dir: str, temp_dir: str):
100+
def __get_data(self, version: str, install_dir: str) -> tuple[dict | None, str | None]:
101+
95102
"""
96-
Download and install the compatibility tool
97-
Return Type: bool
103+
Get needed download data and path to extract directory.
104+
Return Type: tuple[dict | None, str | None]
98105
"""
106+
99107
major, minor, arch = version.split("-")
100108
tag = "-".join(('cachyos', major, minor, 'slr'))
101109
data = self.__fetch_github_data(tag, arch)
102110

103111
if not data or 'download' not in data:
104-
return False
112+
return (None, None)
105113

106114
protondir = os.path.join(install_dir, data['version'])
107-
if not os.path.exists(protondir):
108-
protondir = os.path.join(install_dir, 'proton-' + data['version'])
109-
checksum_dir = f'{protondir}/sha512sum'
110-
source_checksum = self.rs.get(data['checksum']).text if 'checksum' in data else None
111-
local_checksum = open(checksum_dir).read() if os.path.exists(checksum_dir) else None
112-
113-
if os.path.exists(protondir):
114-
if local_checksum and source_checksum:
115-
if local_checksum in source_checksum:
116-
return False
117-
else:
118-
return False
119-
120-
proton_tar = os.path.join(temp_dir, data['download'].split('/')[-1])
121-
if not self.__download(url=data['download'], destination=proton_tar, known_size=data.get('size', 0)):
122-
return False
123-
124-
download_checksum = self.__sha512sum(proton_tar)
125-
if source_checksum and (download_checksum not in source_checksum):
126-
return False
127-
128-
if not extract_tar(proton_tar, install_dir, mode='xz'):
129-
return False
130-
131-
if os.path.exists(checksum_dir):
132-
open(checksum_dir, 'w').write(download_checksum)
133-
134-
self.__set_download_progress_percent(100)
135115

136-
return True
116+
return (data, protondir)
137117

138118
def get_info_url(self, version: str) -> str:
139119
"""

0 commit comments

Comments
 (0)