External components: optional configurable path for git source (#6677)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Tomek Wasilczyk 2024-05-05 20:19:13 -07:00 committed by GitHub
parent 599dbf27e0
commit f2caaf85c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -49,7 +49,16 @@ def _process_git_config(config: dict, refresh) -> str:
password=config.get(CONF_PASSWORD),
)
if (repo_dir / "esphome" / "components").is_dir():
if path := config.get(CONF_PATH):
if (repo_dir / path).is_dir():
components_dir = repo_dir / path
else:
raise cv.Invalid(
"Could not find components folder for source. Please check the source contains a '"
+ path
+ "' folder"
)
elif (repo_dir / "esphome" / "components").is_dir():
components_dir = repo_dir / "esphome" / "components"
elif (repo_dir / "components").is_dir():
components_dir = repo_dir / "components"

View File

@ -2124,6 +2124,7 @@ GIT_SCHEMA = Schema(
Optional(CONF_REF): git_ref,
Optional(CONF_USERNAME): string,
Optional(CONF_PASSWORD): string,
Optional(CONF_PATH): string,
}
)
LOCAL_SCHEMA = Schema(