From 44db018d4ffb3aa45bdfa7bf099d4dc9cdb91ff8 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Sun, 25 Nov 2018 20:46:41 +0100 Subject: [PATCH] Download Efficiency --- .gitlab-ci.yml | 2 ++ esphomeyaml/core_config.py | 1 + esphomeyaml/wizard.py | 2 +- esphomeyaml/writer.py | 10 ++++++---- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0b2b94f43d..243ad32fbe 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,8 @@ stages: .lint: &lint stage: lint + before_script: + - pip install -e . tags: - python2.7 - esphomeyaml-lint diff --git a/esphomeyaml/core_config.py b/esphomeyaml/core_config.py index 757e4315a0..f0979f0d82 100644 --- a/esphomeyaml/core_config.py +++ b/esphomeyaml/core_config.py @@ -19,6 +19,7 @@ from esphomeyaml.cpp_types import App, NoArg, const_char_ptr, esphomelib_ns _LOGGER = logging.getLogger(__name__) LIBRARY_URI_REPO = u'https://github.com/OttoWinter/esphomelib.git' +GITHUB_ARCHIVE_ZIP = u'https://github.com/OttoWinter/esphomelib/archive/{}.zip' BUILD_FLASH_MODES = ['qio', 'qout', 'dio', 'dout'] StartupTrigger = esphomelib_ns.StartupTrigger diff --git a/esphomeyaml/wizard.py b/esphomeyaml/wizard.py index b20db2a663..995f8a9490 100644 --- a/esphomeyaml/wizard.py +++ b/esphomeyaml/wizard.py @@ -86,7 +86,7 @@ def wizard_write(path, **kwargs): name = kwargs['name'] board = kwargs['board'] if 'platform' not in kwargs: - kwargs['platform'] = 'ESP8266' if board in ESP32_BOARD_PINS else 'ESP32' + kwargs['platform'] = 'ESP8266' if board in ESP8266_BOARD_PINS else 'ESP32' platform = kwargs['platform'] with codecs.open(path, 'w') as f_handle: diff --git a/esphomeyaml/writer.py b/esphomeyaml/writer.py index 17f7a89df2..e68d3d50ec 100644 --- a/esphomeyaml/writer.py +++ b/esphomeyaml/writer.py @@ -12,7 +12,7 @@ from esphomeyaml.const import ARDUINO_VERSION_ESP32_DEV, CONF_ARDUINO_VERSION, \ CONF_BOARD_FLASH_MODE, CONF_BRANCH, CONF_COMMIT, CONF_ESPHOMELIB_VERSION, CONF_ESPHOMEYAML, \ CONF_LOCAL, CONF_REPOSITORY, CONF_TAG, CONF_USE_CUSTOM_CODE from esphomeyaml.core import CORE, EsphomeyamlError -from esphomeyaml.core_config import VERSION_REGEX +from esphomeyaml.core_config import VERSION_REGEX, LIBRARY_URI_REPO, GITHUB_ARCHIVE_ZIP from esphomeyaml.helpers import mkdir_p, run_system_command from esphomeyaml.storage_json import StorageJSON, storage_path from esphomeyaml.util import safe_print @@ -222,11 +222,13 @@ def gather_lib_deps(): lib_deps = set() esphomelib_version = CORE.config[CONF_ESPHOMEYAML][CONF_ESPHOMELIB_VERSION] if CONF_REPOSITORY in esphomelib_version: + repo = esphomelib_version[CONF_REPOSITORY] ref = next((esphomelib_version[x] for x in (CONF_COMMIT, CONF_BRANCH, CONF_TAG) if x in esphomelib_version), None) - this_version = esphomelib_version[CONF_REPOSITORY] - if ref is not None: - this_version += '#' + ref + if CONF_TAG in esphomelib_version and repo == LIBRARY_URI_REPO: + this_version = GITHUB_ARCHIVE_ZIP.format(ref) + elif ref is not None: + this_version = repo + '#' + ref lib_deps.add(this_version) elif CORE.is_local_esphomelib_copy: src_path = CORE.relative_path(esphomelib_version[CONF_LOCAL])