#12627: The spkg/bin/sage script engraves paths to executables
--------------------------------+-------------------------------------------
       Reporter:  Snark         |         Owner:  leif           
           Type:  defect        |        Status:  needs_info     
       Priority:  major         |     Milestone:  sage-5.0       
      Component:  scripts       |    Resolution:                 
       Keywords:  rd2           |   Work issues:                 
Report Upstream:  N/A           |     Reviewers:  R. Andrew Ohana
        Authors:  Julien Puydt  |     Merged in:                 
   Dependencies:                |      Stopgaps:                 
--------------------------------+-------------------------------------------

Comment (by leif):

 Replying to [comment:12 Snark]:
 > using PATH instead of putting the PATH inside removes implicit
 dependencies, which makes sage really more modular (things can move around
 and that won't break).

 I don't really understand what you want to "move around".

 As mentioned, the explicit paths, although (or because they are -- in a
 perfect world) redundant, are for safety reasons, since they lead to
 errors if a script is missing, i.e., not where it is supposed to be
 located.  That's IMHO just fine.  And I don't see what you want to make
 "more modular" there.

 W.r.t. `sage --PROGRAM`:

 If you want to run a system-wide installed version of R, type (''outside
 of'' a Sage subshell) `R`.

 If you want to run Sage's version of R, type `sage --R`, or type `R` from
 within a Sage subshell.

 Same for optional components.  The following part of your patch is IMHO
 plain wrong:
 {{{
 #!patch
 diff -r 959bec9e01d9 -r a46cac822f1e spkg/bin/sage
 --- a/spkg/bin/sage Sun Mar 04 18:00:53 2012 +0100
 +++ b/spkg/bin/sage Sun Mar 04 18:03:11 2012 +0100
 @@ -92,11 +92,11 @@
      echo "  -ipython [...]      -- run Sage's IPython using the default
 environment (not"
      echo "                         Sage), passing additional options to
 IPython"
      echo "  -kash [...]         -- run Sage's Kash with given arguments"
 -    test -x "$SAGE_LOCAL/bin/kash" || \
 +    command -v kash &>/dev/null || \
      echo "                         (not installed currently, run sage -i
 kash)"
      echo "  -lisp [...]         -- run Lisp interpreter included with
 Sage"
      echo "  -M2 [...]           -- run Sage's Macaulay2 with given
 arguments"
 -    test -x "$SAGE_LOCAL/bin/M2" || \
 +    command -v M2 &>/dev/null || \
      echo "                         (not installed currently, run sage -i
 macaulay2)"
      echo "  -maxima [...]       -- run Sage's Maxima with given
 arguments"
      echo "  -mwrank [...]       -- run Sage's mwrank with given
 arguments"
 }}}

 along with

 {{{
 #!patch
 diff -r 959bec9e01d9 -r a46cac822f1e spkg/bin/sage
 --- a/spkg/bin/sage Sun Mar 04 18:00:53 2012 +0100
 +++ b/spkg/bin/sage Sun Mar 04 18:03:11 2012 +0100
 @@ -417,7 +417,7 @@
  if [ "$1" = '-kash'  -o "$1" = '--kash' ]; then
      cd "$CUR"
      shift
 -    "$SAGE_LOCAL/bin/kash" "$@"
 +    kash "$@"
      exit $?
  fi

 }}}

 and

 {{{
 #!patch
 diff -r 959bec9e01d9 -r a46cac822f1e spkg/bin/sage
 --- a/spkg/bin/sage Sun Mar 04 18:00:53 2012 +0100
 +++ b/spkg/bin/sage Sun Mar 04 18:03:11 2012 +0100
 @@ -445,7 +445,7 @@
  if [ "$1" = '-M2'  -o "$1" = '--M2' ]; then
      cd "$CUR"
      shift
 -    "$SAGE_LOCAL/bin/M2" "$@"
 +    M2 "$@"
      exit $?
  fi

 }}}

 (Instead, we should use `test -x "$SAGE_LOCAL"/bin/<program>` there, too,
 and tell the user how to install it in case it's not.  You could of course
 also use {{{case "`command -v <program>`" in ...}}}, although the latter
 might give unexpected results with symlinks; I'm not 100% sure about
 that.)

 Similar for ''standard'' components (and other scripts) of Sage, since if
 -- for whatever reason -- `$SAGE_LOCAL/bin/<program>` is missing, which
 '''is''' an error, no other program along the path which happens to have
 the same name should be run; instead, an appropriate error message should
 be printed.

 If you want to "move things around", why not create symbolic links in
 `$SAGE_LOCAL/bin/`?

 Or you have to be more explicit with ''what'' you want to move, or what
 should be more customizable.

 [[BR]]

 Slightly related:
 {{{
 To install small scripts to directly run Sage's versions of GAP,
 the PARI/GP interpreter, Maxima, or Singular etc. (by typing e.g.
 just 'gap' or 'gp') into a standard 'bin' directory, start Sage
 by typing 'sage' (or './sage') and enter something like

     install_scripts('/usr/local/bin')

 at the Sage command prompt ('sage:').
 }}}
 (Type `install_scripts?` at the Sage prompt for more information, i.e.,
 options to it.)

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