mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 15:18:16 +00:00
Fix platformio4 moved get_project_dir
This commit is contained in:
parent
b9f1475afc
commit
b58366c07c
@ -127,7 +127,10 @@ def wrap_to_code(name, comp):
|
|||||||
def wrapped(conf):
|
def wrapped(conf):
|
||||||
cg.add(cg.LineComment(u"{}:".format(name)))
|
cg.add(cg.LineComment(u"{}:".format(name)))
|
||||||
if comp.config_schema is not None:
|
if comp.config_schema is not None:
|
||||||
cg.add(cg.LineComment(indent(yaml_util.dump(conf).decode('utf-8'))))
|
conf_str = yaml_util.dump(conf)
|
||||||
|
if IS_PY2:
|
||||||
|
conf_str = conf_str.decode('utf-8')
|
||||||
|
cg.add(cg.LineComment(indent(conf_str)))
|
||||||
yield coro(conf)
|
yield coro(conf)
|
||||||
|
|
||||||
return wrapped
|
return wrapped
|
||||||
|
@ -19,12 +19,16 @@ def patch_structhash():
|
|||||||
# all issues
|
# all issues
|
||||||
from platformio.commands import run
|
from platformio.commands import run
|
||||||
from platformio import util
|
from platformio import util
|
||||||
|
try:
|
||||||
|
from platformio.util import get_project_dir
|
||||||
|
except ImportError:
|
||||||
|
from platformio.project.helpers import get_project_dir
|
||||||
from os.path import join, isdir, getmtime, isfile
|
from os.path import join, isdir, getmtime, isfile
|
||||||
from os import makedirs
|
from os import makedirs
|
||||||
|
|
||||||
def patched_clean_build_dir(build_dir):
|
def patched_clean_build_dir(build_dir):
|
||||||
structhash_file = join(build_dir, "structure.hash")
|
structhash_file = join(build_dir, "structure.hash")
|
||||||
platformio_ini = join(util.get_project_dir(), "platformio.ini")
|
platformio_ini = join(get_project_dir(), "platformio.ini")
|
||||||
|
|
||||||
# if project's config is modified
|
# if project's config is modified
|
||||||
if isdir(build_dir) and getmtime(platformio_ini) > getmtime(build_dir):
|
if isdir(build_dir) and getmtime(platformio_ini) > getmtime(build_dir):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user