Skip to content

Commit

Permalink
Added warning about outdated project (close #176)
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Oct 17, 2020
1 parent 23f8f20 commit 0bd6109
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 14 deletions.
8 changes: 5 additions & 3 deletions CB/Core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def __init__(self):
self.cachePath = Path('WTF/CurseBreaker.cache')
self.clientType = 'wow_retail'
self.wagoCompanionVersion = 1110
self.currentRetailVersion = '9.0.1'
self.currentClassicVersion = '1.13.5'
self.config = None
self.cfIDs = None
self.dirIndex = None
Expand Down Expand Up @@ -313,9 +315,9 @@ def update_addon(self, url, update, force):
if force:
modified = False
blocked = False
return new.name, new.author, new.currentVersion, oldversion, modified, blocked, source, sourceurl,\
new.changelogUrl, new.dependencies, dev
return url, [], False, False, False, False, '?', None, None, None, None
return new.name, new.author, new.currentVersion, oldversion, new.uiVersion, modified, blocked, source, \
sourceurl, new.changelogUrl, new.dependencies, dev
return url, [], False, False, None, False, False, '?', None, None, None, None

def check_checksum(self, addon, bulk=True):
checksums = {}
Expand Down
3 changes: 3 additions & 0 deletions CB/CurseForge.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, url, project, checkcache, clienttype, allowdev):
self.downloadUrl = None
self.changelogUrl = None
self.currentVersion = None
self.uiVersion = None
self.archive = None
self.dependencies = None
self.directories = []
Expand All @@ -59,6 +60,8 @@ def get_current_version(self):
self.downloadUrl = f['downloadUrl']
self.changelogUrl = f'{self.payload["websiteUrl"]}/files/{f["id"]}'
self.currentVersion = f['displayName']
if len(f['gameVersion']) > 0:
self.uiVersion = max(f['gameVersion'])
if len(f['dependencies']) > 0:
self.dependencies = []
for d in f['dependencies']:
Expand Down
1 change: 1 addition & 0 deletions CB/GitHub.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, url, clienttype):
self.name = project.split('/')[1]
self.clientType = clienttype
self.currentVersion = self.payload['tag_name'] or self.payload['name']
self.uiVersion = None
self.downloadUrl = None
self.changelogUrl = self.payload['html_url']
self.archive = None
Expand Down
1 change: 1 addition & 0 deletions CB/GitLab.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, name, projectid, path, branch):
self.downloadUrl = f'https://git.tukui.org/{path}/-/archive/{branch}/{self.shorthPath}-{branch}.zip'
self.changelogUrl = None
self.currentVersion = self.payload['commit']['short_id']
self.uiVersion = None
self.branch = branch
self.archive = None
self.dependencies = None
Expand Down
1 change: 1 addition & 0 deletions CB/Tukui.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, url, isclassic):
self.name = self.payload['name'].strip().strip('\u200b')
self.downloadUrl = self.payload['url']
self.currentVersion = self.payload['version']
self.uiVersion = self.payload['patch']
self.archive = None
self.dependencies = None
self.directories = []
Expand Down
1 change: 1 addition & 0 deletions CB/WoWInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self, url, checkcache):
self.downloadUrl = self.payload['UIDownload']
self.changelogUrl = f'{url}#changelog'
self.currentVersion = self.payload['UIVersion']
self.uiVersion = None
self.archive = None
self.dependencies = None
self.directories = []
Expand Down
29 changes: 18 additions & 11 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def parse_args(self, args):
args = args.replace(addon['Name'], '', 1)
return sorted(parsed)

def parse_link(self, text, link, dev=None, authors=None):
def parse_link(self, text, link, dev=None, authors=None, uiversion=None):
if dev == 1:
dev = ' [bold][B][/bold]'
elif dev == 2:
Expand All @@ -361,10 +361,14 @@ def parse_link(self, text, link, dev=None, authors=None):
authors = f' [bold black]by {", ".join(authors)}[/bold black]'
else:
authors = ''
if uiversion and uiversion not in [self.core.currentRetailVersion, self.core.currentClassicVersion]:
uiversion = ' [bold yellow][!][bold yellow]'
else:
uiversion = ''
if link:
obj = Text.from_markup(f'[link={link}]{text}[/link]{dev}{authors}')
obj = Text.from_markup(f'[link={link}]{text}[/link]{dev}{authors}{uiversion}')
else:
obj = Text.from_markup(f'{text}{dev}{authors}')
obj = Text.from_markup(f'{text}{dev}{authors}{uiversion}')
obj.no_wrap = True
return obj

Expand Down Expand Up @@ -460,9 +464,9 @@ def c_update(self, args, addline=False, update=True, force=False, provider=False
while not progress.finished:
for addon in addons:
try:
name, authors, versionnew, versionold, modified, blocked, source, sourceurl, changelog, deps,\
dstate = self.core.update_addon(addon if isinstance(addon, str) else addon['URL'],
update, force)
name, authors, versionnew, versionold, uiversion, modified, blocked, source, sourceurl,\
changelog, deps, dstate = self.core.update_addon(
addon if isinstance(addon, str) else addon['URL'], update, force)
dependencies.add_dependency(deps)
if provider:
source = f' [bold white]{source}[/bold white]'
Expand All @@ -473,21 +477,24 @@ def c_update(self, args, addline=False, update=True, force=False, provider=False
if modified:
self.table.add_row(f'[bold red]Modified[/bold red]{source}',
self.parse_link(name, sourceurl, authors=authors),
self.parse_link(versionold, changelog, dstate))
self.parse_link(versionold, changelog, dstate,
uiversion=uiversion))
else:
if self.core.config['CompactMode'] and compacted > -1:
compacted += 1
else:
self.table.add_row(f'[green]Up-to-date[/green]{source}',
self.parse_link(name, sourceurl, authors=authors),
self.parse_link(versionold, changelog, dstate))
self.parse_link(versionold, changelog, dstate,
uiversion=uiversion))
else:
if modified or blocked:
self.table.add_row(f'[bold red]Update suppressed[/bold red]{source}',
self.parse_link(name, sourceurl, authors=authors),
self.parse_link(versionold, changelog, dstate))
self.parse_link(versionold, changelog, dstate,
uiversion=uiversion))
else:
version = self.parse_link(versionnew, changelog, dstate)
version = self.parse_link(versionnew, changelog, dstate, uiversion=uiversion)
version.stylize('yellow')
self.table.add_row(
f'[yellow]{"Updated" if update else "Update available"}[/yellow]{source}',
Expand Down Expand Up @@ -667,7 +674,7 @@ def c_show(self, args):
self.core.bulk_check(addons)
for addon in addons:
dependencies = DependenciesParser(self.core)
name, _, _, _, _, _, _, _, _, deps, _ = self.core.update_addon(addon['URL'], False, False)
name, _, _, _, _, _, _, _, _, _, deps, _ = self.core.update_addon(addon['URL'], False, False)
dependencies.add_dependency(deps)
deps = dependencies.parse_dependency(output=True)
if len(deps) > 0:
Expand Down

0 comments on commit 0bd6109

Please sign in to comment.