WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 8845516

Browse files
committed
Fix duplicate entries
1 parent 62cc744 commit 8845516

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scripts/steal_sections.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,11 @@ def steal_section(repo_dict, toolset: str, leftovers_file: str, galaxy_url: str,
7070
if verbose:
7171
print(f"Adding to existing section file: {section_file}")
7272
tools = a['tools']
73-
tools.extend({"name": t[0], "owner": t[1]} for t in repos)
73+
# Get existing tool keys to avoid duplicates
74+
existing_tools = {(tool['name'], tool['owner']) for tool in tools}
75+
# Only add tools that don't already exist in this section file
76+
new_tools = [{"name": t[0], "owner": t[1]} for t in repos if t not in existing_tools]
77+
tools.extend(new_tools)
7478

7579
with open(section_file, 'w') as out:
7680
yaml.dump(a, out, default_flow_style=False)

0 commit comments

Comments
 (0)