[Scons-users] Problem with custom builder

Dirk Bächle tshortik at gmx.de
Mon Jul 29 16:13:41 EDT 2013


Hi Michael,

On 29.07.2013 08:01, Michael Pock wrote:

> [...]

> Hi Dirk,

>

> thanks for your reply. I tried out your suggestions, but, unfortunately,

> SCons still terminates with the error message

>

> scons: *** Multiple ways to build the same target were specified for:

> dir.list (from ['dir.a'] and from ['dir.b'])

>

> It seems there is no way to prevent SCons from stripping source filename

> suffixes when computing target filenames.


I had a second look at your Builder and the following code works fine on
my side:

env = Environment()

env["BUILDERS"]["List"] = Builder(action="ls ${SOURCE} >${TARGET}",
suffix=".list",
source_factory=Dir,
single_source=True)

env.List("dir.a.list", "dir.a")
env.List("dir.b.list", "dir.b")
env.List("dir.c.list", "dir.c")

The basic problem in your case is, that the suffix of the source file
changes. Usually, you'd have a single suffix, like ".dvi", that would
get mapped to a suffix ".pdf" for the target.
When simply specifying "env.List(['dir.a'])" SCons is confused and
assumes that the ".a" is the target suffix already.
If specifying the full target name explicitly is too cumbersome for your
taste, you might want to wrap your List() in a pseudo-Builder (see chap.
20 in the UserGuide).

Best regards,

Dirk



More information about the Scons-users mailing list