From f73137e93a787c866b2132dfdb5a176aafe39370 Mon Sep 17 00:00:00 2001 From: hacker-DOM Date: Sat, 6 Nov 2021 16:38:23 +0100 Subject: [PATCH] extend path_list with solc-select directory and import_installed_solc in install_solc --- solcx/install.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/solcx/install.py b/solcx/install.py index e7be46e..845d8c8 100644 --- a/solcx/install.py +++ b/solcx/install.py @@ -130,6 +130,12 @@ def import_installed_solc(solcx_binary_path: Union[Path, str] = None) -> List[Ve path_list = [_get_which_solc()] except (FileNotFoundError, subprocess.CalledProcessError): path_list = [] + + # extend with solc-select directory + home_dir = os.path.expanduser("~") + solc_select_dir = f"{home_dir}/.solc-select" + solc_select_artifacts_dir = f"{solc_select_dir}/artifacts" + path_list.extend(Path(solc_select_artifacts_dir).glob("solc*")) # on OSX, also copy all versions of solc from cellar if _get_os_name() == "macosx": @@ -438,6 +444,9 @@ def install_solc( LOGGER.info(f"solc {version} already installed at: {path}") return version + if version in import_installed_solc(): + return version + data = requests.get(BINARY_DOWNLOAD_BASE.format(_get_os_name(), "list.json")) if data.status_code != 200: raise ConnectionError(