diff options
author | lassulus <lassulus@lassul.us> | 2018-06-28 19:05:27 +0200 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2018-06-28 19:05:27 +0200 |
commit | 284e77bfe5d4a68f021a311041cc4576b7be912a (patch) | |
tree | 6bd0761e82f664d27128a299ca48f5c3f14088c7 /reaktor/commands/version | |
parent | 139a1116c35f57888853ebb3ff585e28921780ff (diff) |
Make Flake (somewhat) happy
Diffstat (limited to 'reaktor/commands/version')
-rwxr-xr-x | reaktor/commands/version | 14 |
1 files changed, 8 insertions, 6 deletions
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 - - |