diff --git a/pyproject.toml b/pyproject.toml index 2ffe93724bc..67b7c34c829 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "Supervisor" -dynamic = ["version"] +dynamic = ["version", "dependencies"] license = { text = "Apache-2.0" } description = "Open-source private cloud os for Home-Assistant based on HassOS" readme = "README.md" @@ -13,35 +13,6 @@ authors = [ ] keywords = ["docker", "home-assistant", "api"] requires-python = ">=3.11.0" -dependencies = [ - "aiodns==3.1.1", - "aiohttp==3.8.6", - "aiohttp-fast-url-dispatcher==0.1.1", - "async_timeout==4.0.3", - "atomicwrites-homeassistant==1.4.1", - "attrs==23.1.0", - "awesomeversion==23.11.0", - "brotli==1.1.0", - "ciso8601==2.3.1", - "colorlog==6.7.0", - "cpe==1.2.1", - "cryptography==41.0.5", - "debugpy==1.8.0", - "deepmerge==1.1.0", - "dirhash==0.2.1", - "docker==6.1.3", - "faust-cchardet==2.1.19", - "gitpython==3.1.40", - "jinja2==3.1.2", - "pulsectl==23.5.2", - "pyudev==0.24.1", - "PyYAML==6.0.1", - "securetar==2023.3.0", - "sentry-sdk==1.36.0", - "voluptuous==0.14.1", - "dbus-fast==2.14.0", - "typing_extensions==4.8.0", -] [project.urls] "Homepage" = "https://www.home-assistant.io/" diff --git a/setup.py b/setup.py index 2725e78d0ce..a5df554feeb 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,27 @@ """Home Assistant Supervisor setup.""" +from pathlib import Path +import re + from setuptools import setup -from supervisor.const import SUPERVISOR_VERSION +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" + -setup(version=SUPERVISOR_VERSION) +setup( + version=_get_supervisor_version(), + dependencies=REQUIREMENTS.split("/n"), +)