[Scons-users] Custom Builders / Command / Execute

Bill Deegan bill at baddogconsulting.com
Tue Nov 1 08:43:54 EDT 2016


What are you trying to run?
What does the command line look like?
What are the files read and written by this command?

It sounds like you're heading down the wrong path entirely.
So let's go with what you want to do, not how you think you should do it
with SCons?

On Tue, Nov 1, 2016 at 3:42 AM, William Blevins <wblevins001 at gmail.com>
wrote:

> Pierre-Luc,
>
> SCons Command/Execute merely invoke the action specified in a shell, so
> for your purposes, you do not need (nor shouldn't) execute this in a
> subprocess because now you have the process that SCons created plus the
> extra one that you have created (potentially).
>
> Execute always does said thing (even if it the targets are up-to-date
> which is obviously inefficient) immediately which means it happens during
> the SConstruct parsing step and cannot be done in parallel with other SCons
> processes. I imagine this is undesired even if acceptable.
>
> Command will not execute if there are no targets (IE. all targets
> up-to-date by default, right?). Also, Command will do nothing if all
> targets are up-to-date which is desired I imagine?
>
> Questions 1/2: No, I would not recommend using Command/Execute inside a
> custom builder. The point of making a custom builder to do something that a
> basic Command cannot do. Also, I am pretty sure this breaks the
> multi-threading requirements of the system with regards to scanners. You
> can look at SCons tools under src/engine/SCons/Tool for more examples (but
> those may be complex).
>
> Question 3: Yes, since SCons will already execute your command in a shell.
> With -j2+ this implies SCons will already be creating a subprocess for the
> action.
>
> V/R,
> William
>
> On Mon, Oct 31, 2016 at 9:43 PM, Pierre-Luc Boily <
> pierreluc.boily at gmail.com> wrote:
>
>> Hello,
>>
>> I am playing with a custom builder (Builders That Execute Python
>> Functions)
>> that I want to make better.
>>
>> Our first iteration was using subprocess /call /to execute a batch file (a
>> batch file that was compiling grammars).  I realized that using python
>> subprocess /call /is kind of evil because it is not using scons
>> environment.
>>
>> Then, I decided to change my python function to use scons /Command
>> /instead
>> (Still inside the custom builder).  Then again, I got plenty of problems
>> and
>> I was quite confused between target/source given to my actual custom
>> builder
>> and target/source given to scons /Command/.  It was not working at all.
>> /Command /was not even called or I got errors with target
>>
>> Finally, after all this, I found scons /Execute/.  I decided to give a try
>> so now, my custom builder uses /Execute /to actually execute external
>> call.
>> It worked pretty well.
>>
>> Questions
>> 1 - Does that make sense to use Command inside a custom builder?
>> 2 - Is it appropriate to use Execute inside my custom builder?
>> 3 - Do you agree that using python subprocess call might be bad?
>>
>>
>>
>> --
>> View this message in context: http://scons.1086193.n5.nabble
>> .com/Custom-Builders-Command-Execute-tp40687.html
>> Sent from the Users mailing list archive at Nabble.com.
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>
>
> _______________________________________________
> 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/20161101/929f3627/attachment.html>


More information about the Scons-users mailing list