home-assistant: fix parse-requirements.py for newer home-assistant versions
This commit is contained in:
parent
5f77ff6384
commit
93a0ec6b59
@ -53,7 +53,7 @@ def get_version():
|
|||||||
return m.group(1)
|
return m.group(1)
|
||||||
|
|
||||||
|
|
||||||
def parse_components(version="master"):
|
def parse_components(version: str = "master"):
|
||||||
components = {}
|
components = {}
|
||||||
with tempfile.TemporaryDirectory() as tmp:
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
with urlopen(
|
with urlopen(
|
||||||
@ -61,14 +61,13 @@ def parse_components(version="master"):
|
|||||||
) as response:
|
) as response:
|
||||||
tarfile.open(fileobj=BytesIO(response.read())).extractall(tmp)
|
tarfile.open(fileobj=BytesIO(response.read())).extractall(tmp)
|
||||||
# Use part of a script from the Home Assistant codebase
|
# Use part of a script from the Home Assistant codebase
|
||||||
sys.path.append(os.path.join(tmp, f"home-assistant-{version}"))
|
core_path = os.path.join(tmp, f"core-{version}")
|
||||||
|
sys.path.append(core_path)
|
||||||
from script.hassfest.model import Integration
|
from script.hassfest.model import Integration
|
||||||
|
|
||||||
integrations = Integration.load_dir(
|
integrations = Integration.load_dir(
|
||||||
pathlib.Path(
|
pathlib.Path(
|
||||||
os.path.join(
|
os.path.join(core_path, "homeassistant/components")
|
||||||
tmp, f"home-assistant-{version}", "homeassistant/components"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
for domain in sorted(integrations):
|
for domain in sorted(integrations):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user