hashdist.core.ant_glob
– ant-inspired globbing¶
-
hashdist.core.ant_glob.
ant_iglob
(pattern, cwd='', include_dirs=True)¶ Generator that iterates over files/directories matching the pattern.
The syntax is ant-glob-inspired but currently only a small subset is implemented.
Examples:
*.txt # matches "a.txt", "b.txt" foo/**/bar # matches "foo/bar" and "foo/a/b/c/bar" foo*/**/*.bin # matches "foo/bar.bin", "foo/a/b/c/bar.bin", "foo3/a.bin"
Illegal patterns:
foo/**.bin # '**' can only match 0 or more entire directories
Parameters: pattern : str or list
Glob pattern as described above. If a str, will be split by /; if a list, each item is a path component. It is only possible to specify a non-relative glob if pattern is a string.
cwd : str
Directory to start in. Pass an empty string or ‘.’ for current directory; the former will emit ‘rel/path/to/file’ while the latter ‘./rel/path/to/file’. (This added complexity is present in order to be able to reliably match prefixes by string value).
include_dirs : bool
Whether to include directories, or only glob files.
-
hashdist.core.ant_glob.
has_permission
(path)¶ Returns True if we have ‘listdir’ permissions. False otherwise.