diff options
author | makefu <github@syntax-fehler.de> | 2015-09-04 22:08:40 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2015-09-04 22:08:40 +0200 |
commit | 7b36e711d2b58ddd360ebe25ecbc2265c5ce76bb (patch) | |
tree | c0b44a9e69811873d530ebe2e355ba3e9653bbcb /Reaktor/reaktor/commands/version | |
parent | e9e7d6baf986488c43d418887f6cf95f5d896189 (diff) |
config: more logic in config file :(
Diffstat (limited to 'Reaktor/reaktor/commands/version')
-rwxr-xr-x | Reaktor/reaktor/commands/version | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Reaktor/reaktor/commands/version b/Reaktor/reaktor/commands/version new file mode 100755 index 00000000..ff3c48fe --- /dev/null +++ b/Reaktor/reaktor/commands/version @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +url="https://pypi.python.org/pypi/Reaktor/json" +import requests +import reaktor +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: + rel = "unknown release date" +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): + print(" ahead of official release: {}".format(latest_version)) +else: + # on the most current release + pass + + |