Fix waveshare 7.5in model (#576)

* Fix waveshare 7.5in model

Fixes https://github.com/esphome/issues/issues/357

* Fix platformio travis errors
This commit is contained in:
Otto Winter 2019-05-30 22:27:51 +02:00 committed by GitHub
parent 9eba789c32
commit 925b030718
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -24,7 +24,7 @@ MODELS = {
'2.90in': ('a', WaveshareEPaperTypeAModel.WAVESHARE_EPAPER_2_9_IN),
'2.70in': ('b', WaveshareEPaper2P7In),
'4.20in': ('b', WaveshareEPaper4P2In),
'7.50in': ('b', WaveshareEPaperTypeBModel),
'7.50in': ('b', WaveshareEPaper7P5In),
}

View file

@ -7,6 +7,7 @@ import re
import subprocess
from esphome.core import CORE
from esphome.py_compat import IS_PY2
from esphome.util import run_external_command, run_external_process
_LOGGER = logging.getLogger(__name__)
@ -17,12 +18,10 @@ def patch_structhash():
# removed/added. This might have unintended consequences, but this improves compile
# times greatly when adding/removing components and a simple clean build solves
# all issues
# pylint: disable=no-member,no-name-in-module
from platformio.commands import run
from platformio import util
try:
from platformio.util import get_project_dir
except ImportError:
from platformio.project.helpers import get_project_dir
from platformio.util import get_project_dir
from os.path import join, isdir, getmtime, isfile
from os import makedirs
@ -69,7 +68,8 @@ def run_platformio_cli(*args, **kwargs):
if os.environ.get('ESPHOME_USE_SUBPROCESS') is None:
import platformio.__main__
try:
patch_structhash()
if IS_PY2:
patch_structhash()
except Exception: # pylint: disable=broad-except
# Ignore when patch fails
pass