Skip to content

Commit

Permalink
Remove new lines when defining path variables for spack
Browse files Browse the repository at this point in the history
This commit fixes an issue where spack names are returned with newlines
(which are then left in path variable name definitions) causing path
variables to not function properly when actually using spack.

These problems do not show up in dry-runs.
  • Loading branch information
douglasjacobsen committed Oct 10, 2024
1 parent 3e76338 commit 896a485
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1128,11 +1128,17 @@ def get_package_path(self, package_spec):
name_match = name_regex.match(name)
if name_match:
name = name_match.group("name")
else:
# Remove newlines and whitespace from name
name = name.replace("\n", "").strip()

if location is None:
location = os.path.join(
"dry-run", "path", "to", shlex.split(package_spec)[0]
)
else:
# Remove newlines and whitespace from location
location = location.replace("\n", "").strip()

return (name, location)

Expand Down

0 comments on commit 896a485

Please sign in to comment.