[Scons-users] Builder to perform string substitution on source contents to produce a target file?

Kyle J Strand Kyle.Strand at beckman.com
Mon Jun 18 11:14:00 EDT 2012


I don't think (but couldn't say for sure) that there's a standard builder
for that, but it should be easy enough to do what you need to do in
straight Python without using builders at all, as shown in this page of
the user manual:
http://scons.org/doc/production/HTML/scons-user/x1302.html

If you're compiling C or C++ code, you can use the CPPDEFINES environment
variable to define macro-substitutions at compile time. If not, it appears
that you can explicitly call the M4 preprocessor with the env.M4() command
(assuming you have it on your system; if not, I'm sure there are other
alternatives). Try doing a find on "env.m4()" in the man page:
http://scons.org/doc/production/HTML/scons-man.html

-----------------------------------------------------------------------
Kyle Strand, Software Intern
Beckman Coulter, Inc., Life Sciences Division
4862 Innovation Drive, Fort Collins, Colorado, 80525
(970) 204-7036



M Busche <spammymatt94 at yahoo.com>
Sent by: scons-users-bounces at scons.org
06/17/2012 09:50 PM
Please respond to
M Busche <spammymatt94 at yahoo.com>; Please respond to
SCons users mailing list <scons-users at scons.org>


To
"scons-users at scons.org" <scons-users at scons.org>
cc

Subject
[Scons-users] Builder to perform string substitution on source contents
to produce a target file?






QUESTION:

Is there was a standard builder for doing string-replacement processing
between input and output files?

BACKGROUND:

I have written a builder that reads in a source file, performs a series
global string substitutions on the file just read (as defined by a
dictionary defined in the environment), and writes the result to the
specified target file. I use this during software packaging to replace
the string pattern "__VERSION__" in each of my source files with the
actual software version (which I pull out of my bzr source code control
system). I also use it to inject projectName, version, and output
directory settings into a doxygen configuration file (which is
subsequently used to produce software docs). This seems useful enough
that I thought it might already exist.

Thanks much!
Matt

_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users


The server made the following annotations

---------------------------------------------------------------------------------

This message contains information that may be privileged or confidential and is the property of Beckman Coulter, Inc. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

---------------------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120618/3c822751/attachment.htm>


More information about the Scons-users mailing list