Skip to contentSkip to conversation

configure: Use -B switch only for Python versions which support it

PATCH Applied Stefan Weil 4 participants 9 messages Nov 14, 2013 – Nov 16, 2013

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Use -B switch only for Python versions which support it

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.

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

configure +8 -1
index 9a02610..3c25816 100755
@@ -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
Signature · 1 line
1.7.10.4
#1 lore raw

Am 14.11.2013 19:07, schrieb Stefan Weil:

Quoted 7 lines

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/

Reviewed-by on v1 1/1
#2 lore raw
In reply to Stefan Weil
Quoted 8 lines · 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.

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.

Quoted 9 lines
---
 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.

Quoted 17 lines
configure +1 -1
index 9a02610..3c25816 100755
@@ -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
 

configure if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_in · line 1432

Quoted 10 lines
configure +7 -0
+# 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

thanks
-- PMM

Reviewed-by on v1 1/1
#3 lore raw
In reply to Stefan Weil
Quoted 6 lines · 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.

Quoted 7 lines

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

---
 configure |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Thanks for the quick fix!

#4 lore raw
In reply to Stefan Weil
Quoted 8 lines · 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.

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

/mjt

#5 lore raw
Quoted 11 lines · Michael Tokarev
Quoted 8 lines · 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.

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

#7 lore raw
Quoted 8 lines · Michael Tokarev
Quoted 3 lines · Peter Maydell

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

#8 lore raw
In reply to Stefan Weil

This patch is wrong!

Am 14.11.2013 19:07, schrieb Stefan Weil:

Quoted 35 lines

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.

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

configure +1 -1
index 9a02610..3c25816 100755
@@ -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

configure if ! $python -c 'import sys; sys.exit(sys.version_info < (2,4) or sys.version_in · line 1427

Quoted 8 lines
configure +5 -0
@@ -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