[Scons-users] Problem with custom builder
William Deegan
bill at baddogconsulting.com
Mon Jul 29 17:10:47 EDT 2013
Michael,
On Jul 29, 2013, at 1:13 PM, Dirk Bächle <tshortik at gmx.de> wrote:
> 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).
Note that changes to dir.a (the source dir) (Or any files in its subdirectories) may not trigger the builder being rerun.
Especially file additions.
-Bill
More information about the Scons-users
mailing list