mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 14:24:03 +02:00
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.6 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.6...v0.2.0) - [github.com/psf/black: 23.11.0 → 24.1.1](https://github.com/psf/black/compare/23.11.0...24.1.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""Extracts the dependencies of the components required for testing."""
|
|
|
|
from collections import defaultdict
|
|
from pathlib import Path
|
|
|
|
deps = defaultdict(list)
|
|
components, packages = [], []
|
|
|
|
requirements = Path("core") / "requirements_test_all.txt"
|
|
|
|
with requirements.open() as f:
|
|
lines = f.readlines()
|
|
|
|
for line in lines:
|
|
line = line.strip() # noqa: PLW2901
|
|
|
|
if line.startswith("# homeassistant."):
|
|
if components and packages:
|
|
for component in components:
|
|
deps[component].extend(packages)
|
|
components, packages = [], []
|
|
components.append(line.split("# homeassistant.")[1])
|
|
elif components and line:
|
|
packages.append(line)
|
|
|
|
# The last batch of components and packages
|
|
if components and packages:
|
|
for component in components:
|
|
deps[component].extend(packages)
|
|
|
|
required = [
|
|
"components.recorder",
|
|
"components.mqtt",
|
|
"components.zeroconf",
|
|
"components.http",
|
|
"components.stream",
|
|
"components.conversation", # only available after HA≥2023.2
|
|
"components.cloud",
|
|
]
|
|
to_install = [package for r in required for package in deps[r]]
|
|
|
|
print(" ".join(to_install)) # noqa: T201
|