[Scons-users] SCons messes up ordering with VariantDir

Markus Ewald cygon at nuclex.org
Sun Sep 29 16:18:32 EDT 2019


On 9/29/19 11:54 AM, I myself wrote:
>
> Hi!
>
> I'm trying to write a SCons script that performs the following three 
> steps:
>
>     1. Download a source code archive
>
>     2. Extract sources from said archive
>
>     3. Compile the extracted sources
>
> [...]
>
>
We've discussed this a bit on the SCons Discord server.

Even if my SConstruct file is split into a SConstruct + SConscript pair, 
calling env.SConscript('SConscript', variant_dir=...) instead of setting 
up the variant dir internally, the issue persists.

It seems that, as soon as a variant dir is involved, SCons forgets the 
dependency chain that's producing the files virtually put inside the 
variant dir.


Very likely I'm running into this bug: 
https://github.com/SCons/scons/issues/2908

Here's a super-short repro case for the problem:

    #!/usr/bin/env python

    def make_main_c(target, source, env):
         source_file = open(str(target[0]), 'w')
         source_file.write('#include <stdio.h>\n')
         source_file.write('int main() { printf("Hello World"); }')
         source_file.close()

    env = Environment()

    env.Command(source = None, action = make_main_c, target = 'src/main.c')
    env.VariantDir('obj', 'src', duplicate = 0)
    env.Program('bin/hello', 'obj/main.c')

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20190929/6d244680/attachment.html>


More information about the Scons-users mailing list