Update dependencies (#653)

* Update pio dependencies

* Platformio 4

* Fixes

* Update platformio_api.py

* Lint
This commit is contained in:
Otto Winter 2019-06-28 11:29:37 +02:00 committed by GitHub
parent 82625a3080
commit 2712c44004
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 113 additions and 60 deletions

View file

@ -4,9 +4,10 @@ from esphome import automation
from esphome.automation import Condition from esphome.automation import Condition
from esphome.const import CONF_DATA, CONF_DATA_TEMPLATE, CONF_ID, CONF_PASSWORD, CONF_PORT, \ from esphome.const import CONF_DATA, CONF_DATA_TEMPLATE, CONF_ID, CONF_PASSWORD, CONF_PORT, \
CONF_REBOOT_TIMEOUT, CONF_SERVICE, CONF_VARIABLES, CONF_SERVICES, CONF_TRIGGER_ID, CONF_EVENT CONF_REBOOT_TIMEOUT, CONF_SERVICE, CONF_VARIABLES, CONF_SERVICES, CONF_TRIGGER_ID, CONF_EVENT
from esphome.core import CORE, coroutine_with_priority from esphome.core import coroutine_with_priority
DEPENDENCIES = ['network'] DEPENDENCIES = ['network']
AUTO_LOAD = ['async_tcp']
api_ns = cg.esphome_ns.namespace('api') api_ns = cg.esphome_ns.namespace('api')
APIServer = api_ns.class_('APIServer', cg.Component, cg.Controller) APIServer = api_ns.class_('APIServer', cg.Component, cg.Controller)
@ -67,10 +68,6 @@ def to_code(config):
cg.add_define('USE_API') cg.add_define('USE_API')
cg.add_global(api_ns.using) cg.add_global(api_ns.using)
if CORE.is_esp32:
cg.add_library('AsyncTCP', '1.0.3')
elif CORE.is_esp8266:
cg.add_library('ESPAsyncTCP', '1.2.0')
KEY_VALUE_SCHEMA = cv.Schema({cv.string: cv.templatable(cv.string)}) KEY_VALUE_SCHEMA = cv.Schema({cv.string: cv.templatable(cv.string)})

View file

@ -0,0 +1,13 @@
# Dummy integration to allow relying on AsyncTCP
from esphome.core import CORE, coroutine_with_priority
import esphome.codegen as cg
@coroutine_with_priority(200.0)
def to_code(config):
if CORE.is_esp32:
# https://github.com/me-no-dev/AsyncTCP/blob/master/library.json
cg.add_library('AsyncTCP', '1.0.3')
elif CORE.is_esp8266:
# https://github.com/me-no-dev/ESPAsyncTCP/blob/master/library.json
cg.add_library('ESPAsyncTCP', '1.2.0')

View file

@ -34,5 +34,6 @@ def new_fastled_light(config):
cg.add(var.set_max_refresh_rate(config[CONF_MAX_REFRESH_RATE])) cg.add(var.set_max_refresh_rate(config[CONF_MAX_REFRESH_RATE]))
yield light.register_light(var, config) yield light.register_light(var, config)
cg.add_library('FastLED', '3.2.0') # https://github.com/FastLED/FastLED/blob/master/library.json
cg.add_library('FastLED', '3.2.9')
yield var yield var

View file

@ -20,4 +20,6 @@ def to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config) yield cg.register_component(var, config)
yield uart.register_uart_device(var, config) yield uart.register_uart_device(var, config)
# https://platformio.org/lib/show/1655/TinyGPSPlus
cg.add_library('TinyGPSPlus', '1.0.2') cg.add_library('TinyGPSPlus', '1.0.2')

View file

@ -15,7 +15,7 @@ from esphome.const import CONF_AVAILABILITY, CONF_BIRTH_MESSAGE, CONF_BROKER, CO
from esphome.core import coroutine_with_priority, coroutine, CORE from esphome.core import coroutine_with_priority, coroutine, CORE
DEPENDENCIES = ['network'] DEPENDENCIES = ['network']
AUTO_LOAD = ['json'] AUTO_LOAD = ['json', 'async_tcp']
def validate_message_just_topic(value): def validate_message_just_topic(value):
@ -154,6 +154,7 @@ def to_code(config):
var = cg.new_Pvariable(config[CONF_ID]) var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config) yield cg.register_component(var, config)
# https://github.com/marvinroger/async-mqtt-client/blob/master/library.json
cg.add_library('AsyncMqttClient', '0.8.2') cg.add_library('AsyncMqttClient', '0.8.2')
cg.add_define('USE_MQTT') cg.add_define('USE_MQTT')
cg.add_global(mqtt_ns.using) cg.add_global(mqtt_ns.using)

View file

@ -101,6 +101,14 @@ ESP8266_METHODS = {
ESP32_METHODS = { ESP32_METHODS = {
'ESP32_I2S_0': 'NeoEsp32I2s0{}Method', 'ESP32_I2S_0': 'NeoEsp32I2s0{}Method',
'ESP32_I2S_1': 'NeoEsp32I2s1{}Method', 'ESP32_I2S_1': 'NeoEsp32I2s1{}Method',
'ESP32_RMT_0': 'NeoEsp32Rmt0{}Method',
'ESP32_RMT_1': 'NeoEsp32Rmt1{}Method',
'ESP32_RMT_2': 'NeoEsp32Rmt2{}Method',
'ESP32_RMT_3': 'NeoEsp32Rmt3{}Method',
'ESP32_RMT_4': 'NeoEsp32Rmt4{}Method',
'ESP32_RMT_5': 'NeoEsp32Rmt5{}Method',
'ESP32_RMT_6': 'NeoEsp32Rmt6{}Method',
'ESP32_RMT_7': 'NeoEsp32Rmt7{}Method',
'BIT_BANG': 'NeoEsp32BitBang{}Method', 'BIT_BANG': 'NeoEsp32BitBang{}Method',
} }
@ -160,4 +168,5 @@ def to_code(config):
cg.add(var.set_pixel_order(getattr(ESPNeoPixelOrder, config[CONF_TYPE]))) cg.add(var.set_pixel_order(getattr(ESPNeoPixelOrder, config[CONF_TYPE])))
cg.add_library('NeoPixelBus', '2.4.1') # https://github.com/Makuna/NeoPixelBus/blob/master/library.json
cg.add_library('NeoPixelBus', '2.5.0')

View file

@ -2,7 +2,7 @@
#include "esphome/core/log.h" #include "esphome/core/log.h"
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
#include "apps/sntp/sntp.h" #include "lwip/apps/sntp.h"
#endif #endif
#ifdef ARDUINO_ARCH_ESP8266 #ifdef ARDUINO_ARCH_ESP8266
#include "sntp.h" #include "sntp.h"

View file

@ -3,6 +3,7 @@ import esphome.config_validation as cv
from esphome import automation from esphome import automation
from esphome.components import time from esphome.components import time
from esphome.const import CONF_TIME_ID, CONF_ID, CONF_TRIGGER_ID from esphome.const import CONF_TIME_ID, CONF_ID, CONF_TRIGGER_ID
from esphome.py_compat import string_types
sun_ns = cg.esphome_ns.namespace('sun') sun_ns = cg.esphome_ns.namespace('sun')
@ -31,9 +32,9 @@ ELEVATION_MAP = {
def elevation(value): def elevation(value):
if isinstance(value, str): if isinstance(value, string_types):
try: try:
value = ELEVATION_MAP[cv.one_of(*ELEVATION_MAP, lower=True, space='_')] value = ELEVATION_MAP[cv.one_of(*ELEVATION_MAP, lower=True, space='_')(value)]
except cv.Invalid: except cv.Invalid:
pass pass
value = cv.angle(value) value = cv.angle(value)

View file

@ -3,7 +3,7 @@ import esphome.codegen as cg
from esphome.const import CONF_ID from esphome.const import CONF_ID
from esphome.core import coroutine_with_priority, CORE from esphome.core import coroutine_with_priority, CORE
DEPENDENCIES = ['network'] DEPENDENCIES = ['network', 'async_tcp']
web_server_base_ns = cg.esphome_ns.namespace('web_server_base') web_server_base_ns = cg.esphome_ns.namespace('web_server_base')
WebServerBase = web_server_base_ns.class_('WebServerBase', cg.Component) WebServerBase = web_server_base_ns.class_('WebServerBase', cg.Component)
@ -21,4 +21,5 @@ def to_code(config):
if CORE.is_esp32: if CORE.is_esp32:
cg.add_library('FS', None) cg.add_library('FS', None)
cg.add_library('ESP Async WebServer', '1.1.1') # https://github.com/me-no-dev/ESPAsyncWebServer/blob/master/library.json
cg.add_library('ESP Async WebServer', '1.2.2')

View file

@ -495,7 +495,7 @@ class EsphomeCore(object):
# A list of statements to insert in the global block (includes and global variables) # A list of statements to insert in the global block (includes and global variables)
self.global_statements = [] # type: List[Statement] self.global_statements = [] # type: List[Statement]
# A set of platformio libraries to add to the project # A set of platformio libraries to add to the project
self.libraries = set() # type: Set[Library] self.libraries = [] # type: List[Library]
# A set of build flags to set in the platformio project # A set of build flags to set in the platformio project
self.build_flags = set() # type: Set[str] self.build_flags = set() # type: Set[str]
# A set of defines to set for the compile process in esphome/core/defines.h # A set of defines to set for the compile process in esphome/core/defines.h
@ -522,7 +522,7 @@ class EsphomeCore(object):
self.variables = {} self.variables = {}
self.main_statements = [] self.main_statements = []
self.global_statements = [] self.global_statements = []
self.libraries = set() self.libraries = []
self.build_flags = set() self.build_flags = set()
self.defines = set() self.defines = set()
self.active_coroutines = {} self.active_coroutines = {}
@ -666,8 +666,25 @@ class EsphomeCore(object):
if not isinstance(library, Library): if not isinstance(library, Library):
raise ValueError(u"Library {} must be instance of Library, not {}" raise ValueError(u"Library {} must be instance of Library, not {}"
u"".format(library, type(library))) u"".format(library, type(library)))
self.libraries.add(library)
_LOGGER.debug("Adding library: %s", library) _LOGGER.debug("Adding library: %s", library)
for other in self.libraries[:]:
if other.name != library.name:
continue
if library.version is None:
# Other requirement is more specific
break
if other.version is None:
# Found more specific version requirement
self.libraries.remove(other)
continue
if other.version == library.version:
break
raise ValueError(u"Version pinning failed! Libraries {} and {} "
u"requested with conflicting versions!"
u"".format(library, other))
else:
self.libraries.append(library)
return library return library
def add_build_flag(self, build_flag): def add_build_flag(self, build_flag):

View file

@ -7,21 +7,28 @@ import re
import subprocess import subprocess
from esphome.core import CORE from esphome.core import CORE
from esphome.py_compat import IS_PY2
from esphome.util import run_external_command, run_external_process from esphome.util import run_external_command, run_external_process
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
def is_platformio4():
from platformio import VERSION
return VERSION[0] >= 4
def patch_structhash(): def patch_structhash():
# Patch platformio's structhash to not recompile the entire project when files are # Patch platformio's structhash to not recompile the entire project when files are
# removed/added. This might have unintended consequences, but this improves compile # removed/added. This might have unintended consequences, but this improves compile
# times greatly when adding/removing components and a simple clean build solves # times greatly when adding/removing components and a simple clean build solves
# all issues # all issues
# pylint: disable=no-member,no-name-in-module # pylint: disable=no-member,no-name-in-module,import-error
from platformio.commands import run from platformio.commands import run
from platformio import util from platformio import util
from platformio.util import get_project_dir if is_platformio4():
from platformio.project.helpers import get_project_dir
else:
from platformio.util import get_project_dir
from os.path import join, isdir, getmtime, isfile from os.path import join, isdir, getmtime, isfile
from os import makedirs from os import makedirs
@ -36,7 +43,11 @@ def patch_structhash():
if not isdir(build_dir): if not isdir(build_dir):
makedirs(build_dir) makedirs(build_dir)
proj_hash = run.calculate_project_hash() if is_platformio4():
from platformio.project import helpers
proj_hash = helpers.calculate_project_hash()
else:
proj_hash = run.calculate_project_hash()
# check project structure # check project structure
if isdir(build_dir) and isfile(structhash_file): if isdir(build_dir) and isfile(structhash_file):
@ -48,15 +59,10 @@ def patch_structhash():
f.write(proj_hash) f.write(proj_hash)
# pylint: disable=protected-access # pylint: disable=protected-access
orig = run._clean_build_dir if is_platformio4():
run.helpers.clean_build_dir = patched_clean_build_dir
def patched_safe(*args, **kwargs): else:
try: run._clean_build_dir = patched_clean_build_dir
return patched_clean_build_dir(*args, **kwargs)
except Exception: # pylint: disable=broad-except
return orig(*args, **kwargs)
run._clean_build_dir = patched_safe
def run_platformio_cli(*args, **kwargs): def run_platformio_cli(*args, **kwargs):
@ -65,18 +71,13 @@ def run_platformio_cli(*args, **kwargs):
os.environ["PLATFORMIO_LIBDEPS_DIR"] = os.path.abspath(CORE.relative_piolibdeps_path()) os.environ["PLATFORMIO_LIBDEPS_DIR"] = os.path.abspath(CORE.relative_piolibdeps_path())
cmd = ['platformio'] + list(args) cmd = ['platformio'] + list(args)
if os.environ.get('ESPHOME_USE_SUBPROCESS') is None: if os.environ.get('ESPHOME_USE_SUBPROCESS') is not None:
import platformio.__main__ return run_external_process(*cmd, **kwargs)
try:
if IS_PY2:
patch_structhash()
except Exception: # pylint: disable=broad-except
# Ignore when patch fails
pass
return run_external_command(platformio.__main__.main,
*cmd, **kwargs)
return run_external_process(*cmd, **kwargs) import platformio.__main__
patch_structhash()
return run_external_command(platformio.__main__.main,
*cmd, **kwargs)
def run_platformio_cli_run(config, verbose, *args, **kwargs): def run_platformio_cli_run(config, verbose, *args, **kwargs):

View file

@ -171,9 +171,7 @@ def format_ini(data):
def gather_lib_deps(): def gather_lib_deps():
lib_deps_l = [x.as_lib_dep for x in CORE.libraries] return [x.as_lib_dep for x in CORE.libraries]
lib_deps_l.sort()
return lib_deps_l
def gather_build_flags(): def gather_build_flags():

View file

@ -13,9 +13,9 @@ lib_deps =
AsyncTCP@1.0.3 AsyncTCP@1.0.3
AsyncMqttClient@0.8.2 AsyncMqttClient@0.8.2
ArduinoJson-esphomelib@5.13.3 ArduinoJson-esphomelib@5.13.3
ESP Async WebServer@1.1.1 ESP Async WebServer@1.2.2
FastLED@3.2.0 FastLED@3.2.9
NeoPixelBus@2.4.1 NeoPixelBus@2.5.0
ESPAsyncTCP@1.2.0 ESPAsyncTCP@1.2.0
TinyGPSPlus@1.0.2 TinyGPSPlus@1.0.2
build_flags = build_flags =

View file

@ -6,6 +6,7 @@ tornado>=5.1.1,<6
typing>=3.6.6;python_version<"3.5" typing>=3.6.6;python_version<"3.5"
protobuf>=3.7,<3.8 protobuf>=3.7,<3.8
tzlocal>=1.5.1 tzlocal>=1.5.1
pytz>=2019.1
pyserial>=3.4,<4 pyserial>=3.4,<4
ifaddr>=0.1.6,<1 ifaddr>=0.1.6,<1
platformio>=3.6.5 ; python_version<"3" platformio>=3.6.5 ; python_version<"3"

View file

@ -6,9 +6,10 @@ tornado>=5.1.1,<6
typing>=3.6.6 ; python_version<"3.5" typing>=3.6.6 ; python_version<"3.5"
protobuf>=3.7,<3.8 protobuf>=3.7,<3.8
tzlocal>=1.5.1 tzlocal>=1.5.1
pytz>=2019.1
pyserial>=3.4,<4 pyserial>=3.4,<4
ifaddr>=0.1.6,<1 ifaddr>=0.1.6,<1
platformio>=3.6.5 ; python_version<"3" platformio>=3.6.7 ; python_version<"3"
https://github.com/platformio/platformio-core/archive/develop.zip ; python_version>"3" https://github.com/platformio/platformio-core/archive/develop.zip ; python_version>"3"
esptool>=2.6,<3 esptool>=2.6,<3
pylint==1.9.4 ; python_version<"3" pylint==1.9.4 ; python_version<"3"

View file

@ -1,26 +1,35 @@
--- .piolibdeps/NeoPixelBus_ID547/src/internal/NeoEsp8266DmaMethod.h 2018-12-25 06:37:53.000000000 +0100 --- .piolibdeps/NeoPixelBus_ID547/src/internal/NeoEsp8266DmaMethod.h 2019-06-25 11:14:33.000000000 +0200
+++ .piolibdeps/NeoPixelBus_ID547/src/internal/NeoEsp8266DmaMethod.h.2 2019-03-01 22:18:10.000000000 +0100 +++ .piolibdeps/NeoPixelBus_ID547/src/internal/NeoEsp8266DmaMethod.h.2 2019-06-25 11:14:40.000000000 +0200
@@ -169,7 +169,7 @@ @@ -195,7 +195,12 @@
_i2sBufDesc[indexDesc].sub_sof = 0; _i2sBufDesc[indexDesc].sub_sof = 0;
_i2sBufDesc[indexDesc].datalen = blockSize; _i2sBufDesc[indexDesc].datalen = blockSize;
_i2sBufDesc[indexDesc].blocksize = blockSize; _i2sBufDesc[indexDesc].blocksize = blockSize;
- _i2sBufDesc[indexDesc].buf_ptr = (uint32_t)is2Buffer; - _i2sBufDesc[indexDesc].buf_ptr = (uint32_t)is2Buffer;
+ _i2sBufDesc[indexDesc].buf_ptr = is2Buffer; + union {
+ uint8_t *ptr;
+ uint32_t value;
+ } ptr;
+ ptr.ptr = is2Buffer;
+ _i2sBufDesc[indexDesc].buf_ptr = ptr.value;
_i2sBufDesc[indexDesc].unused = 0; _i2sBufDesc[indexDesc].unused = 0;
_i2sBufDesc[indexDesc].next_link_ptr = (uint32_t)&(_i2sBufDesc[indexDesc + 1]); _i2sBufDesc[indexDesc].next_link_ptr = (uint32_t)&(_i2sBufDesc[indexDesc + 1]);
@@ -329,11 +329,13 @@ @@ -361,12 +366,15 @@
case NeoDmaState_Sending: case NeoDmaState_Sending:
{ {
slc_queue_item* finished_item = (slc_queue_item*)SLCRXEDA; - slc_queue_item* finished_item = (slc_queue_item*)SLCRXEDA;
+ uint32_t **ptr = reinterpret_cast<uint32_t **>(&finished_item); -
+ uint32_t dat = *reinterpret_cast<uint32_t *>(ptr); + union {
+ slc_queue_item *ptr;
+ uint32_t value;
+ } ptr;
+ ptr.value = SLCRXEDA;
// the data block had actual data sent // the data block had actual data sent
// point last state block to first state block thus // point last state block to first state block thus
// just looping and not sending the data blocks // just looping and not sending the data blocks
- (finished_item + 1)->next_link_ptr = (uint32_t)(finished_item); - (finished_item + 1)->next_link_ptr = (uint32_t)(finished_item);
+ (finished_item + 1)->next_link_ptr = dat; + (ptr.ptr + 1)->next_link_ptr = ptr.value;
s_this->_dmaState = NeoDmaState_Idle; s_this->_dmaState = NeoDmaState_Zeroing;
} }

View file

@ -31,6 +31,7 @@ REQUIRES = [
'typing>=3.6.6;python_version<"3.5"', 'typing>=3.6.6;python_version<"3.5"',
'protobuf>=3.7,<3.8', 'protobuf>=3.7,<3.8',
'tzlocal>=1.5.1', 'tzlocal>=1.5.1',
'pytz>=2019.1',
'pyserial>=3.4,<4', 'pyserial>=3.4,<4',
'ifaddr>=0.1.6,<1', 'ifaddr>=0.1.6,<1',
] ]