diff --git a/Dockerfile b/Dockerfile index 04dcc81eee..b820144a0a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,8 @@ RUN platformio settings set enable_telemetry No && \ platformio run -e espressif32 -e espressif8266; exit 0 COPY . . -RUN pip install -e . +RUN pip install -e . && \ + pip install pillow tzlocal WORKDIR /config ENTRYPOINT ["esphomeyaml"] diff --git a/docker/Dockerfile.builder b/docker/Dockerfile.builder index 9fb7ad3604..d8148da3bd 100644 --- a/docker/Dockerfile.builder +++ b/docker/Dockerfile.builder @@ -27,6 +27,6 @@ RUN apt-get update && apt-get install -y \ binfmt-support \ && rm -rf /var/lib/apt/lists/* -COPY hassio-builder.sh /usr/bin/ +COPY docker/hassio-builder.sh /usr/bin/ WORKDIR /data diff --git a/docker/Dockerfile.lint b/docker/Dockerfile.lint index 6be70d8200..ada69b892b 100644 --- a/docker/Dockerfile.lint +++ b/docker/Dockerfile.lint @@ -1,4 +1,6 @@ FROM python:2.7 -RUN pip install -r requirements.txt && \ - pip install flake8==3.5.0 pylint==1.8.4 +COPY requirements.txt /requirements.txt + +RUN pip install -r /requirements.txt && \ + pip install flake8==3.5.0 pylint==1.8.4 tzlocal pillow diff --git a/esphomeyaml/components/font.py b/esphomeyaml/components/font.py index 98f0492d95..a40a3113e5 100644 --- a/esphomeyaml/components/font.py +++ b/esphomeyaml/components/font.py @@ -46,7 +46,7 @@ def validate_pillow_installed(value): try: import PIL except ImportError: - raise vol.Invalid("Please install the pillow python package to use fonts. " + raise vol.Invalid("Please install the pillow python package to use this feature. " "(pip2 install pillow)") if PIL.__version__[0] < '4': @@ -103,7 +103,7 @@ def to_code(config): _, (offset_x, offset_y) = font.font.getsize(glyph) width, height = mask.size width8 = ((width + 7) // 8) * 8 - glyph_data = [0 for _ in range(height * width8 // 8)] + glyph_data = [0 for _ in range(height * width8 // 8)] # noqa: F812 for y in range(height): for x in range(width): if not mask.getpixel((x, y)): diff --git a/esphomeyaml/components/image.py b/esphomeyaml/components/image.py index 7b1556ba86..6fd8dbedaa 100644 --- a/esphomeyaml/components/image.py +++ b/esphomeyaml/components/image.py @@ -6,7 +6,7 @@ import voluptuous as vol import esphomeyaml.config_validation as cv from esphomeyaml import core -from esphomeyaml.components import display +from esphomeyaml.components import display, font from esphomeyaml.const import CONF_FILE, CONF_ID, CONF_RESIZE from esphomeyaml.core import HexInt from esphomeyaml.helpers import App, ArrayInitializer, MockObj, Pvariable, RawExpression, add @@ -18,17 +18,6 @@ DEPENDENCIES = ['display'] Image_ = display.display_ns.Image -def validate_pillow_installed(value): - try: - # pylint: disable=unused-variable - import PIL - except ImportError: - raise vol.Invalid("Please install the pillow python package to use images. " - "(pip2 install pillow)") - - return value - - def validate_image_file(value): value = cv.string(value) path = os.path.join(os.path.dirname(core.CONFIG_PATH), value) @@ -39,14 +28,14 @@ def validate_image_file(value): CONF_RAW_DATA_ID = 'raw_data_id' -FONT_SCHEMA = vol.Schema({ +IMAGE_SCHEMA = vol.Schema({ vol.Required(CONF_ID): cv.declare_variable_id(Image_), vol.Required(CONF_FILE): validate_image_file, vol.Optional(CONF_RESIZE): cv.dimensions, cv.GenerateID(CONF_RAW_DATA_ID): cv.declare_variable_id(None), }) -CONFIG_SCHEMA = vol.All(validate_pillow_installed, cv.ensure_list, [FONT_SCHEMA]) +CONFIG_SCHEMA = vol.All(font.validate_pillow_installed, cv.ensure_list, [IMAGE_SCHEMA]) def to_code(config):