19 lines
554 B
Python
19 lines
554 B
Python
from typing import Tuple
|
|
|
|
|
|
def parse_version(value: str) -> Tuple[int, int, int]:
|
|
parts = value.strip().lstrip("v").split(".")
|
|
nums = [int(part) if part.isdigit() else 0 for part in parts[:3]]
|
|
while len(nums) < 3:
|
|
nums.append(0)
|
|
return nums[0], nums[1], nums[2]
|
|
|
|
|
|
def is_compatible(core: str, minimum: str, maximum: str = "") -> bool:
|
|
core_v = parse_version(core)
|
|
if minimum and core_v < parse_version(minimum):
|
|
return False
|
|
if maximum and core_v > parse_version(maximum):
|
|
return False
|
|
return True
|