Script error - AttributeError: 'NodeList' object has no attribute 'srcnode'

Hello all,

I’ve got a script that’s generating an error, stripped down its:

Import("env")

# Add custom macros for the ALL files which path contains "edge-impulse-sdk"
def edge_impulse_sdk_configuration(env, node):

    print("Node '%s'" % (node.name))
    return env.Object(node)

env.AddBuildMiddleware(edge_impulse_sdk_configuration)

It generates the output & error, below. Anyone know where I could be going wrong?

I’m using PlatformIO as a VSC plugin, v3.3.3 (2024-01-26)

Thanks,

Node 'CmdBuffer.cpp'

AttributeError: 'NodeList' object has no attribute 'srcnode':
  File "/home/user/.platformio/penv/lib/python3.10/site-packages/platformio/builder/main.py", line 173:
    env.SConscript("$BUILD_SCRIPT")
  File "/home/user/.platformio/packages/tool-scons/scons-local-4.7.0/SCons/Script/SConscript.py", line 612:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/user/.platformio/packages/tool-scons/scons-local-4.7.0/SCons/Script/SConscript.py", line 279:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/user/.platformio/platforms/espressif32/builder/main.py", line 312:
    target_elf = env.BuildProgram()
  File "/home/user/.platformio/packages/tool-scons/scons-local-4.7.0/SCons/Util/envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "/home/user/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piobuild.py", line 62:
    env.ProcessProjectDeps()
  File "/home/user/.platformio/packages/tool-scons/scons-local-4.7.0/SCons/Util/envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "/home/user/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piobuild.py", line 155:
    env.Prepend(LIBS=plb.build())
  File "/home/user/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piolib.py", line 1056:
    result = super().build()
  File "/home/user/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piolib.py", line 481:
    libs.extend(lb.build())
  File "/home/user/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piolib.py", line 515:
    nodes = self.env.CollectBuildFiles(
  File "/home/user/.platformio/packages/tool-scons/scons-local-4.7.0/SCons/Util/envs.py", line 251:
    return self.method(*nargs, **kwargs)
  File "/home/user/.platformio/penv/lib/python3.10/site-packages/platformio/builder/tools/piobuild.py", line 314:
    new_node = callback(new_node)
  File "/home/user/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 1397:
    if node.srcnode().get_path().lower().startswith(PROJECT_SRC_DIR.lower()):

I think the issue was that the node was just a path.

I tried something like:

    print("WARNING: Modifying flags for", node.name)
    if '-Werror=all' in env['CCFLAGS']:
        env['CCFLAGS'].remove('-Werror=all')
    #print(env.Dump())
    return node

But it fails to remove -Werror=all

What does work:

    print("WARNING: Modifying flags for", node.name)
    env.Append(CCFLAGS=["-Wno-error=maybe-uninitialized"])
    return node

I’ve tested uninitialized variables in other paths & it generate errors so setting this Append only seems to effect the local file.