MCPcopy Create free account
hub / github.com/boostorg/build / glob_tree

Function glob_tree

v2/util/path.py:839–855  ·  view source on GitHub ↗

Recursive version of GLOB. Builds the glob of files while also searching in the subdirectories of the given roots. An optional set of exclusion patterns will filter out the matching entries from the result. The exclusions also apply to the subdirectory scanning, such that directories

(roots, patterns, exclude_patterns=None)

Source from the content-addressed store, hash-verified

837 return [x for x in inc if x not in exc]
838
839def glob_tree(roots, patterns, exclude_patterns=None):
840 """Recursive version of GLOB. Builds the glob of files while
841 also searching in the subdirectories of the given roots. An
842 optional set of exclusion patterns will filter out the
843 matching entries from the result. The exclusions also apply
844 to the subdirectory scanning, such that directories that
845 match the exclusion patterns will not be searched."""
846
847 if not exclude_patterns:
848 exclude_patterns = []
849
850 result = glob(roots, patterns, exclude_patterns)
851 subdirs = [s for s in glob(roots, ["*"]) if s != "." and s != ".." and os.path.isdir(s)]
852 if subdirs:
853 result.extend(glob_tree(subdirs, patterns, exclude_patterns))
854
855 return result
856
857def glob_in_parents(dir, patterns, upper_limit=None):
858 """Recursive version of GLOB which glob sall parent directories

Callers

nothing calls this directly

Calls 1

globFunction · 0.90

Tested by

no test coverage detected