[Scons-users] Incorrect diagnostics output when calling a Python function as custom action

Bill Deegan bill at baddogconsulting.com
Tue Mar 21 12:42:59 EDT 2023


You'll have to create a standalone repeater for this one with no platformIO
for us to try to reproduce it.
-Bill

On Tue, Mar 21, 2023 at 12:42 PM Bill Deegan <bill at baddogconsulting.com>
wrote:

> oops didn't see that you'd already reported it there.
>
> On Tue, Mar 21, 2023 at 12:39 PM Bill Deegan <bill at baddogconsulting.com>
> wrote:
>
>> You should report this to platform IO first as it's quite possible it's
>> related to the way PlatformIO uses SCons.
>> Have you reported it to them?
>>
>> On Tue, Mar 21, 2023 at 10:18 AM Andreas Heyer via Scons-users <
>> scons-users at scons.org> wrote:
>>
>>> Hello devs and users of SCons,
>>>
>>> my use of SCons is only through PlatformIO inside of VS Code. I don't
>>> have the time to discover how to make a suitable standalone example to show
>>> the small error. So please don't be rude because I only copied my bug
>>> report for PlatformIO (
>>> https://github.com/platformio/platformio-core/issues/4573) over to this
>>> project.
>>>
>>>
>>> Configuration:
>>>
>>> Operating system: Windows 10 x64
>>> PlatformIO Version (platformio --version): 3.1.1 (VS Code extension)
>>>
>>>
>>> Description of problem:
>>>
>>> There is incorrect diagnostic output during the build process if a
>>> custom action is invoked via a custom Python script. This output can lead
>>> to false assumptions of the creator of the custom script because claimed
>>> action and in reality performed action do not match. In my case I copied
>>> the wrong file in my custom action because the diagnostic output showed the
>>> wrong order of parameters (source and target interchanged) albeit strictly
>>> sticking to the docs I could succeeded from the beginning.
>>>
>>>
>>> Steps to Reproduce:
>>>
>>> 1. Add a custom Python script to the project's platformio.ini with
>>> "extra_scripts = post:myscript.py" under an environment section
>>> 2. Create an action function "action_func" with signature
>>> "action_func(source, target, env)" in the Python file myscript.py
>>> 3. Register this function as action for a target
>>> "generated_file_to_watch", e.g.
>>> "env.AddPostAction("generated_file_to_watch", action_func)"
>>> 4. Build the project
>>> 5. Watch for an output line saying
>>> "action_func(["generated_file_to_watch"], ["source_file"])".
>>>     The list of source files (parameter source) depends on your choice
>>> of the generated file to watch (parameter target).
>>>
>>>
>>> Actual Results:
>>>
>>> Output line of
>>>         action_func(["generated_file_to_watch"], ["source_file"])
>>>
>>>
>>> Expected Results:
>>>
>>> Output line of
>>>         action_func(["source_file"], ["generated_file_to_watch"])
>>>
>>> Because this is the order the signature of action_func demands according
>>> to PlatformIO's advanced scripting documentation. And in fact it's the
>>> order the function is called.
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20230321/496dffa1/attachment.htm>


More information about the Scons-users mailing list