Ant Globs¶
Apache Ant fileset is documented at the Apache Ant project:
Examples¶
Ant Globs are like simple file globs (they use ? and * in the same way), but include powerful ways for selecting directories. The examples below use the Ant glob naming, so a leading slash represents the top of the search, not the root of the file system.
*.py
- Selects every matching file anywhere in the whole tree
- Matches
/foo.pyand/bar/foo.pybut not/foo.pycor/bar/foo.pyc//*.pySelects every matching file in the root of the directory (but no deeper).
Matches
/foo.pybut not/bar/foo.py/myapp/**- Matches all files under
/myappand below./myapp/**/__init__.py- Matches all
__init__.pyfiles/myappand below.dir1/__init__.pySelects every
__init__.pyin directorydir1.dir1directory can be anywhere in the directory treeMatches
/dir1/file.py,/dir3/dir1/file.pyand/dir3/dir2/dir1/file.pybut not/dir1/another/__init__.py.**/dir1/__init__.py- Same as above.
/**/dir1/__init__.py- Same as above.
/myapp/**/dir1/__init__.pySelects every
__init__.pyin dir1 in the directory tree/myappunder the root.Matches
/myapp/dir1/__init__.pyand/myapp/dir2/dir1/__init__.pybut not/myapp/file.txtand/dir1/file.txt
Default excludes¶
Ant FileSet (and Formic) has built-in patterns to screen out a lot of development
‘noise’, such as hidden VCS files and directories. The full list is at
get_initial_default_excludes().
Default excludes can be simply switched off on both the command line and the API, for example:
$ formic -i "*.py" -e "__init__.py" "**/*test*/" "test_*" --no-default-excludes