[oe-commits] [openembedded-core] 04/12: oe-init-buildenv/base: Relax python version checks in favour of HOSTTOOLS manipulation
git at git.openembedded.org
git at git.openembedded.org
Thu Nov 1 08:53:35 UTC 2018
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit c6bebc143194cc73b995e630edd853c9ebe17944
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Tue Oct 30 11:18:54 2018 +0000
oe-init-buildenv/base: Relax python version checks in favour of HOSTTOOLS manipulation
Several distros are now shipping "python" as python v3 contra to the original
python guidelines. This causes users confusion/pain in trying to use our tools.
We can just force "python" to "python2" within HOSTTOOLS to avoid this issue
and hide the complexity from the user.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/base.bbclass | 6 ++++++
meta/conf/bitbake.conf | 3 ++-
scripts/oe-buildenv-internal | 11 +----------
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index df11c8b..57b6949 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -128,6 +128,12 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
os.symlink(srctool, desttool)
else:
notfound.append(tool)
+ # Force "python" -> "python2"
+ desttool = os.path.join(dest, "python")
+ if not os.path.exists(desttool):
+ srctool = "python2"
+ os.symlink(srctool, desttool)
+
if notfound and fatal:
bb.fatal("The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:\n %s" % " ".join(notfound))
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 93aee1a..dcf2007 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -476,12 +476,13 @@ export PATH
HOSTTOOLS_DIR = "${TMPDIR}/hosttools"
# Tools needed to run builds with OE-Core
+# python is special cased to point at python2
HOSTTOOLS += " \
[ ar as awk basename bash bzip2 cat chgrp chmod chown chrpath cmp comm cp cpio \
cpp cut date dd diff diffstat dirname du echo egrep env expand expr false \
fgrep file find flock g++ gawk gcc getconf getopt git grep gunzip gzip \
head hostname id install ld ldd ln ls make makeinfo md5sum mkdir mknod \
- mktemp mv nm objcopy objdump od patch perl pod2man pr printf pwd python python2 \
+ mktemp mv nm objcopy objdump od patch perl pod2man pr printf pwd python2 \
python2.7 python3 ranlib readelf readlink rm rmdir rpcgen sed sh sha256sum \
sleep sort split stat strings strip tail tar tee test touch tr true uname \
uniq wc wget which xargs \
diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
index 6773872..52ce329 100755
--- a/scripts/oe-buildenv-internal
+++ b/scripts/oe-buildenv-internal
@@ -40,16 +40,7 @@ if [ -z "$OE_SKIP_SDK_CHECK" ] && [ -n "$OECORE_SDK_VERSION" ]; then
return 1
fi
-# 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_v2_check
-
-py_v27_check=$(python -c 'import sys; print sys.version_info >= (2,7,3)')
+py_v27_check=$(python2 -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."
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list