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