Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(plugins): Verify pyavd extras again in verify_requirements #4720

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import json
import sys
from importlib.metadata import Distribution, PackageNotFoundError, version
from importlib.metadata import Distribution, PackageNotFoundError, metadata, version
from pathlib import Path
from subprocess import PIPE, Popen
from typing import Any
Expand Down Expand Up @@ -112,6 +112,12 @@ def _validate_python_requirements(requirements: list, info: dict) -> bool:
msg = f"Wrong format for requirement {raw_req}"
raise AnsibleActionFail(msg) from exc

if req.extras:
for subreq_name in metadata(req.name).get_all("Requires-Dist"):
subreq = Requirement(subreq_name)
if subreq.marker:
requirements.extend(subreq_name for marker in subreq.marker._markers if str(marker[0]) == "extra" and str(marker[2]) in req.extras)

if RUNNING_FROM_SOURCE and req.name == "pyavd":
display.vvv("AVD is running from source, *not* checking pyavd version.", "Verify Requirements")
requirements_dict["valid"][req.name] = {
Expand Down
Loading