diff --git a/homeassistant/config.py b/homeassistant/config.py index 5cd4a0700e5..73d0273d1c0 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -1,6 +1,5 @@ """Module to help with parsing and generating configuration files.""" from collections import OrderedDict -from distutils.version import LooseVersion # pylint: disable=import-error import logging import os import re @@ -8,6 +7,7 @@ import shutil from types import ModuleType from typing import Any, Callable, Dict, Optional, Sequence, Set, Tuple, Union +from awesomeversion import AwesomeVersion import voluptuous as vol from voluptuous.humanize import humanize_error @@ -364,15 +364,15 @@ def process_ha_config_upgrade(hass: HomeAssistant) -> None: "Upgrading configuration directory from %s to %s", conf_version, __version__ ) - version_obj = LooseVersion(conf_version) + version_obj = AwesomeVersion(conf_version) - if version_obj < LooseVersion("0.50"): + if version_obj < AwesomeVersion("0.50"): # 0.50 introduced persistent deps dir. lib_path = hass.config.path("deps") if os.path.isdir(lib_path): shutil.rmtree(lib_path) - if version_obj < LooseVersion("0.92"): + if version_obj < AwesomeVersion("0.92"): # 0.92 moved google/tts.py to google_translate/tts.py config_path = hass.config.path(YAML_CONFIG_FILE) @@ -388,7 +388,7 @@ def process_ha_config_upgrade(hass: HomeAssistant) -> None: except OSError: _LOGGER.exception("Migrating to google_translate tts failed") - if version_obj < LooseVersion("0.94") and is_docker_env(): + if version_obj < AwesomeVersion("0.94") and is_docker_env(): # In 0.94 we no longer install packages inside the deps folder when # running inside a Docker container. lib_path = hass.config.path("deps")