mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
gir: use GLib to get gir base paths
This commit is contained in:
parent
ca4ef1db88
commit
9429ac5f41
1 changed files with 8 additions and 5 deletions
|
@ -25,7 +25,8 @@ from functools import cached_property
|
||||||
import gi # type: ignore
|
import gi # type: ignore
|
||||||
|
|
||||||
gi.require_version("GIRepository", "2.0")
|
gi.require_version("GIRepository", "2.0")
|
||||||
from gi.repository import GIRepository # type: ignore
|
gi.require_version("GLib", "2.0")
|
||||||
|
from gi.repository import GIRepository, GLib # type: ignore
|
||||||
|
|
||||||
from . import typelib, xml_reader
|
from . import typelib, xml_reader
|
||||||
from .errors import CompileError, CompilerBugError
|
from .errors import CompileError, CompilerBugError
|
||||||
|
@ -64,11 +65,13 @@ def collect_gir_search_paths():
|
||||||
if _gir_search_paths_initalized:
|
if _gir_search_paths_initalized:
|
||||||
return
|
return
|
||||||
|
|
||||||
global _gir_search_paths
|
base_paths = [
|
||||||
if data_paths := os.environ.get("XDG_DATA_DIRS"):
|
GLib.get_user_data_dir(),
|
||||||
_gir_search_paths += [
|
*GLib.get_system_data_dirs(),
|
||||||
os.path.join(path, "gir-1.0") for path in data_paths.split(os.pathsep)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
global _gir_search_paths
|
||||||
|
_gir_search_paths = [os.path.join(path, "gir-1.0") for path in base_paths]
|
||||||
_gir_search_paths_initalized = True
|
_gir_search_paths_initalized = True
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue