From a28c879e66942276f26f9a35de81e4ba01207228 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Tue, 4 Dec 2018 20:06:43 +0100 Subject: [PATCH] Platformio debug --- esphomeyaml/platformio_api.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/esphomeyaml/platformio_api.py b/esphomeyaml/platformio_api.py index fb25f0ebfe..a388bf64c9 100644 --- a/esphomeyaml/platformio_api.py +++ b/esphomeyaml/platformio_api.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import json import logging import re @@ -10,9 +12,28 @@ _LOGGER = logging.getLogger(__name__) def run_platformio_cli(*args, **kwargs): + cmd = ['platformio'] + list(args) + try: + import click + + # pylint: disable=protected-access + print("ON Windows: {}".format(click._compat.WIN)) + + def strip_ansi(x): + print("strip_ansi({})".format(x)) + + click._compat.strip_ansi = lambda x: x + + def should_strip_ansi(stream=None, color=None): + print("should_strip_ansi({}, {})".format(stream, color)) + return False + + click._compat.should_strip_ansi = lambda x: False + except Exception as e: # pylint: disable=broad-except + print("Error: {}".format(e)) + import platformio.__main__ - cmd = ['platformio'] + list(args) return run_external_command(platformio.__main__.main, *cmd, **kwargs)