mirror of
https://github.com/esphome/esphome.git
synced 2026-05-25 02:16:13 +08:00
[core] Support both dot and dash separators in Version.parse (#14858)
This commit is contained in:
@@ -314,7 +314,7 @@ class Version:
|
||||
|
||||
@classmethod
|
||||
def parse(cls, value: str) -> Version:
|
||||
match = re.match(r"^(\d+).(\d+).(\d+)-?(\w*)$", value)
|
||||
match = re.match(r"^(\d+).(\d+).(\d+)[-.]?(\w*)$", value)
|
||||
if match is None:
|
||||
raise ValueError(f"Not a valid version number {value}")
|
||||
major = int(match[1])
|
||||
|
||||
Reference in New Issue
Block a user