-
Notifications
You must be signed in to change notification settings - Fork 774
Expand file tree
/
Copy pathsetup.py
More file actions
32 lines (23 loc) · 864 Bytes
/
setup.py
File metadata and controls
32 lines (23 loc) · 864 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Home Assistant Supervisor setup."""
from pathlib import Path
import re
from setuptools import setup
RE_SUPERVISOR_VERSION = re.compile(
r'^SUPERVISOR_VERSION =\s*"?((?P<git_sha>[0-9a-f]{40})|[^"]+)"?$'
)
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):
if git_sha := match.group("git_sha"):
return f"9999.09.9.dev9999+{git_sha}"
return match.group(1)
return "9999.09.9.dev9999"
setup(
version=_get_supervisor_version(),
dependencies=REQUIREMENTS.split("\n"),
)