Alon Bar-Lev has uploaded a new change for review.

Change subject: core: check minimum python version
......................................................................

core: check minimum python version

Change-Id: If63068befd1a28e2bbc187ab77b0835ab18db36d
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M src/bin/otopi
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/09/9609/1

diff --git a/src/bin/otopi b/src/bin/otopi
index 5e90317..9e949fc 100755
--- a/src/bin/otopi
+++ b/src/bin/otopi
@@ -71,5 +71,15 @@
 OTOPI_PYTHON="${OTOPI_PYTHON:-$(find_util python)}"
 [ -z "${OTOPI_PYTHON}" ] && die "Python is required but missing"
 
+pythonver() {
+       local v="$1"
+       echo "$(($v/1000)).$(($v%1000))"
+}
+PYTHON_VERSION_MIN="2006"
+PYTHON_VERSION="$("${OTOPI_PYTHON}" -c "import sys; 
print(sys.version_info[0]*1000 + sys.version_info[1])")" || \
+       die "Cannot query python version"
+[ "${PYTHON_VERSION}" -ge "${PYTHON_VERSION_MIN}" ] || \
+       die "Python version $(pythonver ${PYTHON_VERSION}) is too old, 
expecting at least $(pythonver ${PYTHON_VERSION_MIN})"
+
 # TODO remove '.__main__' when python-2.6 gone
 exec "${OTOPI_PYTHON}" -m otopi.__main__ "${extraenv} $*"


--
To view, visit http://gerrit.ovirt.org/9609
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If63068befd1a28e2bbc187ab77b0835ab18db36d
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to