Skip to content

Commit 279a7d5

Browse files
authored
Fix type issue affecting builds (#4595)
1 parent 2b3f836 commit 279a7d5

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ repos:
6060
6161
6262
- repo: https://github.com/streetsidesoftware/cspell-cli
63-
rev: v8.17.3
63+
rev: v8.19.0
6464
hooks:
6565
- id: cspell
6666
# entry: codespell --relative
6767
args: [--relative, --no-progress, --no-summary]
6868
name: Spell check with cspell
6969
- repo: https://github.com/python-jsonschema/check-jsonschema
70-
rev: 0.32.1
70+
rev: 0.33.0
7171
hooks:
7272
- id: check-github-workflows
7373
- repo: https://github.com/pre-commit/pre-commit-hooks.git
@@ -144,7 +144,7 @@ repos:
144144
- id: tox-ini-fmt
145145

146146
- repo: https://github.com/astral-sh/ruff-pre-commit
147-
rev: v0.11.4
147+
rev: v0.11.7
148148
hooks:
149149
- id: ruff
150150
args:
@@ -180,7 +180,7 @@ repos:
180180
- wcmatch
181181
- yamllint>=1.34.0
182182
- repo: https://github.com/RobertCraigie/pyright-python
183-
rev: v1.1.398
183+
rev: v1.1.400
184184
hooks:
185185
- id: pyright
186186
additional_dependencies: *deps

src/ansiblelint/requirements.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ class Reqs(dict[str, SpecifierSet]):
1313

1414
def __init__(self, name: str = "ansible-lint") -> None:
1515
"""Load linter metadata requirements."""
16-
for req_str in importlib_metadata.metadata(name).json["requires_dist"]:
17-
req = Requirement(req_str)
18-
if req.name:
19-
self[req.name] = req.specifier
16+
metadata = importlib_metadata.metadata(name)
17+
if metadata:
18+
for req_str in metadata.json["requires_dist"]:
19+
req = Requirement(req_str)
20+
if req.name:
21+
self[req.name] = req.specifier
2022

2123
def matches(self, req_name: str, req_version: str | Version) -> bool:
2224
"""Verify if given version is matching current metadata dependencies."""

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ deps =
116116
twine>=4.0.1
117117
commands_pre =
118118
commands =
119-
bash -c "PIPX_BIN_DIR={work_dir}/.pipx/bin PIPX_HOME={work_dir}/.pipx pipx install --force -e ."
119+
bash -ec "PIPX_BIN_DIR={work_dir}/.pipx/bin; PIPX_HOME={work_dir}/.pipx; pipx uninstall ansible-lint || true; pipx install --force -e ."
120120
bash -c "if stderr=$({work_dir}/.pipx/bin/ansible-lint --version >/dev/null) && test -z \"$stderr\"; then echo "ok"; fi"
121121
{env_python} -c 'import os.path, shutil, sys; \
122122
dist_dir = os.path.join("{tox_root}", "dist"); \

0 commit comments

Comments
 (0)