[Scons-users] matching source and target's behavior between func and cmd actions
Bill Deegan
bill at baddogconsulting.com
Mon Jun 22 10:43:32 EDT 2020
I suggest RTFM.. (read the fine manuals)...
There's a section on site_scons.
On Sun, Jun 21, 2020 at 11:36 PM daggs <daggs at gmx.com> wrote:
> I don't know what is the purpose of site_scons/site_init.py, I'll read
> about it and see if it help what I need to do.
>
> Thanks.
>
> *Sent:* Sunday, June 21, 2020 at 10:33 PM
> *From:* "Bill Deegan" <bill at baddogconsulting.com>
> *To:* "daggs" <daggs at gmx.com>
> *Cc:* "SCons users mailing list" <scons-users at scons.org>
> *Subject:* Re: [Scons-users] matching source and target's behavior
> between func and cmd actions
> Re choosing from two env's to use. Just make a function and stick it in
> your site_scons/site_init.py
> Because what you're describing isn't a builder. It may be a pseudo
> builder, or just a python function.. but it's not builder if it needs to
> select from two (or more) env's to use.
>
>
> On Sat, Jun 20, 2020 at 11:13 PM daggs <daggs at gmx.com> wrote:
>
>> Thansk, I'll look it.
>>
>> yes, I looked at the manpage but unfortunatelythe manpage's len doesn't
>> *correlate* with my problematic attention span.
>> this results in me missing parts of a doc sometimes. I'll try next time
>> to put more effornt in reading the manpage.
>>
>> Thanks,
>>
>> Dagg.
>>
>> *Sent:* Sunday, June 21, 2020 at 7:44 AM
>> *From:* "Bill Deegan" <bill at baddogconsulting.com>
>> *To:* "SCons users mailing list" <scons-users at scons.org>
>> *Cc:* "daggs" <daggs at gmx.com>
>> *Subject:* Re: [Scons-users] matching source and target's behavior
>> between func and cmd actions
>> Go take a look at :
>> https://scons.org/doc/production/HTML/scons-man.html#builder_objects
>> Search for "generator"
>> Likely that's what you want.
>> Did you take a read through the manpage first?
>> There's lots of useful info there.. :)
>>
>> On Sat, Jun 20, 2020 at 4:05 PM Gary Granger <granger at ucar.edu> wrote:
>>
>>> If you want to use different commands or change the string printed when
>>> the command executes, that implies you should use different Builder
>>> instances, with different Actions or cmdstr or both. It sounds like you're
>>> trying to parameterize a build task within a single python function,
>>> instead of using the mechanisms SCons already provides for parameterizing
>>> build tasks, namely Builder and Action. If you really have functionality
>>> in the task() function which you want to share across multiple Builder
>>> instances, then I would break out the shared functionality into other
>>> functions which your Builder tasks then call. But now I'm just guessing,
>>> because I doubt I really understand what you're trying to do from your
>>> example.
>>> On 6/20/20 11:52 AM, daggs wrote:
>>>
>>> Greetings Gary,
>>>
>>> that helps me in this specific case but not in the more general case as
>>> I might want to use .dirname or pass the cmd.
>>>
>>> I thought of using regex replace like this:
>>> def task(source, target, env):
>>> print(env['cmd'])
>>> new_cmd = re.sub("\$TARGET", env['cmd'], 'aaa')
>>> print('['+new_cmd+']')
>>>
>>> but for the following cmd:
>>> ${SOURCE}<=>$SOURCE<=>${SOURCES}<=>$SOURCES<=>${TARGET}<=>$TARGET<=>$SOURCES.dirname<=>${SOURCE}.dirname<=>$TARGET.abspath
>>> I get this output:
>>> [aaa]
>>>
>>> _______________________________________________
>>> 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/20200622/3b7d4534/attachment.html>
More information about the Scons-users
mailing list