Packages: optional base path for remote git packages (#9279)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Sergey Dudanov 2025-07-03 11:11:40 +04:00 committed by GitHub
parent 34db02661c
commit b2b6f41ef3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View File

@ -63,6 +63,7 @@ BASE_SCHEMA = cv.All(
cv.Schema( cv.Schema(
{ {
cv.Required(CONF_URL): cv.url, cv.Required(CONF_URL): cv.url,
cv.Optional(CONF_PATH): cv.string,
cv.Optional(CONF_USERNAME): cv.string, cv.Optional(CONF_USERNAME): cv.string,
cv.Optional(CONF_PASSWORD): cv.string, cv.Optional(CONF_PASSWORD): cv.string,
cv.Exclusive(CONF_FILE, CONF_FILES): validate_yaml_filename, cv.Exclusive(CONF_FILE, CONF_FILES): validate_yaml_filename,
@ -116,6 +117,9 @@ def _process_base_package(config: dict) -> dict:
) )
files = [] files = []
if base_path := config.get(CONF_PATH):
repo_dir = repo_dir / base_path
for file in config[CONF_FILES]: for file in config[CONF_FILES]:
if isinstance(file, str): if isinstance(file, str):
files.append({CONF_PATH: file, CONF_VARS: {}}) files.append({CONF_PATH: file, CONF_VARS: {}})

View File

@ -5,7 +5,8 @@ packages:
- !include package.yaml - !include package.yaml
- github://esphome/esphome/tests/components/template/common.yaml@dev - github://esphome/esphome/tests/components/template/common.yaml@dev
- url: https://github.com/esphome/esphome - url: https://github.com/esphome/esphome
file: tests/components/absolute_humidity/common.yaml path: tests/components/absolute_humidity
file: common.yaml
ref: dev ref: dev
refresh: 1d refresh: 1d

View File

@ -7,7 +7,8 @@ packages:
shorthand: github://esphome/esphome/tests/components/template/common.yaml@dev shorthand: github://esphome/esphome/tests/components/template/common.yaml@dev
github: github:
url: https://github.com/esphome/esphome url: https://github.com/esphome/esphome
file: tests/components/absolute_humidity/common.yaml path: tests/components/absolute_humidity
file: common.yaml
ref: dev ref: dev
refresh: 1d refresh: 1d