On 29 October 2014 11:18, Martin Hundebøll <mar...@hundeboll.net> wrote: > As distributions start moving to python3, scripts should explicity > request python2 in the shebang. This patch changes all occurences of > #!/usr/bin/python and #!/usr/bin/env python > to > #!/usr/bin/env python2 >
<snip lots> > diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal > index bba6f8f..b514aa5 100755 > --- a/scripts/oe-buildenv-internal > +++ b/scripts/oe-buildenv-internal > @@ -33,7 +33,7 @@ fi > # 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"` > +py_v3_check=`/usr/bin/env python2 --version 2>&1 | grep "Python 3"` > if [ "$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" > @@ -43,7 +43,7 @@ fi > # 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)'` > +py_v26_check=`python2 -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" > return 1 This is the section of shell script which checks the python version when you run 'oe-init-build-env'. If you want to change the way python is ran I'd start by looking at this code. If this script could automatically try 'python2' if 'python' is found to be Python 3, and ensure the correct interpreter is used in all commands that run after the environment is setup that would be fantastic. It'd probably be a mess to implement though. The change as it currently stands looks confusing as py_v3_check is set by running python2. I used to use a virtualenv to temporarily set Python 2 as the default for the shell in which I ran bitbake commands. That was a while ago though, all my current builds are running on Ubuntu 12.04/14.04 server instances which I access via ssh from my Arch Linux box. Thanks, -- Paul Barker Email: p...@paulbarker.me.uk http://www.paulbarker.me.uk -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core