From 14b531247309d56ea347c5c261505be978a0c575 Mon Sep 17 00:00:00 2001 From: Hans Fangohr <hans.fangohr@mpsd.mpg.de> Date: Fri, 9 Jun 2023 15:38:13 +0200 Subject: [PATCH] check if release directory does not exist at all. --- mpsd-software-environment.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mpsd-software-environment.py b/mpsd-software-environment.py index 3444888..e9de0b8 100755 --- a/mpsd-software-environment.py +++ b/mpsd-software-environment.py @@ -853,13 +853,22 @@ def environment_status(mpsd_release: str, root_dir: Union[str, Path]) -> dict: toolchain_dir = release_base_dir / microarch spack_dir = toolchain_dir / "spack" + # if the mpsd_release does not exist: + if not release_base_dir.exists(): + logging.debug(f"Directory {str(release_base_dir)} does not exist.") + logging.error(f"MPSD release '{mpsd_release}' is not installed.") + return None + + # if the mpds_release directory exists but the spack repository is not fully + # cloned - indicates some kind of incomplete installation: if not spack_dir.exists(): logging.debug(f"Looking for files in {spack_dir}") logging.error( - f"Release {mpsd_release} has not been completely installed yet" - ", or is missing." + f"MPSD release '{mpsd_release}' has not been completely installed." ) + return None + # find all folders for all microarch in the release directory # except for the blacklisted files black_listed_files = [ @@ -870,8 +879,9 @@ def environment_status(mpsd_release: str, root_dir: Union[str, Path]) -> dict: ] list_of_microarchs_candidates = os.listdir(release_base_dir) - list_of_microarchs = [x for x in list_of_microarchs_candidates if x not in - black_listed_files] + list_of_microarchs = [ + x for x in list_of_microarchs_candidates if x not in black_listed_files + ] logging.debug(f"{list_of_microarchs=}") toolchain_map = {} -- GitLab