[Scons-users] dep defintions

Hans-Christian Wild hchr.wild at gmail.com
Mon Jun 15 17:14:56 EDT 2020


Hi daggs, thanks for the answers to my questions, I agree with your
points, except for the symlink part :D but that might be opinion based. I
really don't want to cause any distraction from the much better emitter
approach, still I wanted to note that a Command is very well capable of
generating multiple files in one tool invocation.

env = Environment()

def build(target, source, env):
    for file in target:
        with open(file.abspath, 'w'):
            pass

generated = env.Command(['File1', 'File2', 'File3'], None, build)

env.CopyTo('output', generated)

gives:

$ scons
build(["File1", "File2", "File3"], [])
Copy file(s): "File1 File2 File3" to "output\File1 output\File2
output\File3"

Still you need to list all files explicitly, which is where the emitter
comes into play.

-Hans



On Mon, Jun 15, 2020 at 8:02 PM daggs <daggs at gmx.com> wrote:

> the path for each file is predictable, $T/consts/<folder>/defs.*
>
> the extension might change but all filenames are the same. the subtree
> $T/consts/ holds either folders or files starting with defs.
>
> Dagg.
> *Sent:* Monday, June 15, 2020 at 7:09 PM
> *From:* "Bill Deegan" <bill at baddogconsulting.com>
> *To:* "SCons users mailing list" <scons-users at scons.org>
> *Subject:* Re: [Scons-users] dep defintions
> Generally if the target naming is predictable an emitter is used. And
> you'd want to default a real builder.
> (As I've previously suggested in order to add a scanner).
>
> Is that the case? If so please let us know all the files it will generate
> and perhaps we can resolve this properly.
>
> Trying to do this the "quick" way is costing you more effort than you're
> saving it seems.
>
> -Bill
>
> On Mon, Jun 15, 2020 at 6:28 AM daggs <daggs at gmx.com> wrote:
>
>> not sure I understand how can SideEffect improve the situation, can you
>> explain please?
>>
>> > Sent: Monday, June 15, 2020 at 4:14 PM
>> > From: "Mats Wichmann" <mats at wichmann.us>
>> > To: scons-users at scons.org
>> > Subject: Re: [Scons-users] dep defintions
>> >
>> > On 6/14/20 11:27 PM, daggs wrote:
>> > > Greetings Hans,
>> > >
>> > > Command('some/path/const.asm', './def_gen', './def_gen $TARGET'), will
>> > > probably work if def_gen generates only const.asm, but it doesn't, it
>> > > generates multiple const files with different entries.
>> > > so unless I can do this: Command(['some/path/const.asm', 'file1',
>> > > 'file2'], './def_gen', './def_gen $TARGET'), afaik, it is impossible
>> to
>> > > define multiple targets.
>> >
>> > You can use SideEffect for this.
>> >
>> > _______________________________________________
>> > Scons-users mailing list
>> > Scons-users at scons.org
>> > https://pairlist4.pair.net/mailman/listinfo/scons-users
>> >
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
> _______________________________________________ Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20200615/8dad7ae3/attachment-0001.html>


More information about the Scons-users mailing list