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

Alistair Buxton a.j.buxton at gmail.com
Fri Aug 3 14:03:29 EDT 2018


On 3 August 2018 at 18:51, Matthew Marinets
<Matthew.Marinets at kardium.com> wrote:
> 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.

The build was re-run because the new name you gave to the file changed
the sorting order. I explained this in the initial report:

On 3 August 2018 at 00:45, Alistair Buxton <a.j.buxton at gmail.com> wrote:

> renames. It can also not if the renaming causes dependencies to be
> listed in a different order (ie if you renamed a.txt instead of b.txt,
> and the files had different contents).

If you renamed asdf.c to asdfa.c, then the build would still have
re-run, because you put the name of every file into the action string,
and scons will detect that that the action string has changed. I
explained this in my initial follow up email:


> In this case you would instead say:
>
> env.Command('listing.txt', Glob('*.txt'), 'ls ${SOURCES} > ${TARGET}')
>
> and scons would identify that the build needs to be re-done because
> the action string changed.

and the above was in reference to a reproduction of the issue which
involves no directories at all:

> env.Command('listing.txt', Glob('*.txt'), 'ls *.txt > ${TARGET}')

Please actually read the whole report before jumping to conclusions.


-- 
Alistair Buxton
a.j.buxton at gmail.com


More information about the Scons-users mailing list