diff --git a/esphomeyaml/core_config.py b/esphomeyaml/core_config.py index ccf9323a46..7700e075c6 100644 --- a/esphomeyaml/core_config.py +++ b/esphomeyaml/core_config.py @@ -213,7 +213,8 @@ def update_esphomelib_repo(config): build_path = relative_path(config[CONF_BUILD_PATH]) 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): # Git commit hash or tag cannot be updated return diff --git a/esphomeyaml/dashboard/dashboard.py b/esphomeyaml/dashboard/dashboard.py index 63550693af..4cec13496a 100644 --- a/esphomeyaml/dashboard/dashboard.py +++ b/esphomeyaml/dashboard/dashboard.py @@ -9,10 +9,11 @@ import os import random import subprocess +from esphomeyaml.const import CONF_ESPHOMEYAML, CONF_BUILD_PATH from esphomeyaml.core import ESPHomeYAMLError from esphomeyaml import const, core, __main__ -from esphomeyaml.__main__ import get_serial_ports, get_base_path, get_name -from esphomeyaml.helpers import quote +from esphomeyaml.__main__ import get_serial_ports +from esphomeyaml.helpers import quote, relative_path try: import tornado @@ -161,10 +162,10 @@ class DownloadBinaryRequestHandler(BaseHandler): config_file = os.path.join(CONFIG_DIR, configuration) core.CONFIG_PATH = config_file config = __main__.read_config(core.CONFIG_PATH) - name = get_name(config) - path = os.path.join(get_base_path(config), '.pioenvs', name, 'firmware.bin') + build_path = relative_path(config[CONF_ESPHOMEYAML][CONF_BUILD_PATH]) + path = os.path.join(build_path, '.pioenvs', core.NAME, 'firmware.bin') 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: while 1: data = f.read(16384) # or some other nice-sized chunk diff --git a/esphomeyaml/writer.py b/esphomeyaml/writer.py index 1f16ae49af..d17beff27f 100644 --- a/esphomeyaml/writer.py +++ b/esphomeyaml/writer.py @@ -112,7 +112,8 @@ def get_ini_content(config, path): lib_path = os.path.join(path, 'lib') dst_path = os.path.join(lib_path, 'esphomelib') 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: lib_deps.add(lib_version[CONF_REPOSITORY]) else: