Skip to content

Commit a4dd6a2

Browse files
authored
Merge pull request #412 from mayeut/update-precommit
Fix CI workflows
2 parents 3b26567 + 6c53b4b commit a4dd6a2

File tree

13 files changed

+38
-45
lines changed

13 files changed

+38
-45
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v3
1717
- uses: actions/setup-python@v4
1818
with:
19-
python-version: "3.7"
19+
python-version: "3.8"
2020
- uses: pre-commit/[email protected]
2121

2222
test-dist:

.pre-commit-config.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33

44
default_language_version:
5-
python: python3.7
5+
python: python3.8
66

77
exclude: ^src/auditwheel/_vendor/
88

99
repos:
1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.3.0
11+
rev: v4.4.0
1212
hooks:
1313
- id: check-builtin-literals
1414
- id: check-added-large-files
@@ -23,30 +23,30 @@ repos:
2323
- id: trailing-whitespace
2424

2525
- repo: https://github.com/asottile/pyupgrade
26-
rev: v3.2.2
26+
rev: v3.3.1
2727
hooks:
2828
- id: pyupgrade
2929
args: ["--py37-plus"]
3030

3131
- repo: https://github.com/psf/black
32-
rev: 22.10.0
32+
rev: 23.1.0
3333
hooks:
3434
- id: black
3535

3636
- repo: https://github.com/PyCQA/isort
37-
rev: 5.10.1
37+
rev: 5.12.0
3838
hooks:
3939
- id: isort
4040
args: ["-a", "from __future__ import annotations"]
4141
exclude: ^tests/integration/.*/src/.*pyx$
4242

4343
- repo: https://github.com/PyCQA/flake8
44-
rev: 5.0.4
44+
rev: 6.0.0
4545
hooks:
4646
- id: flake8
4747

4848
- repo: https://github.com/pre-commit/mirrors-mypy
49-
rev: v0.991
49+
rev: v1.0.1
5050
hooks:
5151
- id: mypy
5252
exclude: ^tests/integration/.*/.*$

noxfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
RUNNING_CI = "TRAVIS" in os.environ or "GITHUB_ACTIONS" in os.environ
1313

1414

15-
@nox.session(python=["3.7"], reuse_venv=True)
15+
@nox.session(python=["3.8"], reuse_venv=True)
1616
def lint(session: nox.Session) -> None:
1717
"""
1818
Run linters on the codebase.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ target-version = ["py37", "py38", "py39", "py310", "py311"]
1010
extend-exclude = "src/auditwheel/_vendor"
1111

1212
[tool.isort]
13+
py_version = 37
1314
profile = "black"
1415
extend_skip_glob = "src/auditwheel/_vendor/**/*.py"
1516

src/auditwheel/elfutils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os
44
from os.path import basename, realpath, relpath
5-
from typing import Dict, Iterator, List
5+
from typing import Iterator
66

77
from elftools.common.exceptions import ELFError
88
from elftools.elf.elffile import ELFFile
@@ -67,7 +67,6 @@ def elf_find_ucs2_symbols(elf: ELFFile) -> Iterator[str]:
6767
and sym["st_shndx"] == "SHN_UNDEF"
6868
and sym["st_info"]["type"] == "STT_FUNC"
6969
):
70-
7170
yield sym.name
7271

7372

@@ -104,14 +103,13 @@ def elf_is_python_extension(fn: str, elf: ELFFile) -> tuple[bool, int | None]:
104103
and sym["st_shndx"] != "SHN_UNDEF"
105104
and sym["st_info"]["type"] == "STT_FUNC"
106105
):
107-
108106
return True, module_init_f[sym.name]
109107

110108
return False, None
111109

112110

113111
def elf_read_rpaths(fn: str) -> dict[str, list[str]]:
114-
result = {"rpaths": [], "runpaths": []} # type: Dict[str, List[str]]
112+
result: dict[str, list[str]] = {"rpaths": [], "runpaths": []}
115113

116114
with open(fn, "rb") as f:
117115
elf = ELFFile(f)

src/auditwheel/lddtree.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import logging
2121
import os
2222
from pathlib import Path
23-
from typing import Any, Dict, List, Optional
23+
from typing import Any
2424

2525
from elftools.elf.elffile import ELFFile
2626

@@ -76,7 +76,7 @@ def readlink(path: str, root: str, prefixed: bool = False) -> str:
7676

7777
def dedupe(items: list[str]) -> list[str]:
7878
"""Remove all duplicates from ``items`` (keeping order)"""
79-
seen = {} # type: Dict[str, str]
79+
seen: dict[str, str] = {}
8080
return [seen.setdefault(x, x) for x in items if x not in seen]
8181

8282

@@ -101,7 +101,7 @@ def parse_ld_paths(str_ldpaths: str, path: str, root: str = "") -> list[str]:
101101
-------
102102
list of processed paths
103103
"""
104-
ldpaths = [] # type: List[str]
104+
ldpaths: list[str] = []
105105
for ldpath in str_ldpaths.split(":"):
106106
if ldpath == "":
107107
# The ldso treats "" paths as $PWD.
@@ -133,7 +133,7 @@ def parse_ld_so_conf(ldso_conf: str, root: str = "/", _first: bool = True) -> li
133133
-------
134134
list of paths found
135135
"""
136-
paths = [] # type: List[str]
136+
paths: list[str] = []
137137

138138
dbg_pfx = "" if _first else " "
139139
try:
@@ -183,7 +183,7 @@ def load_ld_paths(root: str = "/", prefix: str = "") -> dict[str, list[str]]:
183183
-------
184184
dict containing library paths to search
185185
"""
186-
ldpaths = {"conf": [], "env": [], "interp": []} # type: Dict
186+
ldpaths: dict = {"conf": [], "env": [], "interp": []}
187187

188188
# Load up $LD_LIBRARY_PATH.
189189
env_ldpath = os.environ.get("LD_LIBRARY_PATH")
@@ -271,7 +271,7 @@ def find_lib(
271271
The elf which the library should be compatible with (ELF wise)
272272
lib : str
273273
The library (basename) to search for
274-
ldpaths : List[str]
274+
ldpaths : list[str]
275275
A list of paths to search
276276
root : str
277277
The root path to resolve symlinks
@@ -349,15 +349,15 @@ def lddtree(
349349
if _first:
350350
_all_libs = {}
351351

352-
ret = {
352+
ret: dict[str, Any] = {
353353
"interp": None,
354354
"path": path if display is None else display,
355355
"realpath": path,
356356
"needed": [],
357357
"rpath": [],
358358
"runpath": [],
359359
"libs": _all_libs,
360-
} # type: Dict[str, Any]
360+
}
361361

362362
log.debug("lddtree(%s)" % path)
363363

@@ -389,9 +389,9 @@ def lddtree(
389389
break
390390

391391
# Parse the ELF's dynamic tags.
392-
libs = [] # type: List[str]
393-
rpaths = [] # type: List[str]
394-
runpaths = [] # type: List[str]
392+
libs: list[str] = []
393+
rpaths: list[str] = []
394+
runpaths: list[str] = []
395395
for segment in elf.iter_segments():
396396
if segment.header.p_type != "PT_DYNAMIC":
397397
continue
@@ -422,7 +422,7 @@ def lddtree(
422422
ret["needed"] = libs
423423

424424
# Search for the libs this ELF uses.
425-
all_ldpaths = None # type: Optional[List[str]]
425+
all_ldpaths: list[str] | None = None
426426
for lib in libs:
427427
if lib in _all_libs:
428428
continue

src/auditwheel/patcher.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ def set_soname(self, file_name: str, new_so_name: str) -> None:
5959
check_call(["patchelf", "--set-soname", new_so_name, file_name])
6060

6161
def set_rpath(self, file_name: str, rpath: str) -> None:
62-
6362
check_call(["patchelf", "--remove-rpath", file_name])
6463
check_call(["patchelf", "--force-rpath", "--set-rpath", rpath, file_name])
6564

6665
def get_rpath(self, file_name: str) -> str:
67-
6866
return (
6967
check_output(["patchelf", "--print-rpath", file_name])
7068
.decode("utf-8")

src/auditwheel/policy/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121

2222
def get_arch_name() -> str:
2323
machine = _platform_module.machine()
24+
if sys.platform == "darwin" and machine == "arm64":
25+
return "aarch64"
2426
if machine not in {"x86_64", "i686"}:
2527
return machine
26-
else:
27-
return {64: "x86_64", 32: "i686"}[bits]
28+
return {64: "x86_64", 32: "i686"}[bits]
2829

2930

3031
_ARCH_NAME = get_arch_name()

src/auditwheel/policy/external_references.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import logging
44
import re
5-
from typing import Any, Dict, Generator, Set
5+
from typing import Any, Generator
66

77
from ..elfutils import filter_undefined_symbols, is_subdir
88
from . import load_policies
@@ -44,9 +44,9 @@ def get_req_external(libs: set[str], whitelist: set[str]) -> set[str]:
4444
libs.add(dep)
4545
return reqs
4646

47-
ret = {} # type: Dict[str, Dict[str, Any]]
47+
ret: dict[str, dict[str, Any]] = {}
4848
for p in policies:
49-
needed_external_libs = set() # type: Set[str]
49+
needed_external_libs: set[str] = set()
5050
blacklist = {}
5151

5252
if not (p["name"] == "linux" and p["priority"] == 0):

src/auditwheel/policy/versioned_symbols.py

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

33
import logging
4-
from typing import Dict, List, Set
54

65
from . import load_policies
76

@@ -26,12 +25,12 @@ def policy_is_satisfied(
2625
policy_satisfied = False
2726
return policy_satisfied
2827

29-
required_vers = {} # type: Dict[str, Set[str]]
28+
required_vers: dict[str, set[str]] = {}
3029
for symbols in versioned_symbols.values():
3130
for symbol in symbols:
3231
sym_name, _, _ = symbol.partition("_")
3332
required_vers.setdefault(sym_name, set()).add(symbol)
34-
matching_policies = [] # type: List[int]
33+
matching_policies: list[int] = []
3534
for p in load_policies():
3635
policy_sym_vers = {
3736
sym_name: {sym_name + "_" + version for version in versions}

0 commit comments

Comments
 (0)