[Scons-users] Glob
Andrew Featherstone
andrew.featherstone at gmail.com
Sat Mar 8 14:07:53 EST 2014
On 03/08/2014 06:27 PM, Russel Winder wrote:
> I want to avoid explicitly listing source files. The source directory
> contains all the files so Glob('*.cc') seems reasonably. However 1 of
> the .cc files should not be included, is is the one source file for the
> second executable. I thought I'd be clever and try:
>
> Glob('*.cc').remove(Glob('specialSourceFile.cc')[0])
>
> but sadly this fails to work. I printed out the full glob and the
> special glob:
>
> AttributeError: 'NoneType' object has no attribute 'name':
>
> So I guess the question is how to have what appears to be lists of
> SCons.Node.FS.File fit with the list operations?
I've used an idiom similar to the following:
file_names = map(str, Glob('*.cc'))
file_names.remove('specialSourceFile.cc')
If you wanted to then end up with a list of file nodes then
File(file_names)
I don't think any information is lost in this process; it's not caused
problems for me. I'd agree you'd expect to be able to do something
similar to your above example, although to be a bit tidier I'd might use
File('specialSourceFiles.cc'), for the case where you are wanting to
remove a single file.
Andrew
More information about the Scons-users
mailing list