Re: Supporting upcoming distribution releases

Joshua Lock <josh@...>

On Thu, 2011-07-14 at 09:34 +0800, NiQingliang wrote:
new version

diff --git a/oe-init-build-env b/oe-init-build-env
index 77332a7..0fe1b5e 100755
--- a/oe-init-build-env
+++ b/oe-init-build-env
@@ -39,6 +39,35 @@ else
unset OEROOT
unset BBPATH
+ # find the python 2.x, if the default python is not.
+ # NOTE:
+ # the 'python -V' need redirect to stdout
+ # once we can ensure every distribution has 'python2' (currently,
+ # ubuntu), we should change bitbake's shebang to '/usr/bin/env
+ # and remove this patch.
+ # precondition:
+ # $BUILDDIR is not NULL, but I doubt when it will be NULL.
+ # user have not made the file $BUILDDIR/python by himself.
+ if [ -z "`/usr/bin/env python -V 2>&1|grep '^Python 2\.'`" ]; then
+ echo "WARNING: your default python is not 2.x, so autodetect..."
I'm not sure we need to print this.

+ for PY_BIN in `find /{usr/,}bin -regex '.*/python\(\|2\|2\.[0-9]*
\)'`; do
+ if [ -n "`$PY_BIN -V 2>&1|grep '^Python 2\.'`" ]; then
+ break
+ fi
+ done
+ if [ -n "$PYTHON2_BIN" ]; then
+ ln -sf $PY_BIN $BUILDDIR/python
+ echo "WARNING: poky will use '$PY_BIN' to execute python
I can live without this message but if we do leave it in we should
probably call it a NOTE rather than WARNING.

+ else
+ echo "ERROR: poky can't find python 2.x."
Perhaps make this a little more informative?

ERROR: unable to find Python 2.x, BitBake requires Python 2.6 or 2.7.

+ fi
+ unset PYTHON2_BIN
+ fi
[ -n "$BUILDDIR" ] && cd $BUILDDIR
I can verify that this works as expected (i.e. does nothing) on my
Fedora 15 machine with Python 2.7.1.

Could you submit the patch to the openembedded-core mailing list so that
it can be considered for inclusion in the Yocto project's shared

Joshua Lock
Yocto Project "Johannes factotum"
Intel Open Source Technology Centre

Join { to automatically receive all group messages.