Skip to content

Commit 0352552

Browse files
authored
llnl.path: make system_path_filter a noop on non-win32 (spack#48032)
1 parent a3985e7 commit 0352552

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/spack/llnl/path.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _is_url(path_or_url: str) -> bool:
6666
return result
6767

6868

69-
def system_path_filter(_func=None, arg_slice: Optional[slice] = None):
69+
def _system_path_filter(_func=None, arg_slice: Optional[slice] = None):
7070
"""Filters function arguments to account for platform path separators.
7171
Optional slicing range can be specified to select specific arguments
7272
@@ -100,6 +100,16 @@ def path_filter_caller(*args, **kwargs):
100100
return holder_func
101101

102102

103+
def _noop_decorator(_func=None, arg_slice: Optional[slice] = None):
104+
return _func if _func else lambda x: x
105+
106+
107+
if sys.platform == "win32":
108+
system_path_filter = _system_path_filter
109+
else:
110+
system_path_filter = _noop_decorator
111+
112+
103113
def sanitize_win_longpath(path: str) -> str:
104114
"""Strip Windows extended path prefix from strings
105115
Returns sanitized string.

0 commit comments

Comments
 (0)