From f2d4643bf52b9aa6f6d6d8d66f8828f696d8e993 Mon Sep 17 00:00:00 2001 From: Peter Eisenmann Date: Fri, 29 Mar 2024 01:31:05 +0100 Subject: [PATCH] gir: batch-add user typelib search paths --- blueprintcompiler/gir.py | 5 +++-- blueprintcompiler/main.py | 8 +++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/blueprintcompiler/gir.py b/blueprintcompiler/gir.py index 142bbd2..a33bb26 100644 --- a/blueprintcompiler/gir.py +++ b/blueprintcompiler/gir.py @@ -37,8 +37,9 @@ _xml_cache = {} _user_search_paths = [] -def add_typelib_search_path(path: str): - _user_search_paths.append(path) +def add_user_typelib_paths(paths: list): + global _user_search_paths + _user_search_paths += paths def get_namespace(namespace: str, version: str) -> "Namespace": diff --git a/blueprintcompiler/main.py b/blueprintcompiler/main.py index 5b4cad8..aef3ad1 100644 --- a/blueprintcompiler/main.py +++ b/blueprintcompiler/main.py @@ -26,7 +26,7 @@ import typing as T from . import formatter, interactive_port, parser, tokenizer from .errors import CompileError, CompilerBugError, PrintableError, report_bug -from .gir import add_typelib_search_path +from .gir import add_user_typelib_paths from .lsp import LanguageServer from .outputs import XmlOutput from .utils import Colors @@ -135,8 +135,7 @@ class BlueprintApp: def cmd_compile(self, opts): if opts.typelib_path != None: - for typelib_path in opts.typelib_path: - add_typelib_search_path(typelib_path) + add_user_typelib_paths(opts.typelib_path) data = opts.input.read() try: @@ -156,8 +155,7 @@ class BlueprintApp: def cmd_batch_compile(self, opts): if opts.typelib_path != None: - for typelib_path in opts.typelib_path: - add_typelib_search_path(typelib_path) + add_user_typelib_paths(opts.typelib_path) for file in opts.inputs: data = file.read()