Discussion:
[Scons-users] Two-level suffixes
Paweł Tomulik
2018-10-26 22:40:51 UTC
Permalink
I'm trying to add an action to CXXFile builder for source suffix '.t.h'
which shall map to target suffix '.t.cpp'. Can't get it working

import SCons.Tool
_, cxx = SCons.Tool.createCFileBuilders(env)
cxx.add_action('.t.h', my_action) # this works well, but..
cxx.suffix.update({'.t.h': '.t.cpp'}) # this mapping does not work.

trying with emitter, that is:

cxx.add_emitter('.t.h', my_emitter)

does not work as well. The problem is, that whereas the SCons machinery
for selecting actions for source suffixes is able to handle suffixes
with dots in it (as in'.t.h'), the machinery for selecting target suffix
or emitter only handles suffixes without dots in the middle, such as
'.h', but not '.t.h'. The involved parts of SCons code is around
SCons.Util.Selector and File.get_suffix().

Is this discrepancy a part of some concept, or just an accident that
should be fixed?

Best regards!
--
Pawel Tomulik
Paweł Tomulik
2018-10-26 22:45:25 UTC
Permalink
Post by Paweł Tomulik
I'm trying to add an action to CXXFile builder for source suffix '.t.h'
which shall map to target suffix '.t.cpp'. Can't get it working
import SCons.Tool
_, cxx = SCons.Tool.createCFileBuilders(env)
cxx.add_action('.t.h', my_action) # this works well, but..
cxx.suffix.update({'.t.h': '.t.cpp'}) # this mapping does not work.
cxx.add_emitter('.t.h', my_emitter)
does not work as well. The problem is, that whereas the SCons machinery
for selecting actions for source suffixes is able to handle suffixes
with dots in it (as in'.t.h'), the machinery for selecting target suffix
or emitter only handles suffixes without dots in the middle, such as
'.h', but not '.t.h'. The involved parts of SCons code is around
SCons.Util.Selector and File.get_suffix().
Is this discrepancy a part of some concept, or just an accident that
should be fixed?
Best regards!
I should mention that "does not work" means that for a '.t.h', correct
action is invoked, but for a source "foo.t.h", "foo.cc" is set to be
$TARGET for the action (instead of "foo.t.cpp", as I would expect). In
case of emitter - the emitter assigned to ".t.h" is not called.
--
Pawel Tomulik
Loading...