Skip to content
Snippets Groups Projects
Commit a52381c6 authored by Ashwin Kumar Karnad's avatar Ashwin Kumar Karnad
Browse files

Merge branch 'drop-toolchain-flag' into 'main'

get rid of `--toolchain` flag

See merge request mpsd-cs/mpsd-software!61
parents 16cdf534 13f53b2c
No related branches found
No related tags found
1 merge request!61get rid of `--toolchain` flag
Pipeline #371416 passed
...@@ -26,13 +26,41 @@ else: ...@@ -26,13 +26,41 @@ else:
rich_available = True rich_available = True
about_tool = """ about_intro = f"""
Build toolchains using Spack.\n Build toolchains using Spack.\n
This function builds toolchains for MPSD-HPC at the appropriate directory, \n This function builds toolchains for MPSD-HPC at the appropriate directory,
for given system architecture and MPSD software stack version.\n for given system architecture and MPSD software stack version. The toolchains
The toolchains are built using the bash script spack_setup.sh, and the results are logged.
are built using the bash script spack_setup.sh, and the results are logged. """
Command line usage:
$> {sys.argv[0]}
"""
about_epilog = f"""
Examples:
1. Query what package sets and toolchains are available in relase dev-23a
$> {sys.argv[0]} available dev-23a
2. Install foss2022a-serial toolchain
$> {sys.argv[0]} install dev-23a foss2022a-serial
3. Check what package sets and toolchains are installed from release dev-23a
$> {sys.argv[0]} status dev-23a
Documentation: https://gitlab.gwdg.de/mpsd-cs/mpsd-software/-/blob/main/README.rst
"""
call_date_iso = ( call_date_iso = (
datetime.datetime.now().replace(microsecond=0).isoformat().replace(":", "-") datetime.datetime.now().replace(microsecond=0).isoformat().replace(":", "-")
...@@ -1032,7 +1060,11 @@ def environment_status(mpsd_release: str, root_dir: Union[str, Path]) -> dict: ...@@ -1032,7 +1060,11 @@ def environment_status(mpsd_release: str, root_dir: Union[str, Path]) -> dict:
def main(): def main():
"""Execute main entry point.""" """Execute main entry point."""
parser = argparse.ArgumentParser(description=about_tool) parser = argparse.ArgumentParser(
description=about_intro,
epilog=about_epilog,
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument( parser.add_argument(
"--log", "--log",
"-l", "-l",
...@@ -1086,20 +1118,14 @@ def main(): ...@@ -1086,20 +1118,14 @@ def main():
if cmd in ["install", "reinstall", "remove"]: if cmd in ["install", "reinstall", "remove"]:
# "install" command needs additional documentation # "install" command needs additional documentation
tool_chain_help = ( tool_chain_help = (
f"Pass a list of toolchains to command {cmd}. " f"One or more toolchains to command {cmd}. "
"Use '--toolchains ALL' to " "Use 'ALL' to refer to all available toolchains."
f"{cmd} all toolchains. If '--toolchain' is not "
"specified, list available toolchains for the release "
"(after environment has been prepared if not done yet)."
) )
subp.add_argument( subp.add_argument(
"--toolchains", # first option defines attribute "toolchain", # first option defines attribute
# name `args.toolchains` in `args = parser_args()` # name `args.toolchain` in `args = parser_args()`
"--toolchain", # allow singular as alternative
# (-> creates attribute `args.toolchains` if used)
type=str, type=str,
dest="toolchains",
nargs="+", nargs="+",
default="NONE", default="NONE",
help=tool_chain_help, help=tool_chain_help,
...@@ -1133,12 +1159,12 @@ def main(): ...@@ -1133,12 +1159,12 @@ def main():
# Check the command and run related function # Check the command and run related function
if args.action == "remove": if args.action == "remove":
remove_environment(args.release, args.toolchains, root_dir) remove_environment(args.release, args.toolchain, root_dir)
elif args.action == "start-new": elif args.action == "start-new":
start_new_environment(args.from_release, args.to_release, root_dir) start_new_environment(args.from_release, args.to_release, root_dir)
elif args.action == "install": elif args.action == "install":
install_environment( install_environment(
args.release, args.toolchains, root_dir, args.enable_build_cache args.release, args.toolchain, root_dir, args.enable_build_cache
) )
elif args.action == "status": elif args.action == "status":
_ = environment_status(args.release, root_dir) _ = environment_status(args.release, root_dir)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment