@@ -1336,17 +1336,33 @@ def test_make_module_step(self):
13361336 for (key , vals ) in modextrapaths .items ():
13371337 if isinstance (vals , str ):
13381338 vals = [vals ]
1339- for val in vals :
1340- if get_module_syntax () == 'Tcl' :
1341- regex = re .compile (r'^prepend-path\s+(-d "."\s+)?%s\s+\$root/%s$' % (key , val ), re .M )
1342- elif get_module_syntax () == 'Lua' :
1343- regex = re .compile (r'^prepend_path\("%s", pathJoin\(root, "%s"\)(, ".")?\)$' % (key , val ), re .M )
1344- else :
1345- self .fail ("Unknown module syntax: %s" % get_module_syntax ())
1346- self .assertTrue (regex .search (txt ), "Pattern %s found in %s" % (regex .pattern , txt ))
1347- # Check for duplicates
1348- num_prepends = len (regex .findall (txt ))
1349- self .assertEqual (num_prepends , 1 , "Expected exactly 1 %s command in %s" % (regex .pattern , txt ))
1339+ if type (vals ) == dict :
1340+ delim = vals ['delimiter' ]
1341+ paths = vals ['paths' ]
1342+
1343+ for val in paths :
1344+ if get_module_syntax () == 'Tcl' :
1345+ regex = re .compile (fr'^prepend-path\s+-d\s+"{ delim } "\s+{ key } \s+\$root/{ val } $' , re .M )
1346+ elif get_module_syntax () == 'Lua' :
1347+ regex = re .compile (fr'^prepend_path\("{ key } ", pathJoin\(root, "{ val } "\), "{ delim } "\)$' , re .M )
1348+ else :
1349+ self .fail ("Unknown module syntax: %s" % get_module_syntax ())
1350+ self .assertTrue (regex .search (txt ), "Pattern %s found in %s" % (regex .pattern , txt ))
1351+ # Check for duplicates
1352+ num_prepends = len (regex .findall (txt ))
1353+ self .assertEqual (num_prepends , 1 , "Expected exactly 1 %s command in %s" % (regex .pattern , txt ))
1354+ else :
1355+ for val in vals :
1356+ if get_module_syntax () == 'Tcl' :
1357+ regex = re .compile (fr'^prepend-path\s+{ key } \s+\$root/{ val } $' , re .M )
1358+ elif get_module_syntax () == 'Lua' :
1359+ regex = re .compile (fr'^prepend_path\("{ key } ", pathJoin\(root, "{ val } "\)\)$' , re .M )
1360+ else :
1361+ self .fail ("Unknown module syntax: %s" % get_module_syntax ())
1362+ self .assertTrue (regex .search (txt ), "Pattern %s found in %s" % (regex .pattern , txt ))
1363+ # Check for duplicates
1364+ num_prepends = len (regex .findall (txt ))
1365+ self .assertEqual (num_prepends , 1 , "Expected exactly 1 %s command in %s" % (regex .pattern , txt ))
13501366
13511367 for (key , vals ) in modextrapaths_append .items ():
13521368 if isinstance (vals , str ):
0 commit comments