From 896a485c0d997927a48825f7eec8c1eb35a0be38 Mon Sep 17 00:00:00 2001 From: Douglas Jacobsen Date: Thu, 10 Oct 2024 14:31:49 -0600 Subject: [PATCH] Remove new lines when defining path variables for spack 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. --- .../package_managers/spack-lightweight/package_manager.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/var/ramble/repos/builtin/package_managers/spack-lightweight/package_manager.py b/var/ramble/repos/builtin/package_managers/spack-lightweight/package_manager.py index e4e988deb..42e8b171a 100644 --- a/var/ramble/repos/builtin/package_managers/spack-lightweight/package_manager.py +++ b/var/ramble/repos/builtin/package_managers/spack-lightweight/package_manager.py @@ -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)