From 284e77bfe5d4a68f021a311041cc4576b7be912a Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 28 Jun 2018 19:05:27 +0200 Subject: Make Flake (somewhat) happy --- reaktor/commands/version | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'reaktor/commands/version') diff --git a/reaktor/commands/version b/reaktor/commands/version index ff3c48f..d9c4c5d 100755 --- a/reaktor/commands/version +++ b/reaktor/commands/version @@ -1,21 +1,25 @@ #!/usr/bin/env python -url="https://pypi.python.org/pypi/Reaktor/json" -import requests import reaktor +import requests + +url = "https://pypi.python.org/pypi/Reaktor/json" + cur_version = reaktor.__version__ ret = requests.get(url).json() latest_version = ret["info"]["version"] + def vt(v): return tuple(map(int, (v.split(".")))) + try: rel = ret["releases"][cur_version][0]["upload_time"] -except: +except Exception: rel = "unknown release date" -print("{} - {}".format(cur_version,rel)) +print("{} - {}".format(cur_version, rel)) if vt(latest_version) > vt(cur_version): print(" newer release available: {}".format(latest_version)) elif vt(latest_version) < vt(cur_version): @@ -23,5 +27,3 @@ elif vt(latest_version) < vt(cur_version): else: # on the most current release pass - - -- cgit v1.2.3