diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-01 13:17:23 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 08:24:00 +0100 |
commit | c77e7b86aa732e9acfa6409108756be38a3ca3ae (patch) | |
tree | bd108c5c307348d4a3cab93f21157b6e06d40284 /scripts/oe-buildenv-internal | |
parent | 3c42280b8a5cac184311a59589849fec4e215a14 (diff) | |
download | poky-c77e7b86aa732e9acfa6409108756be38a3ca3ae.tar.gz |
oe-buildenv-internal: Update to python3
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.
(From OE-Core rev: 3dd26cd6b3d731f7698f6fbcd1947969f360cdc4)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/oe-buildenv-internal')
-rwxr-xr-x | scripts/oe-buildenv-internal | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal index 81ee784d31..56d341983e 100755 --- a/scripts/oe-buildenv-internal +++ b/scripts/oe-buildenv-internal | |||
@@ -29,27 +29,31 @@ if [ -z "$OE_SKIP_SDK_CHECK" ] && [ -n "$OECORE_SDK_VERSION" ]; then | |||
29 | return 1 | 29 | return 1 |
30 | fi | 30 | fi |
31 | 31 | ||
32 | # Make sure we're not using python v3.x. This check can't go into | 32 | # Make sure we're not using python v3.x as 'python', we don't support it. |
33 | # sanity.bbclass because bitbake's source code doesn't even pass | 33 | py_v2_check=$(/usr/bin/env python --version 2>&1 | grep "Python 3") |
34 | # parsing stage when used with python v3, so we catch it here so we | 34 | if [ -n "$py_v2_check" ]; then |
35 | # can offer a meaningful error message. | 35 | echo >&2 "OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3." |
36 | py_v3_check=$(/usr/bin/env python --version 2>&1 | grep "Python 3") | 36 | echo >&2 "Please set up python v2 as your default 'python' interpreter." |
37 | if [ -n "$py_v3_check" ]; then | ||
38 | echo >&2 "Bitbake is not compatible with python v3" | ||
39 | echo >&2 "Please set up python v2 as your default python interpreter" | ||
40 | return 1 | 37 | return 1 |
41 | fi | 38 | fi |
42 | unset py_v3_check | 39 | unset py_v2_check |
43 | 40 | ||
44 | # Similarly, we now have code that doesn't parse correctly with older | 41 | py_v27_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)') |
45 | # versions of Python, and rather than fixing that and being eternally | 42 | if [ "$py_v27_check" != "True" ]; then |
46 | # vigilant for any other new feature use, just check the version here. | 43 | echo >&2 "OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3." |
47 | py_v26_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)') | 44 | echo >&2 "Please upgrade your python v2." |
48 | if [ "$py_v26_check" != "True" ]; then | 45 | fi |
49 | echo >&2 "BitBake requires Python 2.7.3 or later" | 46 | unset py_v27_check |
47 | |||
48 | # We potentially have code that doesn't parse correctly with older versions | ||
49 | # of Python, and rather than fixing that and being eternally vigilant for | ||
50 | # any other new feature use, just check the version here. | ||
51 | py_v34_check=$(python3 -c 'import sys; print(sys.version_info >= (3,4,0))') | ||
52 | if [ "$py_v34_check" != "True" ]; then | ||
53 | echo >&2 "BitBake requires Python 3.4.0 or later as 'python3'" | ||
50 | return 1 | 54 | return 1 |
51 | fi | 55 | fi |
52 | unset py_v26_check | 56 | unset py_v34_check |
53 | 57 | ||
54 | if [ -z "$BDIR" ]; then | 58 | if [ -z "$BDIR" ]; then |
55 | if [ -z "$1" ]; then | 59 | if [ -z "$1" ]; then |