Commit 0cfb05ec authored by Eric Duminil's avatar Eric Duminil
Browse files

Use latest Simstadt version if multiple are available

parent d225e3ca
...@@ -38,17 +38,18 @@ log = logging.getLogger(__name__) ...@@ -38,17 +38,18 @@ log = logging.getLogger(__name__)
def find_simstadt(parent_folder: Path, simstadt_glob: str = SIMSTADT2_GLOB) -> Path: def find_simstadt(parent_folder: Path, simstadt_glob: str = SIMSTADT2_GLOB) -> Path:
try: simstadts = sorted(parent_folder.glob(simstadt_glob))
found = next(parent_folder.glob(simstadt_glob)) if len(simstadts) > 0:
found = simstadts[-1]
log.info("# SimStadt found in %s\n", found) log.info("# SimStadt found in %s\n", found)
return found return found
except StopIteration as e: else:
raise ValueError( raise ValueError(
f"SimStadt not found in {parent_folder}/{simstadt_glob}.\n" f"SimStadt not found in {parent_folder}/{simstadt_glob}.\n"
"Please Set the SIMSTADT_FOLDER environment variable, " "Please Set the SIMSTADT_FOLDER environment variable, "
"or install SimStadt on the Desktop.\n\n" "or install SimStadt on the Desktop.\n\n"
"See https://simstadt.hft-stuttgart.de/getting-started/install-software/" "See https://simstadt.hft-stuttgart.de/getting-started/install-software/"
) from e )
def get_simstadt_folder() -> Path: def get_simstadt_folder() -> Path:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment