Merge pull request #56225 from dotlambda/esphome-1.11.0
esphome: 1.10.1 -> 1.11.1
This commit is contained in:
commit
6e5a66f09f
@ -7,24 +7,18 @@
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
version = "0.1.4";
|
||||
version = "0.1.6";
|
||||
pname = "ifaddr";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
extension = "zip";
|
||||
sha256 = "cf2a8fbb578da2844d999a0a453825f660ed2d3fc47dcffc5f673dd8de4f0f8b";
|
||||
sha256 = "c19c64882a7ad51a394451dabcbbed72e98b5625ec1e79789924d5ea3e3ecb93";
|
||||
};
|
||||
|
||||
# ipaddress is provided in python stdlib > 3.3
|
||||
postPatch = if pythonOlder "3.4" then "" else ''
|
||||
sed -i "s/'ipaddress'//" setup.py
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [ ipaddress ];
|
||||
|
||||
checkPhase = ''
|
||||
${python.interpreter} ifaddr/test_ifaddr.py
|
||||
${python.interpreter} -m unittest discover
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
|
@ -1,119 +0,0 @@
|
||||
diff --git a/esphomeyaml/__main__.py b/esphomeyaml/__main__.py
|
||||
index 26f42c1..529d2e0 100644
|
||||
--- a/esphomeyaml/__main__.py
|
||||
+++ b/esphomeyaml/__main__.py
|
||||
@@ -167,13 +167,10 @@ def compile_program(args, config):
|
||||
|
||||
|
||||
def upload_using_esptool(config, port):
|
||||
- import esptool
|
||||
-
|
||||
path = os.path.join(CORE.build_path, '.pioenvs', CORE.name, 'firmware.bin')
|
||||
- cmd = ['esptool.py', '--before', 'default_reset', '--after', 'hard_reset',
|
||||
+ cmd = ['@esptool@/bin/esptool.py', '--before', 'default_reset', '--after', 'hard_reset',
|
||||
'--chip', 'esp8266', '--port', port, 'write_flash', '0x0', path]
|
||||
- # pylint: disable=protected-access
|
||||
- return run_external_command(esptool._main, *cmd)
|
||||
+ return run_external_command(*cmd)
|
||||
|
||||
|
||||
def upload_program(config, args, host):
|
||||
diff --git a/esphomeyaml/platformio_api.py b/esphomeyaml/platformio_api.py
|
||||
index df29491..f991701 100644
|
||||
--- a/esphomeyaml/platformio_api.py
|
||||
+++ b/esphomeyaml/platformio_api.py
|
||||
@@ -13,12 +13,9 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def run_platformio_cli(*args, **kwargs):
|
||||
- import platformio.__main__
|
||||
-
|
||||
os.environ["PLATFORMIO_FORCE_COLOR"] = "true"
|
||||
- cmd = ['platformio'] + list(args)
|
||||
- return run_external_command(platformio.__main__.main,
|
||||
- *cmd, **kwargs)
|
||||
+ cmd = ['@platformio@/bin/platformio'] + list(args)
|
||||
+ return run_external_command(*cmd, **kwargs)
|
||||
|
||||
|
||||
def run_platformio_cli_run(config, verbose, *args, **kwargs):
|
||||
diff --git a/esphomeyaml/util.py b/esphomeyaml/util.py
|
||||
index eebb4b7..9e9e58f 100644
|
||||
--- a/esphomeyaml/util.py
|
||||
+++ b/esphomeyaml/util.py
|
||||
@@ -4,6 +4,7 @@ import io
|
||||
import logging
|
||||
import re
|
||||
import sys
|
||||
+import subprocess
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -79,42 +80,25 @@ class RedirectText(object):
|
||||
return True
|
||||
|
||||
|
||||
-def run_external_command(func, *cmd, **kwargs):
|
||||
- def mock_exit(return_code):
|
||||
- raise SystemExit(return_code)
|
||||
-
|
||||
- orig_argv = sys.argv
|
||||
- orig_exit = sys.exit # mock sys.exit
|
||||
+def run_external_command(*cmd, **kwargs):
|
||||
full_cmd = u' '.join(shlex_quote(x) for x in cmd)
|
||||
_LOGGER.info(u"Running: %s", full_cmd)
|
||||
|
||||
- orig_stdout = sys.stdout
|
||||
- sys.stdout = RedirectText(sys.stdout)
|
||||
- orig_stderr = sys.stderr
|
||||
- sys.stderr = RedirectText(sys.stderr)
|
||||
-
|
||||
capture_stdout = kwargs.get('capture_stdout', False)
|
||||
if capture_stdout:
|
||||
- cap_stdout = sys.stdout = io.BytesIO()
|
||||
+ cap_stdout = io.BytesIO()
|
||||
+ else:
|
||||
+ cap_stdout = sys.stdout
|
||||
|
||||
try:
|
||||
- sys.argv = list(cmd)
|
||||
- sys.exit = mock_exit
|
||||
- return func() or 0
|
||||
- except KeyboardInterrupt:
|
||||
- return 1
|
||||
- except SystemExit as err:
|
||||
- return err.args[0]
|
||||
+ completed_process = subprocess.run(cmd,
|
||||
+ stdout=RedirectText(cap_stdout),
|
||||
+ stderr=RedirectText(sys.stderr))
|
||||
+ return completed_process.returncode
|
||||
except Exception as err: # pylint: disable=broad-except
|
||||
_LOGGER.error(u"Running command failed: %s", err)
|
||||
_LOGGER.error(u"Please try running %s locally.", full_cmd)
|
||||
finally:
|
||||
- sys.argv = orig_argv
|
||||
- sys.exit = orig_exit
|
||||
-
|
||||
- sys.stdout = orig_stdout
|
||||
- sys.stderr = orig_stderr
|
||||
-
|
||||
if capture_stdout:
|
||||
# pylint: disable=lost-exception
|
||||
return cap_stdout.getvalue()
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 78a5378..8ce80de 100755
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -23,12 +23,10 @@ DOWNLOAD_URL = '{}/archive/{}.zip'.format(GITHUB_URL, const.__version__)
|
||||
|
||||
REQUIRES = [
|
||||
'voluptuous>=0.11.1',
|
||||
- 'platformio>=3.5.3',
|
||||
'pyyaml>=3.12',
|
||||
'paho-mqtt>=1.3.1',
|
||||
'colorlog>=3.1.2',
|
||||
'tornado>=5.0.0',
|
||||
- 'esptool>=2.3.1',
|
||||
'typing>=3.0.0',
|
||||
'protobuf>=3.4',
|
||||
'tzlocal>=1.4',
|
@ -1,29 +1,27 @@
|
||||
{ lib, python3, fetchpatch, substituteAll, platformio, esptool }:
|
||||
{ lib, python3, fetchpatch, platformio, esptool, git }:
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "esphomeyaml";
|
||||
version = "1.10.1";
|
||||
pname = "esphome";
|
||||
version = "1.11.1";
|
||||
|
||||
src = python3.pkgs.fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "426cd545b4e9505ce5b4f5c63d2d54cb038f93fe3ba9d4d56b6b6431b222485d";
|
||||
sha256 = "1764q4wyl8qlk2514gikv8178c8fwhhvbw64zkd76nb107hxzrk5";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./dont-import-platformio-esptool.patch;
|
||||
inherit platformio esptool;
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# typing is part of the standard library since Python 3.5
|
||||
substituteInPlace setup.py --replace "'typing>=3.0.0'," ""
|
||||
'';
|
||||
ESPHOME_USE_SUBPROCESS = "";
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
voluptuous pyyaml paho-mqtt colorlog
|
||||
tornado protobuf tzlocal pyserial
|
||||
tornado protobuf tzlocal pyserial ifaddr
|
||||
];
|
||||
|
||||
makeWrapperArgs = [
|
||||
# platformio is used in esphomeyaml/platformio_api.py
|
||||
# esptool is used in esphomeyaml/__main__.py
|
||||
# git is used in esphomeyaml/writer.py
|
||||
"--prefix PATH : ${lib.makeBinPath [ platformio esptool git ]}"
|
||||
"--set ESPHOME_USE_SUBPROCESS ''"
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
@ -36,7 +34,7 @@ python3.pkgs.buildPythonApplication rec {
|
||||
|
||||
meta = with lib; {
|
||||
description = "Make creating custom firmwares for ESP32/ESP8266 super easy";
|
||||
homepage = https://esphomelib.com/esphomeyaml;
|
||||
homepage = https://esphome.io/;
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ dotlambda ];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user