This commit is contained in:
Otto Winter 2018-09-28 19:58:35 +02:00
parent 094bf9844c
commit 02ee0f514a
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E
3 changed files with 10 additions and 7 deletions

View file

@ -213,7 +213,8 @@ def update_esphomelib_repo(config):
build_path = relative_path(config[CONF_BUILD_PATH]) build_path = relative_path(config[CONF_BUILD_PATH])
esphomelib_path = os.path.join(build_path, '.piolibdeps', 'esphomelib') esphomelib_path = os.path.join(build_path, '.piolibdeps', 'esphomelib')
is_default_branch = all(x not in esphomelib_version for x in (CONF_BRANCH, CONF_TAG, CONF_COMMIT)) is_default_branch = all(x not in esphomelib_version
for x in (CONF_BRANCH, CONF_TAG, CONF_COMMIT))
if not (CONF_BRANCH in esphomelib_version or is_default_branch): if not (CONF_BRANCH in esphomelib_version or is_default_branch):
# Git commit hash or tag cannot be updated # Git commit hash or tag cannot be updated
return return

View file

@ -9,10 +9,11 @@ import os
import random import random
import subprocess import subprocess
from esphomeyaml.const import CONF_ESPHOMEYAML, CONF_BUILD_PATH
from esphomeyaml.core import ESPHomeYAMLError from esphomeyaml.core import ESPHomeYAMLError
from esphomeyaml import const, core, __main__ from esphomeyaml import const, core, __main__
from esphomeyaml.__main__ import get_serial_ports, get_base_path, get_name from esphomeyaml.__main__ import get_serial_ports
from esphomeyaml.helpers import quote from esphomeyaml.helpers import quote, relative_path
try: try:
import tornado import tornado
@ -161,10 +162,10 @@ class DownloadBinaryRequestHandler(BaseHandler):
config_file = os.path.join(CONFIG_DIR, configuration) config_file = os.path.join(CONFIG_DIR, configuration)
core.CONFIG_PATH = config_file core.CONFIG_PATH = config_file
config = __main__.read_config(core.CONFIG_PATH) config = __main__.read_config(core.CONFIG_PATH)
name = get_name(config) build_path = relative_path(config[CONF_ESPHOMEYAML][CONF_BUILD_PATH])
path = os.path.join(get_base_path(config), '.pioenvs', name, 'firmware.bin') path = os.path.join(build_path, '.pioenvs', core.NAME, 'firmware.bin')
self.set_header('Content-Type', 'application/octet-stream') self.set_header('Content-Type', 'application/octet-stream')
self.set_header("Content-Disposition", 'attachment; filename="{}.bin"'.format(name)) self.set_header("Content-Disposition", 'attachment; filename="{}.bin"'.format(core.NAME))
with open(path, 'rb') as f: with open(path, 'rb') as f:
while 1: while 1:
data = f.read(16384) # or some other nice-sized chunk data = f.read(16384) # or some other nice-sized chunk

View file

@ -112,7 +112,8 @@ def get_ini_content(config, path):
lib_path = os.path.join(path, 'lib') lib_path = os.path.join(path, 'lib')
dst_path = os.path.join(lib_path, 'esphomelib') dst_path = os.path.join(lib_path, 'esphomelib')
if CONF_REPOSITORY in lib_version: if CONF_REPOSITORY in lib_version:
tag = next((lib_version[x] for x in (CONF_COMMIT, CONF_BRANCH, CONF_TAG) if x in lib_version), None) tag = next((lib_version[x] for x in (CONF_COMMIT, CONF_BRANCH, CONF_TAG)
if x in lib_version), None)
if tag is None: if tag is None:
lib_deps.add(lib_version[CONF_REPOSITORY]) lib_deps.add(lib_version[CONF_REPOSITORY])
else: else: