[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/4] configure: check for supported Python 2.x v
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 4/4] configure: check for supported Python 2.x versions |
Date: |
Mon, 30 Apr 2012 11:19:31 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Apr 27, 2012 at 08:13:31PM +0200, Lluís Vilanova wrote:
> Stefan Hajnoczi writes:
>
> > The tracetool code requires Python 2.4, which was released in 2004.
> > Check for a supported Python version so we can give a clear error
> > message.
>
> > Signed-off-by: Stefan Hajnoczi <address@hidden>
> > ---
> > configure | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
>
> > diff --git a/configure b/configure
> > index 15bbc73..39c7ac2 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1247,9 +1247,10 @@ fi
>
> > # Note that if the Python conditional here evaluates True we will exit
> > # with status 1 which is a shell 'false' value.
> > -if ! "$python" -c 'import sys; sys.exit(sys.version_info[0] >= 3)'; then
> > - echo "Python 2 required but '$python' is version 3 or better."
> > - echo "Use --python=/path/to/python to specify a Python 2."
> > +if ! "$python" -c 'import sys; sys.exit(sys.version_info[0] != 2 or
> > sys.version_info[1] < 4)'; then
> > + echo "Cannot use '$python', Python 2.4 or later is required."
> > + echo "Note that Python 3 or later is not yet supported."
> > + echo "Use --python=/path/to/python to specify a supported Python."
> > exit 1
> > fi
>
> This looks more readable to me:
>
> sys.exit(sys.version_info < (2,4) or sys.version_info >= (3,))
Nice, thanks.
Stefan
- [Qemu-devel] [PATCH 0/4] tracetool: Python 2.4 compatibility fixes, Stefan Hajnoczi, 2012/04/27
- [Qemu-devel] [PATCH 2/4] tracetool: use Python 2.4-compatible __import__() arguments, Stefan Hajnoczi, 2012/04/27
- [Qemu-devel] [PATCH 3/4] tracetool: avoid str.rpartition() Python 2.5 function, Stefan Hajnoczi, 2012/04/27
- [Qemu-devel] [PATCH 4/4] configure: check for supported Python 2.x versions, Stefan Hajnoczi, 2012/04/27
- [Qemu-devel] [PATCH 1/4] tracetool: use Python 2.4-compatible exception handling syntax, Stefan Hajnoczi, 2012/04/27
- Re: [Qemu-devel] [PATCH 0/4] tracetool: Python 2.4 compatibility fixes, Andreas Färber, 2012/04/28
- Re: [Qemu-devel] [PATCH 0/4] tracetool: Python 2.4 compatibility fixes, Erik Rull, 2012/04/29