Skip to content

Commit cb6adb0

Browse files
committed
Move _filter_paths check to _update_paths
This will ensure duplicate paths are filtered even when EBPYTHONPREFIXES rewrite is in place.
1 parent 8b5389f commit cb6adb0

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

easybuild/tools/module_generator.py

+9-5
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def _filter_paths(self, key, paths):
220220
if filtered_paths != paths:
221221
removed_paths = paths if filtered_paths is None else [x for x in paths if x not in filtered_paths]
222222
print_warning("Suppressed adding the following path(s) to $%s of the module as they were already added: %s",
223-
key, removed_paths,
223+
key, ', '.join(removed_paths),
224224
log=self.log)
225225
if not filtered_paths:
226226
filtered_paths = None
@@ -261,10 +261,6 @@ def update_paths(self, key, paths, prepend=True, allow_abs=False, expand_relpath
261261
self.log.debug("Wrapping %s into a list before using it for %s", paths, key)
262262
paths = [paths]
263263

264-
paths = self._filter_paths(key, paths)
265-
if paths is None:
266-
return ''
267-
268264
if key == 'PYTHONPATH':
269265
python_paths = [path for path in paths if re.match(r'lib/python\d+\.\d+/site-packages', path)]
270266
if len(python_paths) > 1:
@@ -985,6 +981,10 @@ def _update_paths(self, key, paths, prepend=True, allow_abs=False, expand_relpat
985981
:param allow_abs: allow providing of absolute paths
986982
:param expand_relpaths: expand relative paths into absolute paths (by prefixing install dir)
987983
"""
984+
paths = self._filter_paths(key, paths)
985+
if paths is None:
986+
return ''
987+
988988
if prepend:
989989
update_type = 'prepend'
990990
else:
@@ -1452,6 +1452,10 @@ def _update_paths(self, key, paths, prepend=True, allow_abs=False, expand_relpat
14521452
:param allow_abs: allow providing of absolute paths
14531453
:param expand_relpaths: expand relative paths into absolute paths (by prefixing install dir)
14541454
"""
1455+
paths = self._filter_paths(key, paths)
1456+
if paths is None:
1457+
return ''
1458+
14551459
if prepend:
14561460
update_type = 'prepend'
14571461
else:

0 commit comments

Comments
 (0)