mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-05 16:09:07 -04:00
Merge branch 'fix-72' into 'main'
port: Show error when Gtk typelib is missing Closes #72 See merge request jwestman/blueprint-compiler!54
This commit is contained in:
commit
e128b49069
4 changed files with 38 additions and 28 deletions
|
@ -25,7 +25,7 @@ import gi # type: ignore
|
|||
gi.require_version("GIRepository", "2.0")
|
||||
from gi.repository import GIRepository # type: ignore
|
||||
|
||||
from .errors import CompileError, CompilerBugError
|
||||
from .errors import CompileError, CompilerBugError, GtkTypelibMissingError
|
||||
from . import typelib, xml_reader
|
||||
|
||||
_namespace_cache = {}
|
||||
|
@ -49,10 +49,15 @@ def get_namespace(namespace, version):
|
|||
break
|
||||
|
||||
if filename not in _namespace_cache:
|
||||
raise CompileError(
|
||||
f"Namespace {namespace}-{version} could not be found",
|
||||
hints=["search path: " + os.pathsep.join(search_paths)],
|
||||
)
|
||||
hints = ["search path: " + os.pathsep.join(search_paths)]
|
||||
|
||||
if namespace == "Gtk":
|
||||
raise GtkTypelibMissingError(hints=hints)
|
||||
else:
|
||||
raise CompileError(
|
||||
f"Namespace {namespace}-{version} could not be found",
|
||||
hints=hints,
|
||||
)
|
||||
|
||||
return _namespace_cache[filename]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue