mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH 2/3] configure.ac: add check for python 2.x version
Date: Tue, 15 Apr 2014 10:38:42 +0200	[thread overview]
Message-ID: <20140415083840.GA14248@omega> (raw)
In-Reply-To: <20140415082314.GI5969@pengutronix.de>

On Tue, Apr 15, 2014 at 10:23:14AM +0200, Uwe Kleine-König wrote:
> On Tue, Apr 15, 2014 at 10:02:33AM +0200, Alexander Aring wrote:
> > Signed-off-by: Alexander Aring <alex.aring@gmail.com>
> > ---
> > We can also check for a python 1.x
> > 
> > I am not a python guru but being to be one. I never saw a python 1.x the last
> > eight years. I don't know if the current python ipkg scripts can deal with
> > python 1.x
> > 
> > There exists also a m4 script to check the MAJOR version of python but I see no
> > m4 directory in ptxdist. I used SED for this which is already checked. And YES
> > I don't know why but python sends the version string on stderr that's why I add
> > a redirection from stdout to stderr "2>&1" there.
> > 
> >  configure.ac | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index 2a97944..73027c8 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -304,6 +304,19 @@ AC_ARG_WITH(python, AS_HELP_STRING([--with-python],[name of the python executabl
> >  	AC_PATH_PROGS(PYTHON, python2.7 python2.6 python)
> >  	AC_SUBST(PYTHON)
> >      ])
> > +
> > +dnl
> > +dnl Check for python 2.x
> > +dnl
> > +AC_MSG_CHECKING([python version])
> > +PYTHON_VERSION=`$PYTHON --version 2>&1 | $SED -ne "1 s/Python \([[0-9]]\)/\1/p"`
> > +case "$PYTHON_VERSION" in
> > +3.*) AC_MSG_ERROR([we need at least python 2.x but found $PYTHON_VERSION]) ;;
> I'd say "Python 3.3.4" (that's what my python3 reports) qualifies as "at
> least python 2.x". So this message looks wrong.
> 
ok, yes. Copy&pasted from sed version check...

> Alternatively (i.e. I'm not sure if that approach is better):
> 
> 	$ python -c 'import sys; print(sys.version_info[0])'
> 	2
> 	$ python3 -c 'import sys; print(sys.version_info[0])'
> 	3
>

Oh, I tried this with:

python3 -c "import sys;print version_info.major"

which doesn't work on python3 now I know the syntax difference. Thanks!
Then check python version with python would be better.

> Also s/python/Python/gc ?
> 
ok.

Thanks.

- Alex

-- 
ptxdist mailing list
ptxdist@pengutronix.de

  reply	other threads:[~2014-04-15  8:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-15  8:02 [ptxdist] [PATCH 1/3] libusb: rename libusbx to libusb Alexander Aring
2014-04-15  8:02 ` [ptxdist] [PATCH 2/3] configure.ac: add check for python 2.x version Alexander Aring
2014-04-15  8:23   ` Uwe Kleine-König
2014-04-15  8:38     ` Alexander Aring [this message]
2014-04-15  8:02 ` [ptxdist] [PATCH 3/3] configure.ac: check for python2 binary as well Alexander Aring

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=20140415083840.GA14248@omega \
    --to=alex.aring@gmail.com \
    --cc=ptxdist@pengutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /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