[Scons-users] Recursive directories, and the ignoring of filenames.

Matthew Marinets Matthew.Marinets at Kardium.com
Fri Aug 3 13:51:47 EDT 2018


I can't reproduce your bug then.

Using Python 3.6.5;
scons -v:
        script: v3.0.1.74b2c53bc42290e911b334a6b44f187da698a668, 2017/11/14 13:16:53, by bdbaddog on hpmicrodog
        engine: v3.0.1.74b2c53bc42290e911b334a6b44f187da698a668, 2017/11/14 13:16:53, by bdbaddog on hpmicrodog
        engine path: ['C:\\Program Files\\Python36\\scons-3.0.1\\SCons']


I made a Command() builder that Globs all .c files in the src/ directory, and copies them to the build/ directory:

	sources = Glob(pattern = str(src) + '/*.c')
	env.Command(target = [build.File(x.name) for x in sources], source = sources, action = 'cp $SOURCES $TARGET.dir')

First I ran it with src contents: 
src/a.c
src/b.c
src/asdf.c

All files were copied, as expected. Running SCons again, the build was not executed as all targets were up to date.

Next, I changed the name of asdf.c to qwer.c.
>scons --debug=explain
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: rebuilding `build\a.c' because:
           `src\asdf.c' is no longer a dependency
           `src\qwer.c' is a new dependency
cp src\a.c src\b.c src\qwer.c build
scons: done building targets.

>scons --debug=explain
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.

I think you've misidentified your bug.

I still suspect that it's because you're putting directories in the source / target arguments of a builder; SCons doesn't like that for some reason. Notice that in my example, the sources and targets were all files or lists of files, and to get a directory path in that action, I called $TARGET.dir 

-Matthew

-----Original Message-----
From: Scons-users <scons-users-bounces at scons.org> On Behalf Of Alistair Buxton
Sent: August 3, 2018 10:25
To: SCons users mailing list <scons-users at scons.org>
Subject: Re: [Scons-users] Recursive directories, and the ignoring of filenames.

On 3 August 2018 at 18:08, Matthew Marinets <Matthew.Marinets at kardium.com> wrote:
> To me it sounds more like you just need an emitter.
>
> The bug you described (as I understood it), is that the built-in SCons 
> decider is order-sensitive. Saying [“src/a.txt”, “src/b.txt”] is 
> different from [“src/b.txt”, “src/a.txt”].
>
> The simple solution, as Bill said, it to just sort your list. You can 
> do this automatically in an emitter.

Then you didn't correctly understand the issue. Go and read it again.
The issue is that saying ['a.txt', 'b.txt'] is the same say saying ['a.txt', 'c.txt'] if b.txt and c.txt have the same contents, ie it will NOT trigger a rebuild, even though it should. The way you build the list is 100% irrelevant as this is an internal implementation detail of scons.


--
Alistair Buxton
a.j.buxton at gmail.com
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users


More information about the Scons-users mailing list