From: NiQingliang <niqingliang@insigma.com.cn>
To: Darren Hart <dvhart@linux.intel.com>
Cc: "yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: Re: Supporting upcoming distribution releases
Date: Thu, 14 Jul 2011 09:34:31 +0800 [thread overview]
Message-ID: <1310607271.946.1.camel@localhost.localdomain> (raw)
In-Reply-To: <4E1DCF73.3030101@linux.intel.com>
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
$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
+ echo "WARNING: your default python is not 2.x, so autodetect..."
+ 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 "WARNING: poky will use '$PY_BIN' to execute python
code."
+ else
+ echo "ERROR: poky can't find python 2.x."
+ fi
+ unset PYTHON2_BIN
+ fi
+
[ -n "$BUILDDIR" ] && cd $BUILDDIR
fi
On Thu, 2011-07-14 at 01:01 +0800, Darren Hart wrote:
>
> On 07/13/2011 01:04 AM, NiQingliang wrote:
> > first sorry about that, indeed I don't know how to commit a patch, so
> > just paste the diff result here.
> >
> > diff --git a/oe-init-build-env b/oe-init-build-env
> > index 77332a7..0da8bc0 100755
> > --- a/oe-init-build-env
> > +++ b/oe-init-build-env
> > @@ -39,6 +39,20 @@ else
> > $OEROOT/scripts/oe-setup-builddir
> > unset OEROOT
> > unset BBPATH
> > +
>
> Before searching manually, we should attempt to use whatever is set in
> the environment.
>
> --
> Darren
>
> > + # find the python version 2.x
> > + # the 'python -V' need redirect to stdout
> > + # precondition:
> > + # $BUILDDIR is not NULL, but I doubt when it will be NULL.
> > + # user have not made the file $BUILDDIR/python by himself.
> > + 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
> > + ln -sf $PY_BIN $BUILDDIR/python
> > + export PATH="$BUILDDIR:$PATH"
> > + break
> > + fi
> > + done
> > +
> > [ -n "$BUILDDIR" ] && cd $BUILDDIR
> > fi
> >
> >
> > On Wed, 2011-07-13 at 10:31 +0800, Joshua Lock wrote:
> >> On Wed, 2011-07-13 at 10:19 +0800, NiQingliang wrote:
> >>> /usr/bin/env python2
> >>> /usr/bin/env python2.7
> >>
> >> These are both valid on Fedora 15, iirc before distributions started
> >> shipping Python 3 they were less common though...
> >>
> >>> both of them are ok for archlinux, but I don't know which is ok for
> >>> other distributions, maybe both are not.
> >>>
> >>> maybe we can make a shell script to detect the python version, and make
> >>> a symbollink to the right one in some directory, and add the directory
> >>> into env var "PATH".
> >>
> >> Patches welcome :-)
> >>
> >> I looked at it briefly and the work would require more time than I have
> >> spare right now just to ensure it worked on all required distributions.
> >>
> >> If you'd like to work on a patch I'd be happy to help test and review.
> >>
> >> Cheers,
> >> Joshua
> >> --
> >> Joshua Lock
> >> Yocto Project "Johannes factotum"
> >> Intel Open Source Technology Centre
> >>
> >
>
> --
> Darren Hart
> Intel Open Source Technology Center
> Yocto Project - Linux Kernel
--
倪庆亮
TEL: 13588371863
E-MAIL: niqingliang@insigma.com.cn
BLOG: http://niqingliang2003.wordpress.com
next prev parent reply other threads:[~2011-07-14 1:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-12 18:51 Supporting upcoming distribution releases Joshua Lock
2011-07-12 19:01 ` Darren Hart
2011-07-12 19:26 ` Joshua Lock
2011-07-12 20:59 ` Darren Hart
2011-07-12 21:08 ` Richard Purdie
2011-07-13 1:15 ` NiQingliang
2011-07-13 2:08 ` Joshua Lock
2011-07-13 2:19 ` NiQingliang
2011-07-13 2:31 ` Joshua Lock
2011-07-13 2:50 ` NiQingliang
2011-07-13 8:04 ` NiQingliang
2011-07-13 17:01 ` Darren Hart
2011-07-14 0:56 ` NiQingliang
2011-07-14 1:34 ` NiQingliang [this message]
2011-07-20 1:13 ` Joshua Lock
2011-07-20 2:31 ` NiQingliang
2011-07-20 2:48 ` NiQingliang
2011-07-13 6:03 ` Xu, Jiajun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310607271.946.1.camel@localhost.localdomain \
--to=niqingliang@insigma.com.cn \
--cc=dvhart@linux.intel.com \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.