mirror of
https://github.com/esphome/esphome.git
synced 2025-09-06 05:12:21 +01:00
Implement external custom components installing from YAML (#1630)
* Move components import loading to importlib MetaPathFinder and importlib.resources * Add external_components component * Fix * Fix * fix cv.url return * fix validate shorthand git * implement git refresh * Use finders from sys.path_hooks instead of looking for __init__.py * use github:// schema * error handling * add test * fix handling git output * revert file check handling * fix test * allow full component path be specified for local * fix test * fix path handling * lint Co-authored-by: Guillermo Ruffino <glm.net@gmail.com>
This commit is contained in:
@@ -1556,3 +1556,17 @@ def polling_component_schema(default_update_interval):
|
||||
): update_interval,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def url(value):
|
||||
import urllib.parse
|
||||
|
||||
value = string_strict(value)
|
||||
try:
|
||||
parsed = urllib.parse.urlparse(value)
|
||||
except ValueError as e:
|
||||
raise Invalid("Not a valid URL") from e
|
||||
|
||||
if not parsed.scheme or not parsed.netloc:
|
||||
raise Invalid("Expected a URL scheme and host")
|
||||
return parsed.geturl()
|
||||
|
Reference in New Issue
Block a user