diff --git a/CB/Core.py b/CB/Core.py index b8ea856..32ad9a7 100644 --- a/CB/Core.py +++ b/CB/Core.py @@ -182,6 +182,7 @@ def cleanup(self, directories): for directory in directories: shutil.rmtree(self.path / directory, ignore_errors=True) + # TODO Cleanup after WOTLK Beta def parse_url(self, url): if url.startswith('https://addons.wago.io/addons/'): return WagoAddonsAddon(url, self.wagoCache, 'retail' if url in self.config['IgnoreClientVersion'].keys() @@ -190,19 +191,19 @@ def parse_url(self, url): return WoWInterfaceAddon(url, self.wowiCache) elif url.startswith('https://www.tukui.org/addons.php?id='): if self.clientType != 'retail': - raise RuntimeError('Incorrect client version.') + raise RuntimeError('Unsupported client version.') self.bulk_tukui_check() return TukuiAddon(url, self.tukuiCache) elif url.startswith('https://www.tukui.org/classic-addons.php?id='): if self.clientType != 'classic': - raise RuntimeError('Incorrect client version.') + raise RuntimeError('Unsupported client version.') elif url.endswith('=1') or url.endswith('=2'): raise RuntimeError('ElvUI and Tukui cannot be installed this way.') self.bulk_tukui_check() return TukuiAddon(url, self.tukuiCache) elif url.startswith('https://www.tukui.org/classic-tbc-addons.php?id='): if self.clientType != 'bc': - raise RuntimeError('Incorrect client version.') + raise RuntimeError('Unsupported client version.') elif url.endswith('=1') or url.endswith('=2'): raise RuntimeError('ElvUI and Tukui cannot be installed this way.') self.bulk_tukui_check() @@ -212,29 +213,37 @@ def parse_url(self, url): elif url.lower() == 'elvui': if self.clientType == 'retail': return TukuiAddon('ElvUI', self.tukuiCache, 'elvui') + elif self.clientType == 'wotlk': + raise RuntimeError('Unsupported client version.') else: self.bulk_tukui_check() return TukuiAddon('2', self.tukuiCache) elif url.lower() == 'elvui:dev': - return GitHubAddonRaw('tukui-org/ElvUI', 'development', ['ElvUI', 'ElvUI_OptionsUI'], - self.config['GHAPIKey']) + if self.clientType == 'wotlk': + return GitHubAddonRaw('tukui-org/ElvUI', 'wrath_beta', ['ElvUI', 'ElvUI_OptionsUI'], + self.config['GHAPIKey']) + else: + return GitHubAddonRaw('tukui-org/ElvUI', 'development', ['ElvUI', 'ElvUI_OptionsUI'], + self.config['GHAPIKey']) elif url.lower() == 'tukui': if self.clientType == 'retail': return TukuiAddon('Tukui', self.tukuiCache, 'tukui') + elif self.clientType == 'wotlk': + raise RuntimeError('Unsupported client version.') else: self.bulk_tukui_check() return TukuiAddon('1', self.tukuiCache) elif url.lower() == 'tukui:dev': - if self.clientType == 'retail' or self.clientType == 'bc': + if self.clientType != 'wotlk': return GitHubAddonRaw('tukui-org/Tukui', 'Live', ['Tukui'], self.config['GHAPIKey']) else: - return GitHubAddonRaw('tukui-org/Tukui', 'Live-Classic-Era', ['Tukui'], self.config['GHAPIKey']) + raise RuntimeError('Unsupported client version.') elif url.lower() == 'shadow&light:dev': if self.clientType == 'retail': return GitHubAddonRaw('Shadow-and-Light/shadow-and-light', 'dev', ['ElvUI_SLE'], self.config['GHAPIKey']) else: - raise RuntimeError('Incorrect client version.') + raise RuntimeError('Unsupported client version.') elif url.startswith('https://www.townlong-yak.com/addons/'): raise RuntimeError(f'{url}\nTownlong Yak is no longer supported by this application.') elif url.startswith('https://www.curseforge.com/wow/addons/'): @@ -570,6 +579,7 @@ def bulk_check(self, addons): # for addon in payload['addons']: # self.wagoCache[addon] = payload['addons'][addon] + # TODO Cleanup after WOTLK Beta @retry(custom_error='Failed to parse Tukui API data') def bulk_tukui_check(self): if not self.tukuiCache: diff --git a/CB/GitHub.py b/CB/GitHub.py index f5a4978..412756a 100644 --- a/CB/GitHub.py +++ b/CB/GitHub.py @@ -72,6 +72,8 @@ def get_latest_package(self): targetflavor = 'classic' elif self.clientType == 'bc': targetflavor = 'bcc' + elif self.clientType == 'wotlk': + targetflavor = 'wrath' else: targetflavor = 'mainline' for release in self.metadata['releases']: @@ -99,24 +101,31 @@ def get_latest_package(self): latest = None latestclassic = None latestbc = None + latestwrath = None for release in self.payloads[self.releaseDepth]['assets']: if release['name'] and '-nolib' not in release['name'] \ and release['content_type'] in {'application/x-zip-compressed', 'application/zip'}: if not latest and not release['name'].endswith('-classic.zip') and \ - not release['name'].endswith('-bc.zip') and not release['name'].endswith('-bcc.zip'): + not release['name'].endswith('-bc.zip') and not release['name'].endswith('-bcc.zip') and \ + not release['name'].endswith('-wrath.zip'): latest = release['browser_download_url'] elif not latestclassic and release['name'].endswith('-classic.zip'): latestclassic = release['browser_download_url'] elif not latestbc and (release['name'].endswith('-bc.zip') or release['name'].endswith('-bcc.zip')): latestbc = release['browser_download_url'] + elif not latestwrath and release['name'].endswith('-wrath.zip'): + latestwrath = release['browser_download_url'] if (self.clientType == 'retail' and latest) \ or (self.clientType == 'classic' and latest and not latestclassic) \ - or (self.clientType == 'bc' and latest and not latestbc): + or (self.clientType == 'bc' and latest and not latestbc) \ + or (self.clientType == 'wotlk' and latest and not latestwrath): self.downloadUrl = latest elif self.clientType == 'classic' and latestclassic: self.downloadUrl = latestclassic elif self.clientType == 'bc' and latestbc: self.downloadUrl = latestbc + elif self.clientType == 'wotlk' and latestwrath: + self.downloadUrl = latestwrath else: self.releaseDepth += 1 self.parse() @@ -146,7 +155,9 @@ def __init__(self, project, branch, targetdirs, apikey): headers=HEADERS, auth=APIAuth('token', self.apiKey), timeout=5) except (requests.exceptions.ConnectionError, requests.exceptions.Timeout): raise RuntimeError(f'{project}\nGitHub API failed to respond.') - if self.payload.status_code == 403: + if self.payload.status_code == 401: + raise RuntimeError(f'{project}\nIncorrect or expired GitHub API personal access token.') + elif self.payload.status_code == 403: raise RuntimeError(f'{project}\nGitHub API rate limit exceeded. Try later or provide personal access ' f'token.') elif self.payload.status_code == 404: diff --git a/CB/__init__.py b/CB/__init__.py index 49d06b0..e47ba8f 100644 --- a/CB/__init__.py +++ b/CB/__init__.py @@ -1,7 +1,7 @@ import requests from rich.terminal_theme import TerminalTheme -__version__ = '4.0.1' +__version__ = '4.1.0' __license__ = 'GPLv3' __copyright__ = '2019-2022, Paweł Jastrzębski ' __docformat__ = 'restructuredtext en' diff --git a/CurseBreaker.py b/CurseBreaker.py index 626e4e2..4634df9 100644 --- a/CurseBreaker.py +++ b/CurseBreaker.py @@ -74,6 +74,9 @@ def start(self): flavor = os.path.basename(os.getcwd()) if flavor in {'_retail_', '_ptr_'}: self.core.clientType = 'retail' + elif flavor in {'_classic_beta_'}: + self.core.clientType = 'wotlk' + set_terminal_title(f'CurseBreaker v{__version__} - Wrath of the Lich King') elif flavor in {'_classic_', '_classic_ptr_'}: self.core.clientType = 'bc' set_terminal_title(f'CurseBreaker v{__version__} - Burning Crusade') diff --git a/Pipfile.lock b/Pipfile.lock index 2d15566..c2ea948 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "90dd4d11e8990337dfcd45f4319b17e3773ca1a3e67b9ee8d50cba8223a8497a" + "sha256": "a738a65f9916845da6959b49d8c1f96adefe4a0c634319c9ca49ec879a57d0a1" }, "pipfile-spec": 6, "requires": { @@ -29,7 +29,7 @@ "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d", "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412" ], - "markers": "python_full_version >= '3.6.0'", + "markers": "python_version >= '3.6'", "version": "==2022.6.15" }, "charset-normalizer": { @@ -37,7 +37,7 @@ "sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5", "sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413" ], - "markers": "python_full_version >= '3.6.0'", + "markers": "python_version >= '3.6'", "version": "==2.1.0" }, "checksumdir": { @@ -164,7 +164,7 @@ "sha256:5eb116118f9612ff1ee89ac96437bb6b49e8f04d8a13b514ba26f620208e26eb", "sha256:dc9c10fb40944260f6ed4c688ece0cd2048414940f1cea51b8b226318411c519" ], - "markers": "python_full_version >= '3.6.0'", + "markers": "python_version >= '3.6'", "version": "==2.12.0" }, "pyparsing": { @@ -200,11 +200,11 @@ }, "rich": { "hashes": [ - "sha256:4c586de507202505346f3e32d1363eb9ed6932f0c2f63184dea88983ff4971e2", - "sha256:d2bbd99c320a2532ac71ff6a3164867884357da3e3301f0240090c5d2fdac7ec" + "sha256:2eb4e6894cde1e017976d2975ac210ef515d7548bc595ba20e195fb9628acdeb", + "sha256:63a5c5ce3673d3d5fbbf23cd87e11ab84b6b451436f1b7f19ec54b6bc36ed7ca" ], "index": "pypi", - "version": "==12.4.4" + "version": "==12.5.1" }, "six": { "hashes": [ @@ -216,11 +216,11 @@ }, "urllib3": { "hashes": [ - "sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14", - "sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e" + "sha256:8298d6d56d39be0e3bc13c1c97d133f9b45d797169a0e11cdd0e0489d786f7ec", + "sha256:879ba4d1e89654d9769ce13121e0f94310ea32e8d2f8cf587b77c08bbcdb30d6" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'", - "version": "==1.26.9" + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5' and python_version < '4.0'", + "version": "==1.26.10" }, "wcwidth": { "hashes": [