Re: SCons messes up ordering with VariantDir

Markus Ewald <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
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')

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.