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 <[email protected]>
> > ---
> > 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
[email protected]

Reply via email to