qemu-devel
[Top][All Lists]
Advanced

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

[PATCH 09/11] qapi/gen: Support for switching to another module temporar


From: Markus Armbruster
Subject: [PATCH 09/11] qapi/gen: Support for switching to another module temporarily
Date: Fri, 18 Dec 2020 21:54:05 +0100

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 scripts/qapi/gen.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/qapi/gen.py b/scripts/qapi/gen.py
index d9f8bac9aa..cb00229f5d 100644
--- a/scripts/qapi/gen.py
+++ b/scripts/qapi/gen.py
@@ -15,6 +15,7 @@ from contextlib import contextmanager
 import os
 import re
 from typing import (
+    ContextManager,
     Dict,
     Iterator,
     List,
@@ -296,6 +297,13 @@ class QAPISchemaModularCVisitor(QAPISchemaVisitor):
         self._module[name] = (genc, genh)
         self._current_module = name
 
+    @contextmanager
+    def _temp_module(self, name: str) -> ContextManager[None]:
+        old_module = self._current_module
+        self._current_module = name
+        yield
+        self._current_module = old_module
+
     def write(self, output_dir: str, opt_builtins: bool = False) -> None:
         for name in self._module:
             if self._is_builtin_module(name) and not opt_builtins:
-- 
2.26.2




reply via email to

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