diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2023-04-04 09:45:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-04 09:45:43 +0200 |
commit | e9a1d0a1576264a56de430213530f26e71b9b4af (patch) | |
tree | 19fd0a836fbf9ceccfda6d183dfb5fc484c45822 | |
parent | 5560017ebe1baa61fccc345d950e0e35e2db4750 (diff) | |
download | spack-e9a1d0a1576264a56de430213530f26e71b9b4af.tar.gz spack-e9a1d0a1576264a56de430213530f26e71b9b4af.tar.bz2 spack-e9a1d0a1576264a56de430213530f26e71b9b4af.tar.xz spack-e9a1d0a1576264a56de430213530f26e71b9b4af.zip |
filter __spack_path_placeholder__ in generated module files after buildcache install (#36611)
* filter __spack_path_placeholder__ in generated module files after buildcache install
* fix windows
-rw-r--r-- | lib/spack/spack/modules/common.py | 2 | ||||
-rw-r--r-- | lib/spack/spack/util/path.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py index 66fe145f35..b5e084bc0c 100644 --- a/lib/spack/spack/modules/common.py +++ b/lib/spack/spack/modules/common.py @@ -703,7 +703,7 @@ class BaseContext(tengine.Context): if os.path.exists(pkg.install_configure_args_path): with open(pkg.install_configure_args_path, "r") as args_file: - return args_file.read() + return spack.util.path.padding_filter(args_file.read()) # Returning a false-like value makes the default templates skip # the configure option section diff --git a/lib/spack/spack/util/path.py b/lib/spack/spack/util/path.py index 124e8efec6..f894f6f3d8 100644 --- a/lib/spack/spack/util/path.py +++ b/lib/spack/spack/util/path.py @@ -444,7 +444,7 @@ def padding_filter(string): r"(/{pad})+" # the padding string repeated one or more times r"(/{longest_prefix})?(?=/)" # trailing prefix of padding as path component ) - regex = regex.replace("/", os.sep) + regex = regex.replace("/", re.escape(os.sep)) regex = regex.format(pad=pad, longest_prefix=longest_prefix) _filter_re = re.compile(regex) |