Support for Python 3 (#702)

* Support for Python 3

* Add later Python releases

* Remove Python 3.6

* Re-enable Python 2.7

* Remove platformio-core zip archive

* Re-enable Python 2.7

* Fixes for python 3

Co-Authored-By: C W <fake-name@users.noreply.github.com>
This commit is contained in:
Fabian Affolter 2019-10-18 20:21:16 +05:30 committed by Otto Winter
parent 1bf55c130b
commit 7a43231c43
3 changed files with 13 additions and 5 deletions

View file

@ -1,6 +1,6 @@
sudo: false sudo: false
language: python language: python
python: '2.7' python: '3.5'
install: script/setup install: script/setup
cache: cache:
directories: directories:
@ -9,8 +9,8 @@ cache:
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- python: "2.7" - python: "3.7"
env: TARGET=Lint2.7 env: TARGET=Lint3.7
script: script:
- script/ci-custom.py - script/ci-custom.py
- flake8 esphome - flake8 esphome
@ -21,6 +21,12 @@ matrix:
- script/ci-custom.py - script/ci-custom.py
- flake8 esphome - flake8 esphome
- pylint esphome - pylint esphome
- python: "3.5"
env: TARGET=Test3.5
script:
- esphome tests/test1.yaml compile
- esphome tests/test2.yaml compile
- esphome tests/test3.yaml compile
- python: "2.7" - python: "2.7"
env: TARGET=Test2.7 env: TARGET=Test2.7
script: script:

View file

@ -7,6 +7,7 @@ import re
import subprocess import subprocess
from esphome.core import CORE from esphome.core import CORE
from esphome.py_compat import text_type, decode_text
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__)
@ -72,6 +73,7 @@ def run_upload(config, verbose, port):
def run_idedata(config): def run_idedata(config):
args = ['-t', 'idedata'] args = ['-t', 'idedata']
stdout = run_platformio_cli_run(config, False, *args, capture_stdout=True) stdout = run_platformio_cli_run(config, False, *args, capture_stdout=True)
stdout = decode_text(stdout)
match = re.search(r'{.*}', stdout) match = re.search(r'{.*}', stdout)
if match is None: if match is None:
return IDEData(None) return IDEData(None)

View file

@ -9,7 +9,7 @@ import subprocess
import sys import sys
from esphome import const from esphome import const
from esphome.py_compat import IS_PY2 from esphome.py_compat import IS_PY2, IS_PY3
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -127,7 +127,7 @@ def run_external_command(func, *cmd, **kwargs):
capture_stdout = kwargs.get('capture_stdout', False) capture_stdout = kwargs.get('capture_stdout', False)
if capture_stdout: if capture_stdout:
cap_stdout = sys.stdout = io.BytesIO() cap_stdout = sys.stdout = io.StringIO()
try: try:
sys.argv = list(cmd) sys.argv = list(cmd)