qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 01/18] scripts: clean up meson-buildoptions.py
Date: Tue, 28 Oct 2025 18:34:13 +0100	[thread overview]
Message-ID: <20251028173430.2180057-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20251028173430.2180057-1-pbonzini@redhat.com>

Fix a few issues reported by flake8 and pylint, mostly parameter names
that shadow globals.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/meson-buildoptions.py | 51 +++++++++++++++++++----------------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index a3e22471b2f..e636d258e8a 100644
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -111,13 +111,13 @@ def help_line(left, opt, indent, long):
     right = f'{opt["description"]}'
     if long:
         value = get_help(opt)
-        if value != "auto" and value != "":
+        if value not in {"", "auto"}:
             right += f" [{value}]"
     if "choices" in opt and long:
         choices = "/".join(sorted(opt["choices"]))
         right += f" (choices: {choices})"
-    for x in wrap("  " + left, right, indent):
-        sh_print(x)
+    for line in wrap("  " + left, right, indent):
+        sh_print(line)
 
 
 # Return whether the option (a dictionary) can be used with
@@ -144,18 +144,18 @@ def require_arg(opt):
     return not ({"enabled", "disabled"}.intersection(opt["choices"]))
 
 
-def filter_options(json):
-    if ":" in json["name"]:
+def filter_options(opt):
+    if ":" in opt["name"]:
         return False
-    if json["section"] == "user":
-        return json["name"] not in SKIP_OPTIONS
+    if opt["section"] == "user":
+        return opt["name"] not in SKIP_OPTIONS
     else:
-        return json["name"] in BUILTIN_OPTIONS
+        return opt["name"] in BUILTIN_OPTIONS
 
 
-def load_options(json):
-    json = [x for x in json if filter_options(x)]
-    return sorted(json, key=lambda x: x["name"])
+def load_options(opts):
+    opts = [opt for opt in opts if filter_options(opt)]
+    return sorted(opts, key=lambda opt: opt["name"])
 
 
 def cli_option(opt):
@@ -223,7 +223,7 @@ def print_parse(options):
         key = cli_option(opt)
         name = opt["name"]
         if require_arg(opt):
-            if opt["type"] == "array" and not "choices" in opt:
+            if opt["type"] == "array" and "choices" not in opt:
                 print(f'    --{key}=*) quote_sh "-D{name}=$(meson_option_build_array $2)" ;;')
             else:
                 print(f'    --{key}=*) quote_sh "-D{name}=$2" ;;')
@@ -241,14 +241,19 @@ def print_parse(options):
     print("  esac")
     print("}")
 
-json_data = sys.stdin.read()
-try:
-    options = load_options(json.loads(json_data))
-except:
-    print("Failure in scripts/meson-buildoptions.py parsing stdin as json",
-          file=sys.stderr)
-    print(json_data, file=sys.stderr)
-    sys.exit(1)
-print("# This file is generated by meson-buildoptions.py, do not edit!")
-print_help(options)
-print_parse(options)
+
+def main():
+    json_data = sys.stdin.read()
+    try:
+        options = load_options(json.loads(json_data))
+    except:
+        print("Failure in scripts/meson-buildoptions.py parsing stdin as json",
+              file=sys.stderr)
+        print(json_data, file=sys.stderr)
+        sys.exit(1)
+    print("# This file is generated by meson-buildoptions.py, do not edit!")
+    print_help(options)
+    print_parse(options)
+
+
+sys.exit(main())
-- 
2.51.1



  reply	other threads:[~2025-10-28 17:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-28 17:34 [PULL 00/18] Miscellaneous changes for 2025-10-28 Paolo Bonzini
2025-10-28 17:34 ` Paolo Bonzini [this message]
2025-10-28 17:34 ` [PULL 02/18] i386/kvm/cpu: Init SMM cpu address space for hotplugged CPUs Paolo Bonzini
2025-10-29  7:01   ` Zhao Liu
2025-10-30  2:19     ` Xiaoyao Li
2025-10-30  7:36   ` Michael Tokarev
2025-10-30  7:49     ` Xiaoyao Li
2025-10-30  8:03       ` Michael Tokarev
2025-10-28 17:34 ` [PULL 03/18] rcu: Unify force quiescent state Paolo Bonzini
2025-11-03 13:59   ` Regression with the "replay" test on target alpha (was: [PULL 03/18] rcu: Unify force quiescent state) Thomas Huth
2025-11-04  1:45     ` Regression with the "replay" test on target alpha Akihiko Odaki
2025-11-04  7:41       ` Thomas Huth
2025-11-04  8:08         ` Akihiko Odaki
2025-11-04  8:38           ` Thomas Huth
2025-11-04 12:18             ` Paolo Bonzini
2025-11-05  6:29               ` Akihiko Odaki
2025-11-07  7:41                 ` Thomas Huth
2025-11-07  7:49                   ` Paolo Bonzini
2025-10-28 17:34 ` [PULL 04/18] rust: remove useless glib_sys bindings Paolo Bonzini
2025-10-28 17:34 ` [PULL 05/18] rust: only leave leaf crates as workspace members Paolo Bonzini
2025-10-28 17:34 ` [PULL 06/18] qobject: make refcount atomic Paolo Bonzini
2025-10-28 17:34 ` [PULL 07/18] char: rename CharBackend->CharFrontend Paolo Bonzini
2025-10-28 17:34 ` [PULL 08/18] accel/mshv: initialize thread name Paolo Bonzini
2025-10-28 17:34 ` [PULL 09/18] accel/mshv: use return value of handle_pio_str_read Paolo Bonzini
2025-10-28 17:34 ` [PULL 10/18] esp.c: fix esp_cdb_ready() FIFO wraparound limit calculation Paolo Bonzini
2025-10-29 11:42   ` Michael Tokarev
2025-10-28 17:34 ` [PULL 11/18] qtest/am53c974-test: add additional test for cmdfifo overflow Paolo Bonzini
2025-10-28 17:34 ` [PULL 12/18] rust/qemu-macros: Convert bit value to u8 within #[property] Paolo Bonzini
2025-10-28 17:34 ` [PULL 13/18] scsi: make SCSIRequest refcount atomic Paolo Bonzini
2025-10-28 17:34 ` [PULL 14/18] qdev: Change PropertyInfo method print() to return malloc'ed string Paolo Bonzini
2025-10-28 17:34 ` [PULL 15/18] hw/i386/isapc.c: warn rather than reject modern x86 CPU models Paolo Bonzini
2025-10-28 17:34 ` [PULL 16/18] docs/about/deprecated.rst: document isapc deprecation for " Paolo Bonzini
2025-10-28 17:34 ` [PULL 17/18] target/i386: clear CPU_INTERRUPT_SIPI for all accelerators Paolo Bonzini
2025-10-28 17:34 ` [PULL 18/18] rust: migration: allow passing ParentField<> to vmstate_of! Paolo Bonzini
2025-10-29  6:34   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251028173430.2180057-2-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).