Skip to content

Commit bbfe90d

Browse files
authored
Merge pull request #4738 from willmmiles/validate-usermods-after-removal
Fix validation after removing a usermod
2 parents 3f03cb4 + 368351b commit bbfe90d

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

pio-scripts/load_usermods.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,18 @@ def wrapped_ConfigureProjectLibBuilder(xenv):
7777
for dep in result.depbuilders:
7878
cached_add_includes(dep, processed_deps, extra_include_dirs)
7979

80+
wled_deps = [dep for dep in result.depbuilders if is_wled_module(dep)]
81+
8082
broken_usermods = []
81-
for dep in result.depbuilders:
82-
if is_wled_module(dep):
83-
# Add the wled folder to the include path
84-
dep.env.PrependUnique(CPPPATH=str(wled_dir))
85-
# Add WLED's own dependencies
86-
for dir in extra_include_dirs:
87-
dep.env.PrependUnique(CPPPATH=str(dir))
88-
# Enforce that libArchive is not set; we must link them directly to the executable
89-
if dep.lib_archive:
90-
broken_usermods.append(dep)
83+
for dep in wled_deps:
84+
# Add the wled folder to the include path
85+
dep.env.PrependUnique(CPPPATH=str(wled_dir))
86+
# Add WLED's own dependencies
87+
for dir in extra_include_dirs:
88+
dep.env.PrependUnique(CPPPATH=str(dir))
89+
# Enforce that libArchive is not set; we must link them directly to the executable
90+
if dep.lib_archive:
91+
broken_usermods.append(dep)
9192

9293
if broken_usermods:
9394
broken_usermods = [usermod.name for usermod in broken_usermods]
@@ -97,6 +98,9 @@ def wrapped_ConfigureProjectLibBuilder(xenv):
9798
err=True)
9899
Exit(1)
99100

101+
# Save the depbuilders list for later validation
102+
xenv.Replace(WLED_MODULES=wled_deps)
103+
100104
return result
101105

102106
# Apply the wrapper

pio-scripts/validate_modules.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,8 @@ def validate_map_file(source, target, env):
5353
secho(f"ERROR: Map file not found: {map_file_path}", fg="red", err=True)
5454
Exit(1)
5555

56-
# Identify the WLED module source directories
57-
module_lib_builders = [builder for builder in env.GetLibBuilders() if is_wled_module(env, builder)]
58-
59-
if env.GetProjectOption("custom_usermods","") == "*":
60-
# All usermods build; filter non-platform-OK modules
61-
module_lib_builders = [builder for builder in module_lib_builders if env.IsCompatibleLibBuilder(builder)]
62-
else:
63-
incompatible_builders = [builder for builder in module_lib_builders if not env.IsCompatibleLibBuilder(builder)]
64-
if incompatible_builders:
65-
secho(
66-
f"ERROR: Modules {[b.name for b in incompatible_builders]} are not compatible with this platform!",
67-
fg="red",
68-
err=True)
69-
Exit(1)
56+
# Identify the WLED module builders, set by load_usermods.py
57+
module_lib_builders = env['WLED_MODULES']
7058

7159
# Extract the values we care about
7260
modules = {Path(builder.build_dir).name: builder.name for builder in module_lib_builders}

0 commit comments

Comments
 (0)