On Jun 26, 1:15 pm, gsw <georgswe...@googlemail.com> wrote:
> On 26 Jun., 21:34, Arnaud Bergeron <aberge...@gmail.com> wrote:
>
>
>
>
>
> > 2009/6/26 kcrisman <kcris...@gmail.com>:
>
> > > On Jun 26, 2:24 pm, John H Palmieri <jhpalmier...@gmail.com> wrote:
> > >> On Jun 26, 10:33 am, kcrisman <kcris...@gmail.com> wrote:
>
> > >> > > > I'm really sorry this is so weird.  This is OSX.4 on a PPC, so 
> > >> > > > perhaps
> > >> > > > something got changed in those scripts recently?
>
> > >> > > Yes, it got changed in #5806. Can you try
>
> > >> > >  find SAGE_ROOT/devel/sage/sage// \( -name *.py \) -exec grep -i -H
> > >> > > cannot {} +
>
> > >> > Same error.  I tried putting a ; in various places, but to no avail.
>
> > >> How about if you replace the "+" at the end with "\;"?
>
> > The '+' thing is a GNUism.  That's why it doesn't work on 10.4.  You should 
> > use

It's also in Mac OS X 10.5, which still claims to be BSD.  See the web
page

<http://developer.apple.com/documentation/Darwin/Reference/ManPages/
man1/find.1.html>

> Wow,
> on my MacIntel OS X 10.4.11 box the following command *does work
> fine*:
>
> find /Users/Shared/sage/sage-4.0.2/devel/sage/sage// \( -name *.py \) -
> exec grep -i -H cannot {} +
>
> especially this command has got this "GNUish +" at the end, but on my
> MacPPC OS X 10.4.11 box I get this strange error message (find: -exec:
> no terminating ";"), too.
> Weird!
> So it is not a OS X 10.4.11 issue, but rather a MacPPC versus MacIntel
> issue --- OS X 10.5 won't install on my MacPPC box (it has got only
> 550MHz), could someone please check this on a MacPPC with OS X 10.5,
> e.g. at the Sage build farm?
>
>
>
> > find $SAGE_ROOT/devel/sage/sage/ \( -name '*.py' \) -print0 | xargs -0
> > grep -i -H 'cannot'
>
> This version of the command works fine on *both* the OS X 10.4.11
> MacIntel and MacPPC, and is fast.
>
> > So that you get the behavior that '+' gives (limit the number of
> > invocations of grep) and stay portable.
>
> > > Bingo!
>
> > > find Desktop/sage-4.1.alpha1/devel/sage/sage// \( -name *.py \) -exec
> > > grep -i -H Palmieri {} \;
>
> This one works on both boxes, too, but behaves way slower.
>
> Cheers,
> gsw

For portability and ease of debugging (but not necessarily for speed),
I'm working on redoing all of this in python, using os.walk to replace
the find command.  Assuming that this is a good idea, I have an
implementation question: at the moment, if you do

sage: search_src('submatrix', 'starting', '0')

then you get matches like

matrix/matrix0.pyx:        Get The 2 x 2 submatrix of M, starting at
row index and column

Notice that the third argument '0' is not in the Sage source code, but
only in the file name.  This is not what the documentation says that
the function is supposed to do.  Should we change the documentation or
the behavior?

That is, we have

def search_src(string, extra1='', extra2='', extra3='', extra4='',
extra5='', interact=True):

Should the strings extra1, etc., be searched for only in the source
code, or should they be searched for both in the source code and the
file name?

  John

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to