]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-buildenv-internal: Update to python3
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 1 Jun 2016 12:17:23 +0000 (13:17 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 1 Jun 2016 14:05:27 +0000 (15:05 +0100)
Check that 'python' is a python v2 since that is what we assume everywhere
and upstream python devs recommend. We can need both python2 and python3
available since we don't control the software we might download and run.

Also check that python 3 is >= 3.4.0, our minimum version for bitbake.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/oe-buildenv-internal

index 81ee784d314300f89be7bb7bcb92b1e176f06fa1..56d341983e78ba9ffe44ad8517319eeeace051eb 100755 (executable)
@@ -29,27 +29,31 @@ if [ -z "$OE_SKIP_SDK_CHECK" ] && [ -n "$OECORE_SDK_VERSION" ]; then
     return 1
 fi
 
-# Make sure we're not using python v3.x. This check can't go into
-# sanity.bbclass because bitbake's source code doesn't even pass
-# parsing stage when used with python v3, so we catch it here so we
-# can offer a meaningful error message.
-py_v3_check=$(/usr/bin/env python --version 2>&1 | grep "Python 3")
-if [ -n "$py_v3_check" ]; then
-    echo >&2 "Bitbake is not compatible with python v3"
-    echo >&2 "Please set up python v2 as your default python interpreter"
+# Make sure we're not using python v3.x as 'python', we don't support it.
+py_v2_check=$(/usr/bin/env python --version 2>&1 | grep "Python 3")
+if [ -n "$py_v2_check" ]; then
+    echo >&2 "OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3."
+    echo >&2 "Please set up python v2 as your default 'python' interpreter."
     return 1
 fi
-unset py_v3_check
-
-# Similarly, we now have code that doesn't parse correctly with older
-# versions of Python, and rather than fixing that and being eternally
-# vigilant for any other new feature use, just check the version here.
-py_v26_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)')
-if [ "$py_v26_check" != "True" ]; then
-    echo >&2 "BitBake requires Python 2.7.3 or later"
+unset py_v2_check
+
+py_v27_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)')
+if [ "$py_v27_check" != "True" ]; then
+    echo >&2 "OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3."
+    echo >&2 "Please upgrade your python v2."
+fi
+unset py_v27_check
+
+# We potentially have code that doesn't parse correctly with older versions 
+# of Python, and rather than fixing that and being eternally vigilant for 
+# any other new feature use, just check the version here.
+py_v34_check=$(python3 -c 'import sys; print(sys.version_info >= (3,4,0))')
+if [ "$py_v34_check" != "True" ]; then
+    echo >&2 "BitBake requires Python 3.4.0 or later as 'python3'"
     return 1
 fi
-unset py_v26_check
+unset py_v34_check
 
 if [ -z "$BDIR" ]; then
     if [ -z "$1" ]; then