* [Qemu-devel] [PATCH] configure: eliminate Python dependency for --help
@ 2017-03-28 13:08 Stefan Hajnoczi
2017-03-28 13:30 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2017-03-28 13:08 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi
The ./configure script should produce --help output even if Python is
not installed.
Listing trace backends is simple: show the names of all Python modules
in scripts/tracetool/backend/ whose source code contains 'PUBLIC =
True'.
Perform the backend enumeration in shell instead of Python so that we
can move the Python check until after ./configure --help.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
configure | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/configure b/configure
index d1ce33b..52b6ab3 100755
--- a/configure
+++ b/configure
@@ -1186,21 +1186,6 @@ for opt do
esac
done
-if ! has $python; then
- error_exit "Python not found. Use --python=/path/to/python"
-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 < (2,6) or sys.version_info >= (3,))'; then
- error_exit "Cannot use '$python', Python 2.6 or later is required." \
- "Note that Python 3 or later is not yet supported." \
- "Use --python=/path/to/python to specify a supported Python."
-fi
-
-# Suppress writing compiled files
-python="$python -B"
-
case "$cpu" in
ppc)
CPU_CFLAGS="-m32"
@@ -1328,7 +1313,7 @@ Advanced options (experts only):
set block driver read-only whitelist
(affects only QEMU, not qemu-img)
--enable-trace-backends=B Set trace backend
- Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
+ Available backends: $(grep -le '^PUBLIC\s*=\s*True$' scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/' | xargs echo)
--with-trace-file=NAME Full PATH,NAME of file to store traces
Default:trace-<pid>
--disable-slirp disable SLIRP userspace network connectivity
@@ -1428,6 +1413,21 @@ EOF
exit 0
fi
+if ! has $python; then
+ error_exit "Python not found. Use --python=/path/to/python"
+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 < (2,6) or sys.version_info >= (3,))'; then
+ error_exit "Cannot use '$python', Python 2.6 or later is required." \
+ "Note that Python 3 or later is not yet supported." \
+ "Use --python=/path/to/python to specify a supported Python."
+fi
+
+# Suppress writing compiled files
+python="$python -B"
+
# Now we have handled --enable-tcg-interpreter and know we're not just
# printing the help message, bail out if the host CPU isn't supported.
if test "$ARCH" = "unknown"; then
--
2.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] configure: eliminate Python dependency for --help
2017-03-28 13:08 [Qemu-devel] [PATCH] configure: eliminate Python dependency for --help Stefan Hajnoczi
@ 2017-03-28 13:30 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2017-03-28 13:30 UTC (permalink / raw)
To: Stefan Hajnoczi; +Cc: QEMU Developers
On 28 March 2017 at 14:08, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> The ./configure script should produce --help output even if Python is
> not installed.
>
> Listing trace backends is simple: show the names of all Python modules
> in scripts/tracetool/backend/ whose source code contains 'PUBLIC =
> True'.
>
> Perform the backend enumeration in shell instead of Python so that we
> can move the Python check until after ./configure --help.
>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Thanks. I think we should postpone this to 2.10 since we've had
this behaviour since forever, but it's a useful start to getting
our --help text into a less confusing place in configure.
> @@ -1328,7 +1313,7 @@ Advanced options (experts only):
> set block driver read-only whitelist
> (affects only QEMU, not qemu-img)
> --enable-trace-backends=B Set trace backend
> - Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
> + Available backends: $(grep -le '^PUBLIC\s*=\s*True$' scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/' | xargs echo)
'\s' doesn't work with NetBSD grep (it isn't POSIX). I think you need
'^PUBLIC[[:space:]]*=[[:space:]]True'
(or just use ' ' since we don't have to contend with tabs here, as
you suggested on IRC).
I think we should also move the determining of the list of backends
out of the --help text itself, so set an avail_trace_backends
variable first and then just substitute the variable here.
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-28 13:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 13:08 [Qemu-devel] [PATCH] configure: eliminate Python dependency for --help Stefan Hajnoczi
2017-03-28 13:30 ` Peter Maydell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.