Skip to content

Commit

Permalink
optionally pass env to AddBuildMiddleware callback
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Aug 5, 2022
1 parent 17a7293 commit bd8009d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion platformio/builder/tools/piobuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,10 @@ def CollectBuildFiles(
for callback, pattern in middlewares:
if pattern and not fnmatch.fnmatch(node.srcnode().get_path(), pattern):
continue
new_node = callback(new_node)
if callback.__code__.co_argcount == 2:
new_node = callback(env, new_node)
else:
new_node = callback(new_node)
if new_node:
new_sources.append(new_node)

Expand Down

0 comments on commit bd8009d

Please sign in to comment.