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

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


On 3 August 2018 at 19:21, Matthew Marinets
<Matthew.Marinets at kardium.com> wrote:
> I still can't reproduce the issue:
>
> Renaming qwer.c to qwera.c behaves exactly as expected:
> Rebuilt the first time, not rebuilt the next
>
> I put in a print statement to check the order. Even when the order of sources did not change, SCons still behaves as expected. My complete output is below, at the ** symbol, but there's one more thing
>
> At no point did you have a guard against a directory slipping into your sources argument in your initial post. The commands I saw attempted were as follows:
> env.Command('listing.txt', 'files', 'ls -lR ${SOURCE} > ${TARGET}')
>
> env.Command('listing.txt', ['files/', Glob('files/*')], 'ls -lR ${SOURCES[0]} > ${TARGET}')
>
> env.Command('listing.txt', ['files/', Glob('files/*'), Glob('files/*/*'), Glob('files/*/*/*'), Glob('files/*/*/*/*')], 'ls -lR ${SOURCES[0]} > ${TARGET}')
>
> env.Command('listing.txt', ['files',
> Value(subprocess.check_output(['sh', '-c', 'find files/ -type f -exec sha256sum {} \; | sort | sha256sum']))], 'ls -lR ${SOURCES[0]} >
> ${TARGET}')
>
> env.Command('out.txt', Glob('files/*'), 'ls -lR files/ > ${TARGET}')
>
> Except for the last one, every call starts with 'files' as the first source. 'files' is a directory, as evidenced by your use of 'files/' in many places, and your introductory statement that "I have a directory called 'files'".

The difference between my example and your example is that I used
${SOURCE} and ${SOURCES[0]} which expand to only the first item in the
sources, ie "files" regardless of what else is in the list. You used
"${SOURCES}" which expands to the full list of sources, ie "files
files/a.txt files/b.txt" and this string will change depending on what
sources are given. This means that the action string will change, and
this will cause scons to rebuild. But as I just explained to Bill, not
every tool takes a list of files on the command line. Some only accept
a single directory, so using this behaviour as a workaround is not
possible.




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


More information about the Scons-users mailing list