#10555: Add services to Sage.app
------------------------------------+---------------------------------------
       Reporter:  iandrus           |         Owner:  iandrus            
           Type:  enhancement       |        Status:  needs_work         
       Priority:  major             |     Milestone:  sage-5.3           
      Component:  user interface    |    Resolution:                     
       Keywords:  mac app,services  |   Work issues:                     
Report Upstream:  N/A               |     Reviewers:  Karl-Dieter Crisman
        Authors:  Ivan Andrus       |     Merged in:                     
   Dependencies:  #8473, #11026     |      Stopgaps:                     
------------------------------------+---------------------------------------

Comment (by iandrus):

 Replying to [comment:12 kcrisman]:
 > > or just running /System/Library/CoreServices/pbs which should rebuild
 the services list. If that works, then we should probably add it to the
 README.
 >
 > Awww yeahhhh.  Yup, this works, so you definitely should add this to the
 instructions.

 Done.

 > Unfortunately, apparently it has trouble deciding on an app.  I
 highlighted some text (`2+2`), right-clicked, chose preparse, and got
 > {{{
 > Running...
 > /Users/.../sage-4.4.4-mcbc/data/extcode/sage/ext/mac-
 app/Sage.app/Contents/Resources/script: line 14: cd: /tmp/sage-map-app: No
 such file or directory
 > Setting environment variables
 > /Users/.../sage-4.4.4-mcbc/data/extcode/sage/ext/mac-
 app/Sage.app/Contents/Resources/script: line 18: ./local/bin/sage-env: No
 such file or directory
 > }}}
 > I didn't even know I '''had''' a Sage app in there!  And in fact, I
 don't - I just have the usual data/extcode stuff.  This was a surprise.
 Yes, I have the correct binary picked for the actual existing Sage app (I
 used it to test #10556 just now and `which sage` was always what it was
 supposed to be).
 >
 > Moving this binary off the Desktop and into Downloads fixed the problem.
 Not sure what that was about.  But if you can't even have a command-line
 Sage somewhere around for this, that's a little different from the other
 issues we've seen with multiple Sage.app's.

 Yes, this is a big problem.  That's an old Sage!  IIRC I used to include a
 Sage.app that wasn't fully functional, and then just replaced a few things
 instead of building it.  So old versions of Sage can be a problem.
 Choosing which Sage.app to use is problematic in general though.  AFAICT
 it's not documented anywhere and subject to change etc.  I think it's
 supposed to use the one with the biggest version, but if you build in
 Xcode the version is just SAGE_VERSION.  In my experience it will use a
 running app over one that's not running.

 You can find all versions of Sage.app on your system with
 {{{
 mdfind "kMDItemCFBundleIdentifier == 'org.sagemath.Sage'"
 }}}
 perhaps that should be documented.  I would like to have some concrete
 suggestions before I document it though.

 > ----
 >
 > Trying the services:
 > * Preparse was almost eery.  Seemed to work fine.

 Eery in what way?  A good way?

 > * Trying to ''evaluate'' `2+3` and replace it:
 > {{{
 > The “Evaluate Code in Sage (and replace)” service could not be used
 because the “Sage-click-path-services” application did not provide valid
 data.
 >
 > Try using the service differently, or contact the vendor for an updated
 version of “Sage-click-path-services.”
 > }}}
 >   Whether the server was on or not did not seem to matter.  Oh wait, I
 needed to use `print` ... well, maybe that should be even bigger?  Is it
 possible to detect the word `print`?  Or maybe since we don't really do
 that with the menu shortcut we don't need to here.  What do you think?

 Hmm.   It didn't cause an error for me.  Do you see anything in
 Console.app?  As for requiring print, I agree.  I just call `sage -c`.
 It's hard though because you may not want to see all the output from a
 longer session, and just adding print won't work if there is more than one
 statement.  I don't suppose long chunks of code is a primary use case
 though.


 > * With trying to get it to execute in a new terminal session:
 > {{{
 > sage:  arrow2d(headpoint=None, tailpoint=None); exit
 >
 > 'Use Ctrl-D (i.e. EOF), %Exit, or %Quit to exit without confirmation.'
 > sage:
 > }}}
 >   Wow!  Where did that come from?  I know that sort of message has been
 bandied about elsewhere - has that been built in all the time in the app?
 I haven't seen it in prior testing, that I recall, though that was a long
 time ago.  Awesome.  Except for the fact that in this case it doesn't
 actually exit, since it's inside Sage.  That probably will need a little
 tweaking.

 I didn't see that because I use the "don't exit" variant.  I don't think
 it should be that hard to fix, though perhaps a bit ugly.

 > * As for trying the new worksheet file, this didn't seem to work as
 well.
 > {{{
 >
 
http://localhost:8000/upload_worksheet?url=file://localhost/var/folders/Yy/YytEJm5VEB0+pBRD7JNLe++++TQ/-Tmp-/sage.fp5w.txt
 > }}}
 >   never opened, it just sat like a bump in the browser URL area.

 It's not getting URL encoded.  I'll fix that.

 > * Uncompressing Sage packages is weird.  It creates the directory, but
 with a {{{[space]2}}} after it.  This also causes problems in compressing.

 Okay I see that too.  I know it worked before, so I wonder what changed.

 > * Unpacking spkg command just quits mid-word in the "preview of command"
 popup (I really like this in these things) and there is no scroll bar to
 indicate it goes on.  You have to pull on the popup window and make it
 bigger.

 I have to admit, I don't know what you are talking about with the "preview
 of command" popup.  Are you on Lion?  Maybe they added something wrt
 services.

 >   And then there is this issue.
 > {{{
 > /Users/.../sage-5.1.beta1-flask/sage --pkg_nc /Users/.../brian-1.2.1.p0
 2
 > }}}
 >   which clearly isn't going to work, because there is no
 `brian-1.2.1.p0`, there is only `brian-1.2.1.p0\ 2`.    Whatever escaping
 I do, I then get this error message that you shouldn't have weird
 characters anyway, and then it tells me also that 2.spkg can't be created.
 >   And then even when I make a normal thing, I get
 > {{{
 > Creating Sage package /Users/.../brian-1.2.1.p1
 > tar: brian-1.2.1.p1: Cannot stat: No such file or directory
 > tar: Error exit delayed from previous errors.
 >
 > Created package brian-1.2.1.p1.spkg.
 >
 >     NAME: brian
 >  VERSION: 1.2.1.p1
 >     SIZE: 0K
 >  HG REPO: Error reading repository
 > SPKG.txt: File is missing
 > }}}
 >   i.e. this part is broken, because I shouldn't have to think to use it.

 Okay, I probably never tried it with spaces in the name.  Thanks

 > * What sort of files should give the service for testing?  I can't get
 it for .rst or .py files.  Maybe that's because I don't have Sage as the
 "default open" for such files.
 >   It ''does'' work for folders.  It ''does'' work for .sage files.  But
 you'd think that even for things that weren't default to open in Sage.app,
 they should still do what I ask.

 Which service? The creating an spkg service?  That should only show up for
 directories.

 Thanks for all the testing, I know it's a thankless job and I'm sorry
 nothing works.  :-(  I'm not sure when I can get to fixing these since I
 _really_ need to work on my thesis and they probably aren't simple fixes.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10555#comment:13>
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