Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Saul Wold <sgw@linux.intel.com>
To: Patches and discussions about the oe-core layer
	<openembedded-core@lists.openembedded.org>
Subject: Re: [patch]for different default python version
Date: Wed, 20 Jul 2011 14:28:10 -0700	[thread overview]
Message-ID: <4E27486A.7090401@linux.intel.com> (raw)
In-Reply-To: <1311141365.6973.7.camel@localhost.localdomain>


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!


On 07/19/2011 10:56 PM, NiQingliang wrote:
> 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.
>
> diff --git a/oe-init-build-env b/oe-init-build-env
> index 77332a7..acf4e96 100755
> --- a/oe-init-build-env
> +++ b/oe-init-build-env
> @@ -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."
Probably should not mention poky here, should be bitbake or ...

> +      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
>
>



  reply	other threads:[~2011-07-20 21:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20  5:56 [patch]for different default python version NiQingliang
2011-07-20 21:28 ` Saul Wold [this message]
2011-07-21  6:26   ` [patch]oe-init-build-env: Find and use python2 as default python NiQingliang
2011-07-22 15:53     ` Saul Wold

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=4E27486A.7090401@linux.intel.com \
    --to=sgw@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox