[Scons-users] Handling implicit dependencies for generated source files in variant dirs

Henry Gomersall heng at cantab.net
Thu Oct 10 09:39:19 EDT 2013


On 10/10/13 13:08, Dirk Bächle wrote:

> On 10.10.2013 12:51, Henry Gomersall wrote:

>> [...] Apologies, I wasn't quite clear enough. The h files are

>> generated with their own explicit call to env.Jinja().

>>

>> That is, I do the same for the .h file:

>> h_file = env.Jinja(os.path.join(source_dir, target_h_file),

>> os.path.join(template_dir, target_source_name + '.h.jinja'))

>>

>> There is no side effect of creating the .h file, so I assumed that

>> the dependency is inferred from that call...?

>>

>

> Yes, it is...and thanks for the clarifications. I can't find anything

> fishy with your Tool itself, you did a good job on that one.

>

> My current suspicion is that your problem has to do with:

>

> c_file = env.Jinja(os.path.join('src', target_c_file), filenames)

>

> versus

>

> variant_nodes = build_env.SConscript('src/SConscript',

> variant_dir=variant, exports='build_env', duplicate=0)

>

> . I can't try it here because I don't have Jinja installed, but in the

> first line you're not really putting the created Files under the

> influence of the VariantDir mechanics. So, SCons doesn't copy those

> files over to the "variant" dir, which makes the build fail for

> duplicate=1.

>

> Can you try to do the env.Jinja() calls within the "src/SConscript"

> too? You probably have to Export() your list of template files for

> this...

Ok, I've tried this.

Two things become apparent:
1) the templates themselves are not copied - this leads to a problem in
the way the tool handles the rendering. Essentially, there are a couple
of dicts in the environment that contains the rendering specific
variables (the "context"). One of these dicts itself contains a series
of contexts that are specific to each template that is rendered. I
currently look up this template specific context with a key which is the
filename of the template. When it is called, the node thinks the path is
the variant_dir, not the original source, so the lookup fails (it
actually just renders nonsense as a consequence).
2) There are some static files in the src directory that are ignored
(i.e. not copied) when building the variant dirs, but the compilation
fails because it requires them.

Are the two problems above the same problem? Why are the files not copied?

Cheers,

Henry


More information about the Scons-users mailing list