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

Use case-preserving packageName_ROOT env variables in auto-generated modules #421

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/spack/spack/modules/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,9 +758,11 @@ def environment_modifications(self):
# Prepare a suitable transformation dictionary for the names
# of the environment variables. This means turn the valid
# tokens uppercase.
# DH 20240410 - reverting this to case-preserving, see
# https://github.com/spack/spack/issues/43569
transform = {}
for token in _valid_tokens:
transform[token] = lambda s, string: str.upper(string)
transform[token] = lambda s, string: string

for x in env:
# Ensure all the tokens are valid in this context
Expand Down
4 changes: 2 additions & 2 deletions lib/spack/spack/test/modules/tcl.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_alter_environment(self, modulefile_content, module_configuration):
assert len([x for x in content if "setenv OMPI_MCA_mpi_leave_pinned {1}" in x]) == 1
assert len([x for x in content if "setenv OMPI_MCA_MPI_LEAVE_PINNED {1}" in x]) == 0
assert len([x for x in content if "unsetenv BAR" in x]) == 1
assert len([x for x in content if "setenv MPILEAKS_ROOT" in x]) == 1
assert len([x for x in content if "setenv mpileaks_ROOT" in x]) == 1

content = modulefile_content("libdwarf platform=test target=core2")

Expand All @@ -128,7 +128,7 @@ def test_alter_environment(self, modulefile_content, module_configuration):
assert len([x for x in content if "unsetenv BAR" in x]) == 0
assert len([x for x in content if "depends-on foo/bar" in x]) == 1
assert len([x for x in content if "module load foo/bar" in x]) == 1
assert len([x for x in content if "setenv LIBDWARF_ROOT" in x]) == 1
assert len([x for x in content if "setenv libdwarf_ROOT" in x]) == 1

def test_prepend_path_separator(self, modulefile_content, module_configuration):
"""Tests that we can use custom delimiters to manipulate path lists."""
Expand Down