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 json
import logging import logging
from os.path import ( from os.path import dirname, isfile, join
dirname,
isfile,
join,
)
import esphome.codegen as cg import esphome.codegen as cg
import esphome.config_validation as cv 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 # if platform version is a valid version constraint, prefix the default package
framework = config[CONF_FRAMEWORK] framework = config[CONF_FRAMEWORK]
cv.platformio_version_constraint(framework[CONF_VERSION]) cv.platformio_version_constraint(framework[CONF_VERSION])
if str(framework[CONF_VERSION]) != "0.0.0": if framework[CONF_SOURCE]:
cg.add_platformio_option("platform", f"libretiny @ {framework[CONF_VERSION]}")
elif framework[CONF_SOURCE]:
cg.add_platformio_option("platform", 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: else:
cg.add_platformio_option("platform", "libretiny") cg.add_platformio_option("platform", "libretiny")