[Scons-dev] Builder issue

Neven Klacar nklacar at gmail.com
Tue Nov 26 21:46:52 EST 2013


Hi Dirk,

Thanks for your help! I tried your suggestion but its the same result.
I got the name paramater from the Base class that File nodes inherit.

I will try the user group as you suggested.

Thanks,
Neven




On Tue, Nov 26, 2013 at 2:59 PM, Dirk Bächle <tshortik at gmx.de> wrote:


> 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=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

>

>

>

>

> _______________________________________________

> Scons-dev mailing list

> Scons-dev at scons.org

> http://two.pairlist.net/mailman/listinfo/scons-dev

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/scons-dev/attachments/20131126/c3d47177/attachment.html>


More information about the Scons-dev mailing list