Add --typelib-path command line argument

Allows adding directories to search for typelib files.
This commit is contained in:
James Westman 2023-03-16 15:10:04 -05:00
parent 90001bd885
commit 8c3c43a34a
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
2 changed files with 18 additions and 1 deletions

View file

@ -32,9 +32,15 @@ from . import typelib, xml_reader
_namespace_cache: T.Dict[str, "Namespace"] = {}
_xml_cache = {}
_user_search_paths = []
def add_typelib_search_path(path: str):
_user_search_paths.append(path)
def get_namespace(namespace: str, version: str) -> "Namespace":
search_paths = GIRepository.Repository.get_search_path()
search_paths = [*GIRepository.Repository.get_search_path(), *_user_search_paths]
filename = f"{namespace}-{version}.typelib"