Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update version checker #525

Merged
merged 2 commits into from
Oct 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 17 additions & 9 deletions src/cryptoadvance/specter/util/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def start(self):
self.thread.start()

def stop(self):
logger.info("version checker stopped.")
self.running = False

@property
Expand Down Expand Up @@ -82,6 +83,9 @@ def get_pip_version(self):
latest = "unknown"

current = importlib_metadata.version("cryptoadvance.specter")
# check if it's installed from master
if current == "vx.y.z-get-replaced-by-release-script":
current = "custom"

return current, latest

Expand Down Expand Up @@ -109,13 +113,17 @@ def get_version_info(self):
logger.error(exc)

# check that both current and latest versions match the pattern
if re.search(r"v?([\d+]).([\d+]).([\d+]).*", current) and re.search(
r"v?([\d+]).([\d+]).([\d+]).*", latest
):
return (
current,
latest,
# check without leading v so v1.2.3 = 1.2.3
latest.replace("v", "") != current.replace("v", ""),
)
# vA.B.C or just A.B.C
# For vA.B.C-preX or something like that we don't show notification
if re.search(r"v?([\d+]).([\d+]).([\d+])$", current):
if re.search(r"v?([\d+]).([\d+]).([\d+])$", latest):
return (
current,
latest,
# check without leading v so v1.2.3 = 1.2.3
latest.replace("v", "") != current.replace("v", ""),
)
# if current version is not A.B.C - stop periodic checks
else:
self.stop()
return current, latest, False