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

add outlines of all functions

parent 7d04c38a
Branches
No related tags found
2 merge requests!19Move linux-debian11 into main,!1Resolve "First draft for user interface for top level install command"
...@@ -3,6 +3,7 @@ import os ...@@ -3,6 +3,7 @@ import os
import subprocess import subprocess
import time import time
import argparse import argparse
import sys
about_tool=""" about_tool="""
Build toolchains using Spack. Build toolchains using Spack.
...@@ -104,10 +105,31 @@ def build_toolchains( ...@@ -104,10 +105,31 @@ def build_toolchains(
# copy the octopus configs to the toolchain directory # copy the octopus configs to the toolchain directory
# subprocess.run(f"cp -r {current_dir}/octopus # subprocess.run(f"cp -r {current_dir}/octopus
def prepare_env(release, target_dir, skip_dir_check):
if target_dir == "DEFAULT":
target_dir = f"/opt_mpsd/{os.environ['MPSD_OS']}/{release}/{os.environ['MPSD_MICROARCH']}"
if not os.path.exists(target_dir):
os.makedirs(target_dir)
else:
if not skip_dir_check:
raise ValueError(
f"Error: Target directory {target_dir} already exists. \n\
Please remove it and try again."
)
with os.chdir(target_dir):
subprocess.run("git clone https://gitlab.gwdg.de/mpsd-cs/spack-environments.git")
subprocess.run(f"git checkout {release}")
def install_toolchains(release, install, target_dir, force_reinstall, skip_build_cache, skip_dir_check):
prepare_env(release, target_dir, skip_dir_check)
def start_new_env(set_up,from_release):
pass
def remove_toolchain(release, remove):
pass
def main(): def main():
parser = argparse.ArgumentParser(description=about_tool) parser = argparse.ArgumentParser(description=about_tool)
parser.add_argument('--release', type=str, required=True, parser.add_argument('--release', type=str,
help='Specify the release version to install') help='Specify the release version to install')
parser.add_argument('--target-directory', type=str, parser.add_argument('--target-directory', type=str,
help='Specify the target directory for installation (use DEFAULT to use /opt_mpsd/<MPSD_OS>/<MPSD_RELEASE>/<MPSD_MICROARCH)') help='Specify the target directory for installation (use DEFAULT to use /opt_mpsd/<MPSD_OS>/<MPSD_RELEASE>/<MPSD_MICROARCH)')
...@@ -128,6 +150,10 @@ def main(): ...@@ -128,6 +150,10 @@ def main():
args = parser.parse_args() args = parser.parse_args()
if args.release is None:
parser.print_help()
sys.exit(1)
if args.remove: if args.remove:
remove_toolchain(args.release, args.remove) remove_toolchain(args.release, args.remove)
elif args.set_up: elif args.set_up:
...@@ -139,7 +165,8 @@ def main(): ...@@ -139,7 +165,8 @@ def main():
install_toolchains(args.release, args.install, target_dir, args.force_reinstall, install_toolchains(args.release, args.install, target_dir, args.force_reinstall,
args.skip_build_cache, args.skip_dir_check) args.skip_build_cache, args.skip_dir_check)
else: else:
prepare_env(args.release, target_dir) prepare_env(args.skip_dir_check, args.release, target_dir)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment