libretiny: Allow specifying version of explicitly imported sources (#7408)

This commit is contained in:
David Woodhouse 2024-09-09 06:05:09 +01:00 committed by GitHub
parent 9722876ef6
commit 32995a352b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,10 +1,6 @@
import json
import logging
from os.path import (
dirname,
isfile,
join,
)
from os.path import dirname, isfile, join
import esphome.codegen as cg
import esphome.config_validation as cv
@ -282,10 +278,10 @@ async def component_to_code(config):
# if platform version is a valid version constraint, prefix the default package
framework = config[CONF_FRAMEWORK]
cv.platformio_version_constraint(framework[CONF_VERSION])
if str(framework[CONF_VERSION]) != "0.0.0":
cg.add_platformio_option("platform", f"libretiny @ {framework[CONF_VERSION]}")
elif framework[CONF_SOURCE]:
if framework[CONF_SOURCE]:
cg.add_platformio_option("platform", framework[CONF_SOURCE])
elif str(framework[CONF_VERSION]) != "0.0.0":
cg.add_platformio_option("platform", f"libretiny @ {framework[CONF_VERSION]}")
else:
cg.add_platformio_option("platform", "libretiny")