@@ -213,18 +213,10 @@ def _filter_paths(self, key, paths):
213
213
return paths
214
214
215
215
added_paths = self .added_paths_per_key .setdefault (key , set ())
216
- # paths can be a string
217
- if isinstance (paths , str ):
218
- if paths in added_paths :
219
- filtered_paths = None
220
- else :
221
- added_paths .add (paths )
222
- filtered_paths = paths
223
- else :
224
- # Coerce any iterable/generator into a list
225
- if not isinstance (paths , list ):
226
- paths = list (paths )
227
- filtered_paths = [x for x in paths if x not in added_paths and not added_paths .add (x )]
216
+ # Coerce any iterable/generator into a list
217
+ if not isinstance (paths , list ):
218
+ paths = list (paths )
219
+ filtered_paths = [x for x in paths if x not in added_paths and not added_paths .add (x )]
228
220
if filtered_paths != paths :
229
221
removed_paths = paths if filtered_paths is None else [x for x in paths if x not in filtered_paths ]
230
222
print_warning ("Suppressed adding the following path(s) to $%s of the module as they were already added: %s" ,
@@ -265,9 +257,14 @@ def update_paths(self, key, paths, prepend=True, allow_abs=False, expand_relpath
265
257
:param allow_abs: allow providing of absolute paths
266
258
:param expand_relpaths: expand relative paths into absolute paths (by prefixing install dir)
267
259
"""
260
+ if isinstance (paths , str ):
261
+ self .log .debug ("Wrapping %s into a list before using it for %s" , paths , key )
262
+ paths = [paths ]
263
+
268
264
paths = self ._filter_paths (key , paths )
269
265
if paths is None :
270
266
return ''
267
+
271
268
if key == 'PYTHONPATH' :
272
269
python_paths = [path for path in paths if re .match (r'lib/python\d+\.\d+/site-packages' , path )]
273
270
if len (python_paths ) > 1 :
@@ -997,10 +994,6 @@ def _update_paths(self, key, paths, prepend=True, allow_abs=False, expand_relpat
997
994
self .log .info ("Not including statement to %s environment variable $%s, as specified" , update_type , key )
998
995
return ''
999
996
1000
- if isinstance (paths , str ):
1001
- self .log .debug ("Wrapping %s into a list before using it to %s path %s" , paths , update_type , key )
1002
- paths = [paths ]
1003
-
1004
997
abspaths = []
1005
998
for path in paths :
1006
999
if os .path .isabs (path ) and not allow_abs :
@@ -1468,10 +1461,6 @@ def _update_paths(self, key, paths, prepend=True, allow_abs=False, expand_relpat
1468
1461
self .log .info ("Not including statement to %s environment variable $%s, as specified" , update_type , key )
1469
1462
return ''
1470
1463
1471
- if isinstance (paths , str ):
1472
- self .log .debug ("Wrapping %s into a list before using it to %s path %s" , update_type , paths , key )
1473
- paths = [paths ]
1474
-
1475
1464
abspaths = []
1476
1465
for path in paths :
1477
1466
if os .path .isabs (path ):
0 commit comments