for different default python version
PATCH 1/1 for different default python version
most Linux distribution use python 2.x as the default as bitbake expected, but some use python 3.x as the default (like archlinux), so this patch come.
if the default python is 2.x, it will do nothing.
or it will search the python 2.x in /usr/bin and /bin. if find it out, then make a soft link in the build dir, and add the build dir into the env var PATH.
oe-init-build-env +5 -0
@@ -39,6 +39,34 @@ else $OEROOT/scripts/oe-setup-builddir 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,
except
+ # ubuntu), we should change bitbake's shebang to '/usr/bin/env
python2',
+ # 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
+ PYTHON2_BIN=""
+ 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
+ PYTHON2_BIN=$PY_BIN
+ break
+ fi
+ done
+ if [ -n "$PYTHON2_BIN" ]; then
+ ln -sf $PY_BIN $BUILDDIR/python + export PATH="$BUILDDIR:$PATH" + echo "NOTE: poky will use '$PY_BIN' to execute python code."
+ else
+ echo "ERROR: unable to find Python 2.x, BitBake requires
Python 2.6 or 2.7."
+ fi
+ unset PYTHON2_BIN
+ fi
+
[ -n "$BUILDDIR" ] && cd $BUILDDIR
fi
Signature · 4 lines
倪庆亮 TEL: 13588371863 E-MAIL: [email protected] BLOG: http://niqingliang2003.wordpress.com
NiQingliang,
A minor nit regarding the subject of this patch, there are some basic formatting that is used in oe-core, this information can be found at
http://wiki.openembedded.org/index.php/Commit_Patch_Message_Guidelines
Key thing is to include the name of the file (or functionality group) you are patching along with a good summary in the subject such as:
oe-init-build-env: Find and use python2 as default python
You also need to include a Signed-off-by: in your commit message.
I still need to test this further with a machine with and with out python2 / python3.
Also this did not apply cleanly, please rebase.
Thanks for your efforts on this patch.
Sau!
Quoted 33 lines · NiQingliang
most Linux distribution use python 2.x as the default as bitbake expected, but some use python 3.x as the default (like archlinux), so this patch come.
if the default python is 2.x, it will do nothing.
or it will search the python 2.x in/usr/binand /bin. if find it out, then make a soft link in the build dir, and add the build dir into the env var PATH.oe-init-build-env +5
-0@@ -39,6 +39,34 @@ else $OEROOT/scripts/oe-setup-builddir 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,except
+ # ubuntu), we should change bitbake's shebang to '/usr/bin/env
python2',oe-init-build-env +7
-0+ # 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 + PYTHON2_BIN="" + for PY_BIN in `find /{usr/,}bin -regex '.*/python\(\|2\|2\.[0-9]*\)'`; do
oe-init-build-env
Quoted 9 lines
oe-init-build-env +9
-0+ if [ -n "`$PY_BIN -V 2>&1|grep '^Python 2\.'`" ]; then + PYTHON2_BIN=$PY_BIN + break + fi + done + if [ -n "$PYTHON2_BIN" ]; then + ln -sf $PY_BIN $BUILDDIR/python + export PATH="$BUILDDIR:$PATH" + echo "NOTE: poky will use '$PY_BIN' to execute python code."
Probably should not mention poky here, should be bitbake or ...
Quoted 11 lines
oe-init-build-env +2
-0+ else + echo "ERROR: unable to find Python 2.x, BitBake requiresPython 2.6 or 2.7."
oe-init-build-env +4
-0+ fi + unset PYTHON2_BIN + fi + [ -n "$BUILDDIR" ]&& cd $BUILDDIR fi
PATCH 1/1 oe-init-build-env: Find and use python2 as default python
thanks your guide, I have read the link, but it looks like only show the rule with result without generating process. my mean is how to generate one patch.
setp 1 ... step 2 ... step3 ...
so after made other patch mail as reference, I got that (git diff -p --stat after a new clean clone) (and sorry for that if still mistake):
oe-init-build-env: Find and use python2 as default python
most Linux distribution use python 2.x as the default as bitbake expected, but some use python 3.x as the default (like archlinux).
if the default python is 2.x, it will do nothing. or it will search it in /usr/bin and /bin. if found, then make a soft link in the build dir, and add the build dir into the env var PATH.
--- oe-init-build-env | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)
oe-init-build-env +5 -0
@@ -39,6 +39,34 @@ else $OEROOT/scripts/oe-setup-builddir 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,
except
+ # ubuntu), we should change bitbake's shebang to '/usr/bin/env
python2',
+ # 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
+ PYTHON2_BIN=""
+ 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
+ PYTHON2_BIN=$PY_BIN
+ break
+ fi
+ done
+ if [ -n "$PYTHON2_BIN" ]; then
+ ln -sf $PY_BIN $BUILDDIR/python + export PATH="$BUILDDIR:$PATH" + echo "NOTE: BitBake will use '$PY_BIN' to execute python
code."
+ else
+ echo "ERROR: unable to find Python 2.x, BitBake requires
Python 2.6 or 2.7."
+ fi
+ unset PYTHON2_BIN
+ fi
+
[ -n "$BUILDDIR" ] && cd $BUILDDIR
fi
Quoted 1 line · Saul Wold
oe-init-build-env: Find and use python2 as default python
Signature · 4 lines
倪庆亮 TEL: 13588371863 E-MAIL: [email protected] BLOG: http://niqingliang2003.wordpress.com
Re: [patch]oe-init-build-env: Find and use python2 as default python
Quoted 4 lines · NiQingliang
thanks your guide, I have read the link, but it looks like only show the rule with result without generating process. my mean is how to generate one patch.
setp 1 ... step 2 ... step3 ...
Ni (sorry about getting your name wrong last time)
Everyone's work flow is different, I am not sure what your currently is, but using git format-patch and git send-email would be the best method to send a patch that can then be consumed by git am.
Please resend this as I still had trouble with the merge.
Thanks
Sau!
Quoted 64 lines
so after made other patch mail as reference, I got that (
git diff -p --statafter a new clean clone) (and sorry for that if still mistake):oe-init-build-env: Find and use python2 as default python
most Linux distribution use python 2.x as the default as bitbake expected, but some use python 3.x as the default (like archlinux).
if the default python is 2.x, it will do nothing. or it will search it in
/usr/binand /bin. if found, then make a soft link in the build dir, and add the build dir into the env var PATH.Signed-off-by Ni Qingliang<[email protected]>--- oe-init-build-env | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-)oe-init-build-env +5
-0@@ -39,6 +39,34 @@ else $OEROOT/scripts/oe-setup-builddir 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,except
+ # ubuntu), we should change bitbake's shebang to '/usr/bin/env
python2',oe-init-build-env +7
-0+ # 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 + PYTHON2_BIN="" + for PY_BIN in `find /{usr/,}bin -regex '.*/python\(\|2\|2\.[0-9]*\)'`; do
oe-init-build-env +9
-0+ if [ -n "`$PY_BIN -V 2>&1|grep '^Python 2\.'`" ]; then + PYTHON2_BIN=$PY_BIN + break + fi + done + if [ -n "$PYTHON2_BIN" ]; then + ln -sf $PY_BIN $BUILDDIR/python + export PATH="$BUILDDIR:$PATH" + echo "NOTE: BitBake will use '$PY_BIN' to execute pythoncode."
oe-init-build-env +2
-0+ else + echo "ERROR: unable to find Python 2.x, BitBake requiresPython 2.6 or 2.7."
oe-init-build-env +4
-0+ fi + unset PYTHON2_BIN + fi + [ -n "$BUILDDIR" ]&& cd $BUILDDIR fiQuoted 1 line · Saul Wold
oe-init-build-env: Find and use python2 as default python