Skip to content

Commit 7eedf6d

Browse files
committed
Change sets to lists to ensure deterministic order
1 parent 97258c6 commit 7eedf6d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tools/empath-split.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def parse_paths_file(paths_file_content):
262262
module_to_paths = {}
263263
path_to_module = {}
264264
cur_module = None
265-
cur_paths = set()
265+
cur_paths = []
266266

267267
for line in paths_file_content.splitlines():
268268
line = line.strip()
@@ -272,7 +272,7 @@ def parse_paths_file(paths_file_content):
272272
diagnostics.warn(f"Module '{cur_module}' has no paths specified.")
273273
module_to_paths[cur_module] = cur_paths
274274
cur_module = None
275-
cur_paths = set()
275+
cur_paths = []
276276
continue
277277

278278
if not cur_module:
@@ -281,7 +281,7 @@ def parse_paths_file(paths_file_content):
281281
path = normalize_path(line)
282282
if path in path_to_module:
283283
exit_with_error("Path '{path}' cannot be assigned to module '{cur_module}; it is already assigned to module '{path_to_module[path]}'")
284-
cur_paths.add(path)
284+
cur_paths.append(path)
285285
path_to_module[path] = cur_module
286286

287287
if cur_module:
@@ -319,11 +319,11 @@ def main():
319319
for i, (module, paths) in enumerate(module_to_paths.items()):
320320
if i != 0: # Unless we are the first entry add a newline separator
321321
f.write('\n')
322-
funcs = set()
322+
funcs = []
323323
for path in paths:
324324
if not path_to_funcs[path]:
325325
diagnostics.warn(f'{path} does not match any functions')
326-
funcs.update(path_to_funcs[path])
326+
funcs += path_to_funcs[path]
327327
if not funcs:
328328
diagnostics.warn(f"Module '{module}' does not match any functions")
329329

@@ -339,8 +339,6 @@ def main():
339339
f.write(f'{module}\n')
340340
for func in funcs:
341341
f.write(func + '\n')
342-
if i < len(module_to_paths) - 1:
343-
f.write('\n')
344342
f.flush()
345343

346344
cmd = [args.wasm_split, '--multi-split', args.wasm, '--manifest', manifest]

0 commit comments

Comments
 (0)