From ee3864175d90fb04030ab592cd73ae9e0b2f8673 Mon Sep 17 00:00:00 2001 From: Will Miles Date: Tue, 6 May 2025 21:55:06 -0400 Subject: [PATCH] load_usermods: Make missing libArchive an error Rather than try and fail to add this property, abort if it's missing from any requested usermod. --- pio-scripts/load_usermods.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pio-scripts/load_usermods.py b/pio-scripts/load_usermods.py index eeebcbf27..8cf625ff6 100644 --- a/pio-scripts/load_usermods.py +++ b/pio-scripts/load_usermods.py @@ -2,6 +2,8 @@ Import('env') import os.path from collections import deque from pathlib import Path # For OS-agnostic path manipulation +from click import secho +from SCons.Script import Exit from platformio.builder.tools.piolib import LibBuilderBase from platformio.package.manager.library import LibraryPackageManager @@ -105,6 +107,7 @@ def wrapped_ConfigureProjectLibBuilder(xenv): for dep in result.depbuilders: cached_add_includes(dep, processed_deps, extra_include_dirs) + broken_usermods = [] for dep in result.depbuilders: if is_wled_module(dep): # Add the wled folder to the include path @@ -114,9 +117,15 @@ def wrapped_ConfigureProjectLibBuilder(xenv): dep.env.PrependUnique(CPPPATH=str(dir)) # Enforce that libArchive is not set; we must link them directly to the executable if dep.lib_archive: - build = dep._manifest.get("build", {}) - build["libArchive"] = False - dep._manifest["build"] = build + broken_usermods.append(dep) + + if broken_usermods: + broken_usermods = [usermod.name for usermod in broken_usermods] + secho( + f"ERROR: libArchive=false is missing on usermod(s) {' '.join(broken_usermods)} -- modules will not compile in correctly", + fg="red", + err=True) + Exit(1) return result