mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 17:05:21 +01:00
Add warning if esphome-core dev used without esphome dev
This commit is contained in:
parent
f6cc9f7caa
commit
f3ee5b55e9
3 changed files with 26 additions and 4 deletions
|
@ -18,7 +18,8 @@ from esphome.cpp_generator import Expression, RawStatement, add, statement
|
||||||
from esphome.helpers import color, indent
|
from esphome.helpers import color, indent
|
||||||
from esphome.py_compat import IS_PY2, safe_input, text_type
|
from esphome.py_compat import IS_PY2, safe_input, text_type
|
||||||
from esphome.storage_json import StorageJSON, storage_path
|
from esphome.storage_json import StorageJSON, storage_path
|
||||||
from esphome.util import run_external_command, run_external_process, safe_print
|
from esphome.util import run_external_command, run_external_process, safe_print, \
|
||||||
|
is_dev_esphome_version
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -157,6 +158,15 @@ def write_cpp(config):
|
||||||
def compile_program(args, config):
|
def compile_program(args, config):
|
||||||
_LOGGER.info("Compiling app...")
|
_LOGGER.info("Compiling app...")
|
||||||
rc = platformio_api.run_compile(config, args.verbose)
|
rc = platformio_api.run_compile(config, args.verbose)
|
||||||
|
if rc != 0 and CORE.is_dev_esphome_core_version and not is_dev_esphome_version():
|
||||||
|
_LOGGER.warning("You're using 'esphome_core_version: dev' but not using the "
|
||||||
|
"dev version of the ESPHome tool.")
|
||||||
|
_LOGGER.warning("Expect compile errors if these versions are out of sync.")
|
||||||
|
_LOGGER.warning("Please install the dev version of ESPHome too when using "
|
||||||
|
"'esphome_core_version: dev'.")
|
||||||
|
_LOGGER.warning(" - Hass.io: Install 'ESPHome (dev)' addon")
|
||||||
|
_LOGGER.warning(" - Docker: docker run [...] esphome/esphome:dev [...]")
|
||||||
|
_LOGGER.warning(" - PIP: pip install -U https://github.com/esphome/esphome/archive/dev.zip")
|
||||||
return rc
|
return rc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,8 @@ import re
|
||||||
from typing import Any, Dict, List # noqa
|
from typing import Any, Dict, List # noqa
|
||||||
|
|
||||||
from esphome.const import CONF_ARDUINO_VERSION, CONF_ESPHOME, CONF_ESPHOME_CORE_VERSION, \
|
from esphome.const import CONF_ARDUINO_VERSION, CONF_ESPHOME, CONF_ESPHOME_CORE_VERSION, \
|
||||||
CONF_LOCAL, \
|
CONF_LOCAL, CONF_USE_ADDRESS, CONF_WIFI, ESP_PLATFORM_ESP32, ESP_PLATFORM_ESP8266, \
|
||||||
CONF_USE_ADDRESS, CONF_WIFI, ESP_PLATFORM_ESP32, ESP_PLATFORM_ESP8266
|
CONF_REPOSITORY, CONF_BRANCH
|
||||||
from esphome.helpers import ensure_unique_string
|
from esphome.helpers import ensure_unique_string
|
||||||
from esphome.py_compat import IS_PY2, integer_types
|
from esphome.py_compat import IS_PY2, integer_types
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ class ID(object):
|
||||||
return hash(self.id)
|
return hash(self.id)
|
||||||
|
|
||||||
|
|
||||||
# pylint: disable=too-many-instance-attributes
|
# pylint: disable=too-many-instance-attributes,too-many-public-methods
|
||||||
class EsphomeCore(object):
|
class EsphomeCore(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# True if command is run from dashboard
|
# True if command is run from dashboard
|
||||||
|
@ -328,6 +328,12 @@ class EsphomeCore(object):
|
||||||
def esphome_core_version(self): # type: () -> Dict[str, str]
|
def esphome_core_version(self): # type: () -> Dict[str, str]
|
||||||
return self.config[CONF_ESPHOME][CONF_ESPHOME_CORE_VERSION]
|
return self.config[CONF_ESPHOME][CONF_ESPHOME_CORE_VERSION]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_dev_esphome_core_version(self):
|
||||||
|
if CONF_REPOSITORY not in self.esphome_core_version:
|
||||||
|
return False
|
||||||
|
return self.esphome_core_version.get(CONF_BRANCH) == 'dev'
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_local_esphome_core_copy(self):
|
def is_local_esphome_core_copy(self):
|
||||||
return CONF_LOCAL in self.esphome_core_version
|
return CONF_LOCAL in self.esphome_core_version
|
||||||
|
|
|
@ -6,6 +6,8 @@ import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from esphome import const
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -147,3 +149,7 @@ def run_external_process(*cmd, **kwargs):
|
||||||
if capture_stdout:
|
if capture_stdout:
|
||||||
# pylint: disable=lost-exception
|
# pylint: disable=lost-exception
|
||||||
return sub_stdout.getvalue()
|
return sub_stdout.getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
def is_dev_esphome_version():
|
||||||
|
return 'dev' in const.__version__
|
||||||
|
|
Loading…
Reference in a new issue