Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2006-07-25 02:52:00


On Wednesday 26 April 2006 18:20, Mark Evans wrote:
> Hi Vladimir,
>
> How did you search / find the references you posted. Good stuff.
>
> I hammered a little on the recursive-find rule of João Abecasis and
> arrived at the following interface:

> # Recursively find files matching a given pattern in a set of filesystem
> # trees. Files that match a file-skip pattern (parameter skip-patterns-or-files)
> # are pruned from the result set. Similarly, directories that match a
> # directory-skip pattern (parameter skip-patterns-or-dirs) are pruned.
> # The number of recursion levels can be limited with optional max-depth
> # argument. For example, max-depth of 1 limits the search to 1 level of
> # subdirectories. By default, there is no recursion limit.
> #
> # Example:
> #
> # [ recursive-find . : *.cpp *.h : bar* : bum* : 5 ]
> #
> # searches the current directory (of invoking jamfile) for *.cpp and *.h
> # files, excluding any files that match "bar*" and excluding any
> # directories that match "bum*". Subdirectory depth is limited to 5.
> #
> rule recursive-find (
> search-dirs + # trees to search
> : patterns-or-files * # patterns to search for
> : skip-patterns-or-files * # patterns for files to be pruned
> : skip-patterns-or-dirs * # patterns for directories to be pruned
> : max-depth ? # maximum number of recursion levels
> )
>

Mark, overall, the patch is fine. I've some comments though:

1. Some lines of the code, including the above comment are longer than 80 characters,
which means it troublesome to post them via email, read on console, and so on.

2. I thin "pattern-or-files" is a bad name. Strictly speaking, string without metacharacters
is also a pattern, and using "-or-" sounds confusing. In fact, you say yourself:

> : patterns-or-files * # patterns to search for

So comment just say "pattern". I'd suggest this:

> rule recursive-find (
> search-dirs + # trees to search
> : file-patterns * # patterns to search for
> : exclude-patterns * # patterns for files to be pruned
> : dir-exclude-patterns * # patterns for directories to be pruned
> : max-depth ? # maximum number of recursion levels

3. It would be great to have some tests for this functionality, we already have glob.py
which can be augmented or used as reference. You've mentioned you had problems running
the testcase, did you solve them? If no, we only need to run the new test, and it should
be easy to get working. Let me know what problems are there.

Mark,
do you have the time to address those issues at the moment? If not, no problem,
I'll get to that eventually.

Thanks,
Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2

Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk