qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 23/24] configure: prepare for auto-generated option parsing


From: Paolo Bonzini
Subject: Re: [PATCH 23/24] configure: prepare for auto-generated option parsing
Date: Fri, 8 Oct 2021 10:42:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0

On 07/10/21 18:53, Thomas Huth wrote:
+meson_options=
+meson_option_parse() {
+  meson_options="$meson_options $(_meson_option_parse "$@")"
+  if test $? -eq 1; then
+    echo "ERROR: unknown option $1"
+    echo "Try '$0 --help' for more information"
+    exit 1
+  fi
+}

Why the detour via this wrapper and $(_meson_option_parse) ? Couldn't you simply add the stuff directly to $meson_options in _meson_option_parse() ?

Mostly to keep the amount of shell-in-Python code as small as possible. Also, I liked that the generated shell code was completely independent of the configure script, did not use global variables and did not have to know that "meson_options" is tied to the way the "run_meson" shell function uses eval.

+options = load_options(json.load(sys.stdin))

Could you maybe print a header line first, à la:

# This file is generated by meson-buildoptions.py, do not edit!

Yes, of course.

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]