dependencies.
"""
+ fs = SCons.Node.FS.default_fs
try:
- paths = env.Dictionary("CPPPATH")
+ paths = map(lambda x, dir=fs.Dir: dir(x),
+ env.Dictionary("CPPPATH"))
except KeyError:
paths = []
angle_includes = angle_re.findall(contents)
quote_includes = quote_re.findall(contents)
- source_dir = os.path.dirname(filename)
+ dir = os.path.dirname(filename)
+ if dir:
+ source_dir = [fs.Dir(dir)]
+ else:
+ source_dir = []
- return (SCons.Util.find_files(angle_includes, paths + [source_dir],
+ return (SCons.Util.find_files(angle_includes, paths + source_dir,
node_factory)
- + SCons.Util.find_files(quote_includes, [source_dir] + paths,
+ + SCons.Util.find_files(quote_includes, source_dir + paths,
node_factory))
except OSError:
return []
files it finds as dependencies.
"""
+ fs = SCons.Node.FS.default_fs
try:
- paths = env.Dictionary("LIBPATH")
+ paths = map(lambda x, dir=fs.Dir: dir(x),
+ env.Dictionary("LIBPATH"))
except KeyError:
paths = []
find_files([str], [str]) -> [nodes]
filenames - a list of filenames to find
- paths - a list of paths to search in
+ paths - a list of directory path *nodes* to search in
returns - the nodes created from the found files.
Finds nodes corresponding to either derived files or files
that exist already.
- Only the first fullname found is returned for each filename, and any
- file that aren't found are ignored.
+ Only the first file found is returned for each filename,
+ and any files that aren't found are ignored.
"""
nodes = []
for filename in filenames:
- for path in paths:
- fullname = os.path.join(path, filename)
+ for dir in paths:
try:
- node = node_factory(fullname)
+ node = node_factory(filename, dir)
# Return true of the node exists or is a derived node.
if node.builder or \
(isinstance(node, SCons.Node.FS.Entry) and node.exists()):
fs = SCons.Node.FS.FS(test.workpath(""))
node_derived = fs.File(test.workpath('./bar/baz'))
node_derived.builder_set(1) # Any non-zero value.
- nodes = find_files(['foo', 'baz'],
- map(test.workpath, ['./', './bar' ]), fs.File)
+ paths = map(lambda x, fs=fs: fs.Dir(x), ['./', './bar'])
+ nodes = find_files(['foo', 'baz'], paths, fs.File)
file_names = map(str, nodes)
file_names = map(os.path.normpath, file_names)
assert os.path.normpath('./foo') in file_names, file_names