Message ID | 20250311034303.75779-3-jsnow@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | docs: Add new QAPI transmogrifier | expand |
John Snow <jsnow@redhat.com> writes: > Shhhhh! > > This patch can be dropped from the PR and I'll clean it up later. It's > just here to help me establish a linting baseline. It isn't really > needed for the series itself. > > Signed-off-by: John Snow <jsnow@redhat.com> Okay, I'll drop this patch. Note that I just posted "[PATCH] scripts/qapi/backend: Clean up create_backend()'s failure mode", and ... > --- > scripts/qapi/backend.py | 2 ++ > scripts/qapi/main.py | 8 +++----- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/scripts/qapi/backend.py b/scripts/qapi/backend.py > index 14e60aa67af..49ae6ecdd33 100644 > --- a/scripts/qapi/backend.py > +++ b/scripts/qapi/backend.py > @@ -13,6 +13,7 @@ > > > class QAPIBackend(ABC): > + # pylint: disable=too-few-public-methods > > @abstractmethod > def generate(self, > @@ -36,6 +37,7 @@ def generate(self, > > > class QAPICBackend(QAPIBackend): > + # pylint: disable=too-few-public-methods > > def generate(self, > schema: QAPISchema, ... when you rebase on top of my patch, the hunk above stays, and the hunk below goes. > diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py > index 5b4679abcf1..01155373bd0 100644 > --- a/scripts/qapi/main.py > +++ b/scripts/qapi/main.py > @@ -38,8 +38,7 @@ def create_backend(path: str) -> QAPIBackend: > try: > mod = import_module(module_path) > except Exception as ex: > - print(f"unable to import '{module_path}': {ex}", file=sys.stderr) > - sys.exit(1) > + raise QAPIError(f"unable to import '{module_path}': {ex}") from ex > > try: > klass = getattr(mod, class_name) > @@ -51,9 +50,8 @@ def create_backend(path: str) -> QAPIBackend: > try: > backend = klass() > except Exception as ex: > - print(f"backend '{path}' cannot be instantiated: {ex}", > - file=sys.stderr) > - sys.exit(1) > + raise QAPIError( > + f"backend '{path}' cannot be instantiated: {ex}") from ex > > if not isinstance(backend, QAPIBackend): > print(f"backend '{path}' must be an instance of QAPIBackend",
diff --git a/scripts/qapi/backend.py b/scripts/qapi/backend.py index 14e60aa67af..49ae6ecdd33 100644 --- a/scripts/qapi/backend.py +++ b/scripts/qapi/backend.py @@ -13,6 +13,7 @@ class QAPIBackend(ABC): + # pylint: disable=too-few-public-methods @abstractmethod def generate(self, @@ -36,6 +37,7 @@ def generate(self, class QAPICBackend(QAPIBackend): + # pylint: disable=too-few-public-methods def generate(self, schema: QAPISchema, diff --git a/scripts/qapi/main.py b/scripts/qapi/main.py index 5b4679abcf1..01155373bd0 100644 --- a/scripts/qapi/main.py +++ b/scripts/qapi/main.py @@ -38,8 +38,7 @@ def create_backend(path: str) -> QAPIBackend: try: mod = import_module(module_path) except Exception as ex: - print(f"unable to import '{module_path}': {ex}", file=sys.stderr) - sys.exit(1) + raise QAPIError(f"unable to import '{module_path}': {ex}") from ex try: klass = getattr(mod, class_name) @@ -51,9 +50,8 @@ def create_backend(path: str) -> QAPIBackend: try: backend = klass() except Exception as ex: - print(f"backend '{path}' cannot be instantiated: {ex}", - file=sys.stderr) - sys.exit(1) + raise QAPIError( + f"backend '{path}' cannot be instantiated: {ex}") from ex if not isinstance(backend, QAPIBackend): print(f"backend '{path}' must be an instance of QAPIBackend",
Shhhhh! This patch can be dropped from the PR and I'll clean it up later. It's just here to help me establish a linting baseline. It isn't really needed for the series itself. Signed-off-by: John Snow <jsnow@redhat.com> --- scripts/qapi/backend.py | 2 ++ scripts/qapi/main.py | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-)