port: Show error when Gtk typelib is missing

Fixes #72 by showing a proper error message rather than crashing.
This commit is contained in:
James Westman 2022-07-09 14:27:24 -05:00
parent 012fc61926
commit 0a1c9da2ec
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
4 changed files with 38 additions and 28 deletions

View file

@ -40,17 +40,7 @@ class GtkDirective(AstNode):
err.hint("Expected 'using Gtk 4.0;'")
raise err
try:
gir.get_namespace("Gtk", version)
except CompileError as e:
raise CompileError(
"Could not find GTK 4 introspection files. Is gobject-introspection installed?",
fatal=True,
# preserve the hints from the original error, because it contains
# useful debugging information
hints=e.hints,
)
gir.get_namespace("Gtk", version)
@property
def gir_namespace(self):