aboutsummaryrefslogtreecommitdiffstats
path: root/reaktor/commands
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-09-04 22:08:40 +0200
committermakefu <github@syntax-fehler.de>2015-09-04 22:08:40 +0200
commit4a275db4d38c8ab9ee4128103fd4829cbad53934 (patch)
tree15491eaf6bb2242fb33f21ea3bf0a666f39ad9f9 /reaktor/commands
parent7e84b09094578e03f194f661172c669bbc60edce (diff)
config: more logic in config file :(
Diffstat (limited to 'reaktor/commands')
-rwxr-xr-xreaktor/commands/version27
1 files changed, 27 insertions, 0 deletions
diff --git a/reaktor/commands/version b/reaktor/commands/version
new file mode 100755
index 0000000..ff3c48f
--- /dev/null
+++ b/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
+
+