def validate_local_esphome_core_version(value): value = cv.directory(value) path = CORE.relative_path(value) library_json = os.path.join(path, 'library.json') if not os.path.exists(library_json): raise vol.Invalid( u"Could not find '{}' file. '{}' does not seem to point to an " u"esphome-core copy.".format(library_json, value)) return value
def valid_include(value): try: return cv.directory(value) except cv.Invalid: pass value = cv.file_(value) _, ext = os.path.splitext(value) if ext not in VALID_INCLUDE_EXTS: raise cv.Invalid("Include has invalid file extension {} - valid extensions are {}" "".format(ext, ', '.join(VALID_INCLUDE_EXTS))) return value