Skip to content

Commit 325ac7b

Browse files
mwtoewsmayeut
andauthored
Remove OrderedDict (#441)
* Remove OrderedDict * Add rephrased helpful comment Co-authored-by: Matthieu Darbois <[email protected]> --------- Co-authored-by: mayeut <[email protected]>
1 parent c8490cb commit 325ac7b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/auditwheel/main_show.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import logging
4-
from collections import OrderedDict
54

65
logger = logging.getLogger(__name__)
76

@@ -101,7 +100,7 @@ def execute(args, p):
101100
printp("The wheel requires no external shared libraries! :)")
102101
else:
103102
printp("The following external shared libraries are required " "by the wheel:")
104-
print(json.dumps(OrderedDict(sorted(libs.items())), indent=4))
103+
print(json.dumps(dict(sorted(libs.items())), indent=4))
105104

106105
for p in sorted(load_policies(), key=lambda p: p["priority"]):
107106
if p["priority"] > get_priority_by_name(winfo.overall_tag):

src/auditwheel/repair.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import re
88
import shutil
99
import stat
10-
from collections import OrderedDict
1110
from os.path import abspath, basename, dirname, exists, isabs
1211
from os.path import join as pjoin
1312
from subprocess import check_call
@@ -191,8 +190,8 @@ def is_valid_rpath(rpath: str) -> bool:
191190
old_rpaths = patcher.get_rpath(lib_name)
192191
rpaths = filter(is_valid_rpath, old_rpaths.split(":"))
193192
# Remove duplicates while preserving ordering
194-
# Fake an OrderedSet using OrderedDict
195-
rpath_set = OrderedDict([(old_rpath, "") for old_rpath in rpaths])
193+
# Fake an OrderedSet using a dict (ordered in python 3.7+)
194+
rpath_set = {old_rpath: "" for old_rpath in rpaths}
196195
rpath_set[rpath] = ""
197196

198197
patcher.set_rpath(lib_name, ":".join(rpath_set))

0 commit comments

Comments
 (0)