1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-06 05:12:21 +01:00

Allow setting URL as platform_version (#2598)

This commit is contained in:
Oxan van Leeuwen
2021-10-26 10:55:09 +02:00
committed by GitHub
parent 81c11ba1f7
commit 87328686a0
3 changed files with 53 additions and 20 deletions

View File

@@ -1668,6 +1668,25 @@ def version_number(value):
raise Invalid("Not a version number") from e
def platformio_version_constraint(value):
# for documentation on valid version constraints:
# https://docs.platformio.org/en/latest/core/userguide/platforms/cmd_install.html#cmd-platform-install
value = string_strict(value)
constraints = []
for item in value.split(","):
# find and strip prefix operator
op = None
for test_op in ("^", "~", ">=", ">", "<=", "<", "!="):
if item.startswith(test_op):
op = test_op
item = item[len(test_op) :]
break
constraints.append((op, version_number(item)))
return constraints
def require_framework_version(
*,
esp_idf=None,