Skip to content

Elegant glob like function #512

Closed
Closed
@bdbaddog

Description

@bdbaddog

This issue was originally created at: 2003-05-20 09:56:33.
This issue was reported by: prabhu_r.
prabhu_r said at 2003-05-20 09:56:33

It would be nice if SCons provided a way to glob files
inside the source directory (and subdirectories inside
the source dir) while being run from a build directory.
Currently if one builds the targets inside a separate
build directory with no duplication like so:

BuildDir('lib', 'src', duplicate=0)

then you need to use glob like so:

src = glob.glob("../src/*.C")
src = [ os.path.basename(x) for x in src]

This is inelegant. So perhaps SCons can provide a
function that looks and feels like glob but executes in
the right directory and looks something like this:

src = Glob(".C")
src.extend(Glob("subdir/
.C")
...

stevenknight said at 2004-09-03 06:17:42

Adding the following comment from duplicate #913133, "Add
smart Glob() built-in function" submitted by Tim Keating:

A common shortcut for specifying files to build is:

srcFiles = glob.glob( '*.cxx' )

Unfortunately, if you specify an alternate BuildDir,
this won't work:

srcFiles = glob.glob( '#foo/*.cxx' )

It would be cool if the library included a Glob()
wrapper func that expanded relative-to-SConstruct paths
before passing them to glob.glob().

issues@scons said at 2004-09-03 06:17:42

Converted from SourceForge tracker item 740593

stevenknight said at 2007-09-27 17:37:14

Added a Glob() function that matches in-memory Nodes as well as on-disk files
and directories, with a lot of options to vary the behavior:

http://scons.tigris.org/servlets/ReadMsg?list=dev&msgNo=4330
http://scons.tigris.org/servlets/ReadMsg?list=commits&msgNo=1026

Thanks,

Votes for this issue: 1.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions