Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates based on use for my dotfiles repo #597

Merged
merged 21 commits into from
May 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a tool for configuring a new platform
  • Loading branch information
psakievich committed Feb 13, 2024
commit f883e7752986e9d309f44e4c440c3bc8c5bfc2d5
44 changes: 44 additions & 0 deletions scripts/platform_configure_tool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#! /usr/bin/env spack-python
import argparse
import os
import pathlib

import spack.main
import spack.util.spack_yaml as syaml

from spack.util.module_cmd import module

parser = argparse.ArgumentParser()
parser.add_argument("input", help="input file describing what to configure")
parser.add_argument("--output", help="location where the configs should get written")

args = parser.parse_args()

input_path = pathlib.PurePath(args.input)
output_path = pathlib.PurePath(args.output)

os.environ["SPACK_USER_CONFIG_PATH"] = str(output_path)
exe_env = os.environ.copy()

with open(input_path, "r") as f:
manifest = syaml.load(f)

compiler = spack.main.SpackCommand("compiler", subprocess=True)
external_cmd = spack.main.SpackCommand("external", subprocess=True)

if "compilers" in manifest:
for c in manifest["compilers"]:
module("load", c)
print(compiler("find", "--scope=user", env=exe_env))
module("unload", c)

if "externals" in manifest:
print(external_cmd("find", *manifest["externals"], env=exe_env))

if "modules" in manifest:
for entry in manifest["modules"]:
m = entry["module"]
p = entry["packages"]
module("load", m)
print(external_cmd("find", *p, env=exe_env))
module("unload", m)
Loading