[Scons-users] src_suffix getings ignored
Bill Deegan
bill at baddogconsulting.com
Sat May 21 20:02:08 EDT 2022
You don't need
Dir("out").abspath
"out" would suffix.
You generally shouldn't need to do all this Dir(), File() stuff, just use
the string.
Re the rest.. i think Mats just answered it.
(Stuck in my drafts folder.. ;)
On Sun, May 15, 2022 at 12:22 AM daggs <daggs at gmx.com> wrote:
> here:
>
> SConstruct:
> env = Environment(tools = [ 'default', 'test' ])
> SConscript('src/SConscript', variant_dir = Dir("out").abspath, duplicate =
> 0, exports='env')
>
> src/SConscript:
> Import('env')
> objs_path = Dir('.').abspath
> src_env = env.Clone()
> ent = Dir(env.subst('#')).abspath + "aaaaaa.temp"
> src_env.Object(src_env.do_a_b(ent, base = Dir(env.subst('#')).abspath,
> out_dir = objs_path + "/generated/"))
> src_env.Object(src_env.do_a_c(ent, base = Dir(env.subst('#')).abspath,
> out_dir = objs_path + "/generated/"))
>
>
> Thanks,
>
> Dagg
> *Sent:* Tuesday, May 10, 2022 at 9:52 PM
> *From:* "daggs" <daggs at gmx.com>
> *To:* scons-users at scons.org
> *Cc:* "SCons users mailing list" <scons-users at scons.org>
> *Subject:* Re: [Scons-users] src_suffix getings ignored
> I'll try to cunjor up a sample scons file.
>
> Dagg.
>
> *Sent:* Sunday, May 08, 2022 at 5:02 PM
> *From:* "Bill Deegan" <bill at baddogconsulting.com>
> *To:* "SCons users mailing list" <scons-users at scons.org>
> *Subject:* Re: [Scons-users] src_suffix getings ignored
> You'll need to include your sample SConstruct as well..
>
> On Sun, May 8, 2022 at 1:27 AM daggs <daggs at gmx.com> wrote:
>
>> Greetings,
>>
>> I have the following builder:
>> import os
>>
>> template_suffix = ".temp"
>>
>> def convert_path(base, out, src):
>> return src.replace(base, out)
>>
>> def modify_target(target, source, env):
>> return convert_path(env['base'], env['out_dir'], str(source[0])),
>> source
>>
>> def a_action(target, source, action):
>> return os.system("echo -" + action + " " + os.path.basename(source))
>>
>> def a_b_action(target, source, env):
>> return a_action(target, source, "a")
>>
>> def a_c_action(target, source, env):
>> return a_action(target, source, "b")
>>
>> def generate(env, **kwargs):
>> builders = {
>> 'do_a_b' : env.Builder(action = env.Action(a_b_action), suffix =
>> '.c',
>> src_suffix = template_suffix, emitter =
>> modify_target),
>> 'do_a_c' : env.Builder(action = env.Action(a_c_action), suffix =
>> '.h',
>> src_suffix = template_suffix, emitter =
>> modify_target)
>> }
>>
>> env.Append(BUILDERS = builders)
>>
>> def exists(env):
>> return true
>>
>> when I add prints to modify_target, both target and source looks good.
>> however, when I run it as part of a scons build flow, it fails with the
>> following error:
>> scons --tree=all --debug=explain -n -Q
>> scons: *** While building
>> `['/tmp/proj/output/objs/module_a/generated/dir1/file.o']' from
>> `['generated/dir1/file.temp']': Don't know how to build from a source file
>> with suffix `.temp'. Expected a suffix in this list: ['.c', '.m', '.cpp',
>> '.cc', '.cxx', '.c++', '.C++', '.mm', '.C', '.f', '.for', '.ftn', '.fpp',
>> '.FPP', '.F', '.FOR', '.FTN', '.f77', '.F77', '.f90', '.F90', '.f95',
>> '.F95', '.f03', '.F03', '.f08', '.F08', '.s', '.asm', '.ASM', '.spp',
>> '.SPP', '.sx', '.S', '.d'].
>>
>> any ideas what I'm doing wrong?
>>
>> Thanks.
>> _______________________________________________
>> 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/20220521/8ea4fcdd/attachment-0001.htm>
More information about the Scons-users
mailing list