#12037: `search_src` and friends shouldn't look in hidden files
---------------------------+------------------------------------------------
   Reporter:  ddrake       |          Owner:  jason   
       Type:  enhancement  |         Status:  new     
   Priority:  major        |      Milestone:  sage-4.8
  Component:  misc         |       Keywords:          
Work_issues:               |       Upstream:  N/A     
   Reviewer:               |         Author:          
     Merged:               |   Dependencies:          
---------------------------+------------------------------------------------

Comment(by jhpalmieri):

 I've been annoyed about this too.  Something like this should do it:
 {{{
 #!diff
 diff --git a/sage/misc/sagedoc.py b/sage/misc/sagedoc.py
 --- a/sage/misc/sagedoc.py
 +++ b/sage/misc/sagedoc.py
 @@ -695,6 +695,9 @@ You can build this with 'sage -docbuild
      # done with preparation; ready to start search
      for dirpath, dirs, files in os.walk(os.path.join(base_path, module)):
          for f in files:
 +            # if f matches some pattern because it's a temporary file,
 skip it:
 +            if f.startswith('.#'):
 +                continue
              if re.search("\.(" + "|".join(exts) + ")$", f):
                  filename = os.path.join(dirpath, f)
                  if re.search(path_re, filename):
 }}}
 But maybe a regular expression match for temporary files would be better,
 perhaps combined with the line "if re.search(...)".  Are there any
 patterns to ignore besides ".#..."?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12037#comment:1>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to