[Scons-dev] Builder issue
Dirk Bächle
tshortik at gmx.de
Tue Nov 26 17:59:13 EST 2013
Hi Neven,
On 26.11.2013 21:17, Neven Klacar wrote:
> [...]
> In the builder I created a an emitter which modifies the target files
> to have a different name.
> [...]
> def my_emitter(target, source, env):
>
> for t in target:
>
> t.name <http://t.name>=t.name
> <http://t.name>[:t.name.rfind('.')]+'_altered.c'
>
> return (target,source)
>
>
I don't know where you got this syntax from (UserGuide? MAN page?
Google?), but usually SCons Nodes don't have an attribute "name". This
may be the problem why your current code doesn't work as expected.
In an Emitter you're allowed to return simple strings as target/source
list, they get converted back to File Nodes by SCons automatically.
So, in your case you could write something like:
def my_emitter(target, source, env):
altered_targets = []
for t in target:
fpath, fext = os.path.splitext(str(t))
altered_targets.append(fpath <http://t.name>+'_altered.c')
return (altered_targets,source)
Note how I convert the File Node to a simple string with the str()
function, and then create the new filename from it.
Hope this helps you a little further.
Finally, please ask similar questions on our User mailing list
(scons-users at scons.org) in the future. You'll reach much more people
there, and get a response much quicker than in this list, where only
SCons developers are listening.
Best regards,
Dirk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/scons-dev/attachments/20131126/afcda4a1/attachment.htm>
More information about the Scons-dev
mailing list