[OE-core] [PATCH] Fake python2 env if python3 is the one found in /env
Canabrava, Tomaz
tomaz.canabrava at intel.com
Fri Feb 27 19:11:48 UTC 2015
commit efb963f900951e0bfe2256331626f1715a582e11
Author: Tomaz Canabrava <tomaz.canabrava at intel.com>
Date: Tue Feb 24 11:30:46 2015 -0300
Add a call to python-virtualenv2 if the py3 is the default one
This patch adds a call to python-virtualenv to run python2 instead
of python3 ( wich used to give an error ) when python3 is the default
python executable, but python 2 is also installed on the system.
It works by faking the pythonpath for the current session only.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava at intel.com>
diff --git a/scripts/oe-buildenv-internal b/scripts/oe-buildenv-internal
index bba6f8f..5d2c58f 100755
--- a/scripts/oe-buildenv-internal
+++ b/scripts/oe-buildenv-internal
@@ -35,9 +35,10 @@ fi
# can offer a meaningful error message.
py_v3_check=`/usr/bin/env python --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"
- return 1
+ command -v virtualenv2 >/dev/null 2>&1 || { echo >&2 "The system python is v3, we need python-virtualenv2 to use the correct one, Aborting."; exit 1; }
+ py2_virtualenv_check=`virtualenv2 --version`
+ virtualenv2 venv
+ source venv/bin/activate
fi
More information about the Openembedded-core
mailing list