1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-27 14:31:13 +00:00

Add warning to custom integrations without version (#45919)

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
Joakim Sørensen
2021-02-04 09:59:41 +01:00
committed by GitHub
parent 8256acb8ef
commit 06e6005fbb
9 changed files with 173 additions and 20 deletions

View File

@@ -2,11 +2,11 @@
from typing import Dict
from urllib.parse import urlparse
from awesomeversion import AwesomeVersion
from awesomeversion.strategy import AwesomeVersionStrategy
import voluptuous as vol
from voluptuous.humanize import humanize_error
from homeassistant.loader import validate_custom_integration_version
from .model import Integration
DOCUMENTATION_URL_SCHEMA = "https"
@@ -53,16 +53,9 @@ def verify_uppercase(value: str):
def verify_version(value: str):
"""Verify the version."""
version = AwesomeVersion(value)
if version.strategy not in [
AwesomeVersionStrategy.CALVER,
AwesomeVersionStrategy.SEMVER,
AwesomeVersionStrategy.SIMPLEVER,
AwesomeVersionStrategy.BUILDVER,
AwesomeVersionStrategy.PEP440,
]:
if not validate_custom_integration_version(value):
raise vol.Invalid(
f"'{version}' is not a valid version. This will cause a future version of Home Assistant to block this integration.",
f"'{value}' is not a valid version. This will cause a future version of Home Assistant to block this integration.",
)
return value