[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
- [PATCH 00/11] Drop support for QAPIGen without a file name, Markus Armbruster, 2020/12/18
- [PATCH 01/11] qapi/commands: assert arg_type is not None, Markus Armbruster, 2020/12/18
- [PATCH 04/11] qapi/gen: assert that _start_if is not None in _wrap_ifcond, Markus Armbruster, 2020/12/18
- [PATCH 03/11] qapi/main: handle theoretical None-return from re.match(), Markus Armbruster, 2020/12/18
- [PATCH 07/11] qapi/gen: Replace ._begin_system_module(), Markus Armbruster, 2020/12/18
- [PATCH 06/11] qapi/gen: write _genc/_genh access shims, Markus Armbruster, 2020/12/18
- [PATCH 11/11] qapi/gen: Drop support for QAPIGen without a file name, Markus Armbruster, 2020/12/18
- [PATCH 02/11] qapi/events: fix visit_event typing, Markus Armbruster, 2020/12/18
- [PATCH 08/11] qapi/gen: Expose a single module name space, Markus Armbruster, 2020/12/18
- [PATCH 09/11] qapi/gen: Support for switching to another module temporarily,
Markus Armbruster <=
- [PATCH 05/11] qapi/gen: use './builtin' for the built-in module name, Markus Armbruster, 2020/12/18
- [PATCH 10/11] qapi/commands: Simplify command registry generation, Markus Armbruster, 2020/12/18