diff mbox

[(1.7?)] configure: Use -B switch only for Python versions which support it

Message ID 1384452423-7831-1-git-send-email-sw@weilnetz.de
State Superseded
Headers show

Commit Message

Stefan Weil Nov. 14, 2013, 6:07 p.m. UTC
Commit 1d984a67a95d88f3e708b077dab8adeb47c38c93 added the -B switch
unconditionally. This breaks Python versions before 2.6 which don't
support that switch.

Now configure adds -B only if it is accepted by the Python interpreter.

This modification introduces a small incompatiblity because -B might now
also be added when configure was called with --python=PYTHON_INTERPRETER.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 configure |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

This is an optional patch. We need it for Python versions older than 5 years
if we don't want to use the workaround --python=python.

I don't think it is needed for 1.7, but maybe other people think different.

Stefan

Comments

Stefan Weil Nov. 14, 2013, 6:13 p.m. UTC | #1
Am 14.11.2013 19:07, schrieb Stefan Weil:
> Commit 1d984a67a95d88f3e708b077dab8adeb47c38c93 added the -B switch
> unconditionally. This breaks Python versions before 2.6 which don't
> support that switch.
>
> Now configure adds -B only if it is accepted by the Python interpreter.
>
> This modification introduces a small incompatiblity because -B might now

s/incompatiblity/incompatibility/
Peter Maydell Nov. 14, 2013, 6:17 p.m. UTC | #2
On 14 November 2013 18:07, Stefan Weil <sw@weilnetz.de> wrote:
> Commit 1d984a67a95d88f3e708b077dab8adeb47c38c93 added the -B switch
> unconditionally. This breaks Python versions before 2.6 which don't
> support that switch.
>
> Now configure adds -B only if it is accepted by the Python interpreter.
>
> This modification introduces a small incompatiblity because -B might now
> also be added when configure was called with --python=PYTHON_INTERPRETER.

That sounds like it's fixing a bug to me. If we think -B
is right then we should be using it whether we defaulted
to 'python' or the user passed us /usr/local/bin/python2
or whatever.

> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  configure |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> This is an optional patch. We need it for Python versions older than 5 years
> if we don't want to use the workaround --python=python.
>
> I don't think it is needed for 1.7, but maybe other people think different.

I think that as long as our requirements list says
python 2.4 is the minimum then bugs that mean we don't work
on that are fair game for fixing during hardfreeze; and
this is a pretty simple and safe fix. I think it's better
to put it into the release than deal with people after
release trying to run it on RHEL-whatever that doesn't
have a newer python.

> diff --git a/configure b/configure
> index 9a02610..3c25816 100755
> --- a/configure
> +++ b/configure
> @@ -593,7 +593,7 @@ fi
>
>  : ${make=${MAKE-make}}
>  : ${install=${INSTALL-install}}
> -: ${python=${PYTHON-python -B}}
> +: ${python=${PYTHON-python}}
>  : ${smbd=${SMBD-/usr/sbin/smbd}}
>
>  # Default objcc to clang if available, otherwise use CC
> @@ -1420,6 +1420,13 @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_in
>        "Use --python=/path/to/python to specify a supported Python."
>  fi
>
> +# The -B switch was added in Python 2.6.
> +# If it is supplied, compiled files are not written.
> +# Use it for Python versions which support it.
> +if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
> +  $python="$python -B"
> +fi
> +
>  if test -z "${target_list+xxx}" ; then
>      target_list="$default_target_list"
>  else

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
Stefan Hajnoczi Nov. 15, 2013, 9:19 a.m. UTC | #3
On Thu, Nov 14, 2013 at 07:07:03PM +0100, Stefan Weil wrote:
> Commit 1d984a67a95d88f3e708b077dab8adeb47c38c93 added the -B switch
> unconditionally. This breaks Python versions before 2.6 which don't
> support that switch.
> 
> Now configure adds -B only if it is accepted by the Python interpreter.
> 
> This modification introduces a small incompatiblity because -B might now
> also be added when configure was called with --python=PYTHON_INTERPRETER.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  configure |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Thanks for the quick fix!

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Michael Tokarev Nov. 16, 2013, 10:07 a.m. UTC | #4
14.11.2013 22:07, Stefan Weil wrote:
> Commit 1d984a67a95d88f3e708b077dab8adeb47c38c93 added the -B switch
> unconditionally. This breaks Python versions before 2.6 which don't
> support that switch.
> 
> Now configure adds -B only if it is accepted by the Python interpreter.
> 
> This modification introduces a small incompatiblity because -B might now
> also be added when configure was called with --python=PYTHON_INTERPRETER.

Thanks, applied to the trivial-patches queue, with the spelling fix in comment.

