Skip to content

Commit

Permalink
Improved companion updater
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Jun 6, 2022
1 parent 1215e53 commit 2897680
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
7 changes: 4 additions & 3 deletions CurseBreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from prompt_toolkit import PromptSession, HTML
from prompt_toolkit.shortcuts import confirm
from prompt_toolkit.completion import WordCompleter, NestedCompleter
from distutils.version import StrictVersion
from packaging.version import Version
from CB import HEADERS, HEADLESS_TERMINAL_THEME, __version__
from CB.Core import Core
from CB.Compat import pause, timeout, clear, set_terminal_title, set_terminal_size, KBHit
Expand Down Expand Up @@ -230,7 +230,7 @@ def auto_update(self):
or (self.os == 'Linux' and '.gz' in binary['name']):
url = binary['browser_download_url']
break
if url and StrictVersion(remoteversion[1:]) > StrictVersion(__version__):
if url and Version(remoteversion[1:]) > Version(__version__):
self.console.print('[green]Updating CurseBreaker...[/green]')
shutil.move(sys.executable, sys.executable + '.old')
payload = requests.get(url, headers=HEADERS, timeout=5)
Expand Down Expand Up @@ -795,7 +795,8 @@ def c_wago_update(self, _, verbose=True, flush=True):
self.core.config['WAStash'] = []
self.core.save_config()
wago = WagoUpdater(self.core.config, self.core.masterConfig['ClientTypes'][self.core.clientType]['TOC'])
if self.core.masterConfig['CBCompanionVersion'] > self.core.config['CBCompanionVersion']:
if Version(__version__) >= Version(self.core.masterConfig['ConfigVersion']) and \
self.core.masterConfig['CBCompanionVersion'] > self.core.config['CBCompanionVersion']:
self.core.config['CBCompanionVersion'] = self.core.masterConfig['CBCompanionVersion']
self.core.save_config()
force = True
Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name = "pypi"
python-dateutil = "*"
prompt-toolkit = "*"
checksumdir = "*"
packaging = "*"
pyperclip = "*"
requests = "*"
bbcode = "*"
Expand Down
20 changes: 18 additions & 2 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
python-dateutil
prompt-toolkit
checksumdir
packaging
pyperclip
requests
markdown
Expand Down

0 comments on commit 2897680

Please sign in to comment.