Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
14 changes: 10 additions & 4 deletions stackinator/etc/envvars.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,19 @@ def view_impl(args):

with open(args.compilers, "r") as file:
data = yaml.safe_load(file)
compilers = [c["compiler"] for c in data["compilers"]]

compilers = []
for p in data["packages"].values():
for e in p["externals"]:
c = e["extra_attributes"]["compilers"]
if c is not None:
compilers.append(c)

compiler_paths = []
for c in compilers:
local_paths = set([os.path.dirname(v) for _, v in c["paths"].items() if v is not None])
local_paths = set([os.path.dirname(v) for _, v in c.items() if v is not None])
compiler_paths += local_paths
print(f'adding compiler {c["spec"]} -> {[p for p in local_paths]}')
print(f'adding compiler {c} -> {[p for p in local_paths]}')

envvars.set_list("PATH", compiler_paths, EnvVarOp.PREPEND)

Expand Down Expand Up @@ -577,7 +583,7 @@ def meta_impl(args):
"--prefix_paths", help="a list of relative prefix path searchs of the form X=y:z,Y=p:q", default="", type=str
)
# only add compilers if this argument is passed
view_parser.add_argument("--compilers", help="path of the compilers.yaml file", type=str, default=None)
view_parser.add_argument("--compilers", help="path of the packages.yaml file", type=str, default=None)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --compilers name makes a bit less sense now that we look in packages.yaml, but I wasn't able to think of a better name yet. It is still used to find compilers, so it's not completely off... but suggestions for better names welcome.


uenv_parser = subparsers.add_parser(
"uenv",
Expand Down
2 changes: 1 addition & 1 deletion stackinator/templates/Makefile.environments
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ all:{% for env in environments %} {{ env }}/generated/build_cache{% endfor %}
{{ env }}/generated/view_config: {{ env }}/generated/env
{% if config.view %}
$(SPACK) env activate --with-view default --sh ./{{ env }} > $(STORE)/env/{{ config.view.name }}/activate.sh
$(BUILD_ROOT)/envvars.py view {% if config.view.extra.add_compilers %}--compilers=./{{ env }}/compilers.yaml {% endif %} --prefix_paths="{{ config.view.extra.prefix_string }}" $(STORE)/env/{{ config.view.name }} $(BUILD_ROOT)
$(BUILD_ROOT)/envvars.py view {% if config.view.extra.add_compilers %}--compilers=./{{ env }}/packages.yaml {% endif %} --prefix_paths="{{ config.view.extra.prefix_string }}" $(STORE)/env/{{ config.view.name }} $(BUILD_ROOT)
{% endif %}
touch $@

Expand Down