2020-02-25 18:37:06 +01:00
|
|
|
"""Home Assistant Supervisor setup."""
|
2023-12-29 11:46:01 +01:00
|
|
|
from pathlib import Path
|
|
|
|
import re
|
|
|
|
|
2018-03-13 23:09:53 +01:00
|
|
|
from setuptools import setup
|
|
|
|
|
2023-12-29 11:46:01 +01:00
|
|
|
RE_SUPERVISOR_VERSION = re.compile(r"^SUPERVISOR_VERSION =\s*(.+)$")
|
|
|
|
|
|
|
|
SUPERVISOR_DIR = Path(__file__).parent
|
|
|
|
REQUIREMENTS_FILE = SUPERVISOR_DIR / "requirements.txt"
|
|
|
|
CONST_FILE = SUPERVISOR_DIR / "supervisor/const.py"
|
|
|
|
|
|
|
|
REQUIREMENTS = REQUIREMENTS_FILE.read_text(encoding="utf-8")
|
|
|
|
CONSTANTS = CONST_FILE.read_text(encoding="utf-8")
|
|
|
|
|
|
|
|
|
|
|
|
def _get_supervisor_version():
|
|
|
|
for line in CONSTANTS.split("/n"):
|
|
|
|
if match := RE_SUPERVISOR_VERSION.match(line):
|
|
|
|
return match.group(1)
|
|
|
|
return "99.9.9dev"
|
|
|
|
|
2018-03-13 23:09:53 +01:00
|
|
|
|
|
|
|
setup(
|
2023-12-29 11:46:01 +01:00
|
|
|
version=_get_supervisor_version(),
|
|
|
|
dependencies=REQUIREMENTS.split("/n"),
|
2019-05-31 13:53:46 +02:00
|
|
|
)
|