Ticket #6429 (closed enhancement: fixed)
[with patch; positive review] sagedoc: make search_src and friends less OS dependent
| Reported by: | jhpalmieri | Owned by: | jhpalmieri |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-4.1 |
| Component: | misc | Keywords: | |
| Cc: | ddrake, craigcitro | Author(s): | John Palmieri |
| Report Upstream: | Reviewer(s): | Dan Drake | |
| Merged in: | sage-4.1.rc0 | Work issues: |
Description (last modified by jhpalmieri) (diff)
As discussed in this thread on sage-devel, the search_src, search_doc, and search_def functions use the unix 'find' command, and since there are different versions of the command which take incompatible arguments, there are problems with those functions. The attached patch reworks all of these to use pure Python rather than 'find'. It might be a little slower, but it should be more robust.
This patch also adds two new arguments to those functions. From the docstring:
- ``path_re`` (optional, default '') - regular expression which
the filename (including the path) must match.
- ``module`` (optional, default 'sage') - the module in which to
search. The default is 'sage', the entire Sage library.
(Actually, module doesn't make sense for search_doc, so it's not available there.)
For example:
search_src("matrix", module="sage.calculus")
with tab completion available as you type in "sage.calculus", or to accomplish essentially the same thing:
search_src("matrix", path_re="calc")
This depends on the patch at #6418.

