diff options
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 - - |