Skip to content

Commit a8e065e

Browse files
[pre-commit.ci] pre-commit autoupdate (#560)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](astral-sh/ruff-pre-commit@v0.9.10...v0.11.0) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore: use existing unique_by_index function to filter rpaths --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: mayeut <[email protected]>
1 parent ff5b637 commit a8e065e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
- id: trailing-whitespace
2525

2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: v0.9.10
27+
rev: v0.11.0
2828
hooks:
2929
- id: ruff
3030
args: ["--fix", "--show-fixes"]

src/auditwheel/repair.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from .elfutils import elf_read_dt_needed, elf_read_rpaths
1919
from .hashfile import hashfile
2020
from .policy import WheelPolicies, get_replace_platforms
21-
from .tools import is_subdir
21+
from .tools import is_subdir, unique_by_index
2222
from .wheel_abi import get_wheel_elfdata
2323
from .wheeltools import InWheelCtx, add_platforms
2424

@@ -193,13 +193,9 @@ def is_valid_rpath(rpath: str) -> bool:
193193
return _is_valid_rpath(rpath, lib_dir, wheel_base_dir)
194194

195195
old_rpaths = patcher.get_rpath(lib_name)
196-
rpaths = filter(is_valid_rpath, old_rpaths.split(":"))
197-
# Remove duplicates while preserving ordering
198-
# Fake an OrderedSet using a dict (ordered in python 3.7+)
199-
rpath_set = {old_rpath: "" for old_rpath in rpaths}
200-
rpath_set[rpath] = ""
201-
202-
patcher.set_rpath(lib_name, ":".join(rpath_set))
196+
rpaths = list(filter(is_valid_rpath, old_rpaths.split(":")))
197+
rpaths = unique_by_index([*rpaths, rpath])
198+
patcher.set_rpath(lib_name, ":".join(rpaths))
203199

204200

205201
def _is_valid_rpath(rpath: str, lib_dir: Path, wheel_base_dir: Path) -> bool:

0 commit comments

Comments
 (0)