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 ([email protected]) 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
[email protected]
http://two.pairlist.net/mailman/listinfo/scons-dev

Reply via email to