mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 00:20:30 +01:00
Hassfest requirements.py optimization (#166514)
This commit is contained in:
@@ -502,6 +502,12 @@ def get_pipdeptree() -> dict[str, dict[str, Any]]:
|
|||||||
return deptree
|
return deptree
|
||||||
|
|
||||||
|
|
||||||
|
@cache
|
||||||
|
def metadata_cache(package: str) -> dict:
|
||||||
|
"""Return package metadata, cached."""
|
||||||
|
return metadata(package)
|
||||||
|
|
||||||
|
|
||||||
def get_requirements(integration: Integration, packages: set[str]) -> set[str]:
|
def get_requirements(integration: Integration, packages: set[str]) -> set[str]:
|
||||||
"""Return all (recursively) requirements for an integration."""
|
"""Return all (recursively) requirements for an integration."""
|
||||||
deptree = get_pipdeptree()
|
deptree = get_pipdeptree()
|
||||||
@@ -550,7 +556,7 @@ def get_requirements(integration: Integration, packages: set[str]) -> set[str]:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
# Check for restrictive version limits on Python
|
# Check for restrictive version limits on Python
|
||||||
if (requires_python := metadata(package)["Requires-Python"]) and not all(
|
if (requires_python := metadata_cache(package)["Requires-Python"]) and not all(
|
||||||
_is_dependency_version_range_valid(version_part, "SemVer")
|
_is_dependency_version_range_valid(version_part, "SemVer")
|
||||||
for version_part in requires_python.split(",")
|
for version_part in requires_python.split(",")
|
||||||
):
|
):
|
||||||
|
|||||||
Reference in New Issue
Block a user