Skip to content

Commit

Permalink
Feat(plugins): Verify pyavd extras again in verify_requirements (#4720)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmuloc authored Nov 13, 2024
1 parent 059f886 commit 73b7ff7
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 73b7ff7

Please sign in to comment.