[Scons-users] A quick doubt about Command()

Jason Pettiss jpettiss at broadwaytechnology.com
Wed Nov 13 11:06:06 EST 2013


If you want it to execute right away, use Execute(). If it's not specific to any particular source file but instead applies to the whole project, you could use AddOption() to provide a command-line option to kick it off. Command() is useful for chaining command-line actions that need to happen if their source has changed and their target is being asked for.

From: scons-users-bounces at scons.org [mailto:scons-users-bounces at scons.org] On Behalf Of Matias Iturburu
Sent: Monday, November 11, 2013 07:57
To: SCons users mailing list
Subject: [Scons-users] A quick doubt about Command()

Hello list.

I'm writing a builder that runs astyle on a temporary file and prints the diff with the original out to the standard output.

I have some concerns about what would be the "proper" way to deal with according to SCons.

Basically, the process happens in three steps:

- Run astyle and output the result to a temprorary file.
- Run diff of original_file and astyled_file.
- Print the diff.

As the process has no other output that the printed strings I think this is a job for a Pseudo Builder (http://www.scons.org/doc/2.3.0/HTML/scons-user.html#chap-add-method).

So I can do a _do_astyle, _do_astyle_diff and run the correspondent eternal tool in each. This is what brings me here: Should this external tool be run using the Command (http://www.scons.org/doc/2.3.0/HTML/scons-user.html#chap-builders-commands) function? Is this Command executed right away? Is this some sort of replacement for subprocess.Popen (http://docs.python.org/2/library/subprocess.html?highlight=popen#subprocess.Popen)?

I bring this out because I recall having being told that if I'm running Popen in a builder maybe I'm doing something wrong.

Thanks in advance.


--
[http://www.tallertechnologies.com/templates/tallertechnologies/images/signature.png]<http://www.tallertechnologies.com>
Matías Iturburu
Software Engineer

San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54 351 4217888 / +54 351 4218211
Skype: matias.iturburu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131113/aa617a43/attachment-0001.html


More information about the Scons-users mailing list