/mjt
Peter Maydell Nov. 16, 2013, 11:10 a.m. UTC | #5
On 16 November 2013 10:07, Michael Tokarev <mjt@tls.msk.ru> wrote:
> 14.11.2013 22:07, Stefan Weil wrote:
>> Commit 1d984a67a95d88f3e708b077dab8adeb47c38c93 added the -B switch
>> unconditionally. This breaks Python versions before 2.6 which don't
>> support that switch.
>>
>> Now configure adds -B only if it is accepted by the Python interpreter.
>>
>> This modification introduces a small incompatiblity because -B might now
>> also be added when configure was called with --python=PYTHON_INTERPRETER.
>
> Thanks, applied to the trivial-patches queue, with the spelling fix in comment.

Just a question since we were discussing this on IRC -- are you going
to remove the non-buildfix/bugfix patches from the trivial queue so
the buildfixes go into 1.7?

thanks
-- PMM
Michael Tokarev Nov. 16, 2013, 11:45 a.m. UTC | #6
16.11.2013 15:10, Peter Maydell wrote:

> Just a question since we were discussing this on IRC -- are you going
> to remove the non-buildfix/bugfix patches from the trivial queue so
> the buildfixes go into 1.7?

Yes, please see http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/trivial-patches ,
since 1.7.0-rc0.  I can remove a few more patches from there, but I don't see why.

/mjt
Peter Maydell Nov. 16, 2013, 11:49 a.m. UTC | #7
On 16 November 2013 11:45, Michael Tokarev <mjt@tls.msk.ru> wrote:
> 16.11.2013 15:10, Peter Maydell wrote:
>
>> Just a question since we were discussing this on IRC -- are you going
>> to remove the non-buildfix/bugfix patches from the trivial queue so
>> the buildfixes go into 1.7?
>
> Yes, please see http://git.corpit.ru/?p=qemu.git;a=shortlog;h=refs/heads/trivial-patches ,
> since 1.7.0-rc0.  I can remove a few more patches from there, but I don't see why.

Yep, that looks OK to me (obviously it's Anthony's call though).

thanks
-- PMM
Stefan Weil Nov. 16, 2013, 1:14 p.m. UTC | #8
This patch is wrong!

Am 14.11.2013 19:07, schrieb Stefan Weil:
> Commit 1d984a67a95d88f3e708b077dab8adeb47c38c93 added the -B switch
> unconditionally. This breaks Python versions before 2.6 which don't
> support that switch.
>
> Now configure adds -B only if it is accepted by the Python interpreter.
>
> This modification introduces a small incompatiblity because -B might now
> also be added when configure was called with --python=PYTHON_INTERPRETER.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  configure |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> This is an optional patch. We need it for Python versions older than 5 years
> if we don't want to use the workaround --python=python.
>
> I don't think it is needed for 1.7, but maybe other people think different.
>
> Stefan
>
> diff --git a/configure b/configure
> index 9a02610..3c25816 100755
> --- a/configure
> +++ b/configure
> @@ -593,7 +593,7 @@ fi
>  
>  : ${make=${MAKE-make}}
>  : ${install=${INSTALL-install}}
> -: ${python=${PYTHON-python -B}}
> +: ${python=${PYTHON-python}}
>  : ${smbd=${SMBD-/usr/sbin/smbd}}
>  
>  # Default objcc to clang if available, otherwise use CC
> @@ -1420,6 +1420,13 @@ if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_in
>        "Use --python=/path/to/python to specify a supported Python."
>  fi
>  
> +# The -B switch was added in Python 2.6.
> +# If it is supplied, compiled files are not written.
> +# Use it for Python versions which support it.
> +if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
> +  $python="$python -B"

It should be

python="$python -B"

I'll send a v2.

Stefan
diff mbox

Patch

diff --git a/configure b/configure
index 9a02610..3c25816 100755
--- a/configure
+++ b/configure
@@ -593,7 +593,7 @@  fi
 
 : ${make=${MAKE-make}}
 : ${install=${INSTALL-install}}
-: ${python=${PYTHON-python -B}}
+: ${python=${PYTHON-python}}
 : ${smbd=${SMBD-/usr/sbin/smbd}}
 
 # Default objcc to clang if available, otherwise use CC
@@ -1420,6 +1420,13 @@  if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_in
       "Use --python=/path/to/python to specify a supported Python."
 fi
 
+# The -B switch was added in Python 2.6.
+# If it is supplied, compiled files are not written.
+# Use it for Python versions which support it.
+if $python -B -c 'import sys; sys.exit(0)' 2>/dev/null; then
+  $python="$python -B"
+fi
+
 if test -z "${target_list+xxx}" ; then
     target_list="$default_target_list"
 else