From 23ed6ecf4efc68f001f664d2231339074e08e84a Mon Sep 17 00:00:00 2001 From: Daniel Schiavini Date: Mon, 7 Oct 2024 16:01:39 +0200 Subject: [PATCH] fix: revert search path changes --- boa/interpret.py | 13 +++++++++++-- boa/util/disk_cache.py | 10 ---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/boa/interpret.py b/boa/interpret.py index 4374282b..0ff77392 100644 --- a/boa/interpret.py +++ b/boa/interpret.py @@ -33,13 +33,20 @@ from boa.rpc import json from boa.util import cached_vvm from boa.util.abi import Address -from boa.util.disk_cache import get_disk_cache, get_search_path +from boa.util.disk_cache import get_disk_cache if TYPE_CHECKING: from vyper.semantics.analysis.base import ImportInfo _Contract = Union[VyperContract, VyperBlueprint] +_search_path = None + + +def set_search_path(path: list[str]): + global _search_path + _search_path = path + class BoaImporter(MetaPathFinder): def find_spec(self, fullname, path, target=None): @@ -106,6 +113,8 @@ def get_module_fingerprint( def compiler_data( source_code: str, contract_name: str, filename: str | Path, deployer=None, **kwargs ) -> CompilerData: + global _search_path + path = Path(contract_name) resolved_path = Path(filename).resolve(strict=False) @@ -113,7 +122,7 @@ def compiler_data( contents=source_code, source_id=-1, path=path, resolved_path=resolved_path ) - search_paths = get_search_paths(get_search_path()) + search_paths = get_search_paths(_search_path) input_bundle = FilesystemInputBundle(search_paths) settings = Settings(**kwargs) diff --git a/boa/util/disk_cache.py b/boa/util/disk_cache.py index 9598ce5a..19160f00 100644 --- a/boa/util/disk_cache.py +++ b/boa/util/disk_cache.py @@ -83,16 +83,6 @@ def caching_lookup(self, string, func): _disk_cache = None -_search_path = None - - -def get_search_path() -> Optional[list[str]]: - return _search_path - - -def set_search_path(path: list[str]): - global _search_path - _search_path = path def get_disk_cache() -> Optional[DiskCache]: