Integrate usermods environment

Move the "all usermods" logic in to the platformio script, so the
'usermods' environment can be built in any checkout without extra setup
commands.
This commit is contained in:
Will Miles
2025-01-14 22:21:26 +00:00
parent 270d75afe2
commit 8fd905215f
4 changed files with 6 additions and 14 deletions

View File

@@ -2,6 +2,11 @@ Import('env')
from pathlib import Path # For OS-agnostic path manipulation
usermod_dir = Path(env["PROJECT_DIR"]) / "usermods"
all_usermods = [f for f in usermod_dir.iterdir() if f.is_dir() and f.joinpath('library.json').exists()]
if env['PIOENV'] == "usermods":
# Add all usermods
env.GetProjectConfig().set(f"env:usermods", 'custom_usermods', " ".join([f.name for f in all_usermods]))
def find_usermod(mod: str):
"""Locate this library in the usermods folder.