#8474: Detect whether a program is in the path
-----------------------------+----------------------------------------------
   Reporter:  jhpalmieri     |       Owner:  drkirkby  
       Type:  defect         |      Status:  new       
   Priority:  blocker        |   Milestone:  sage-4.3.4
  Component:  porting        |    Keywords:            
     Author:  John Palmieri  |    Upstream:  N/A       
   Reviewer:                 |      Merged:            
Work_issues:                 |  
-----------------------------+----------------------------------------------
 In various places in the Sage library, we test for the existence of
 programs using code like this:
 {{{
 import os
 if os.system('which program') == 0:
     # program exists
 else:
     # it doesn't
 }}}
 On Solaris, executing "which program" seems to return 0 regardless of
 whether the program actually exists, and so any code like this is broken.
 For example, try this on t2.math:
 {{{
 sage: from sage.misc.latex import have_latex
 sage: have_latex()
 True
 sage: import os
 sage: os.system('which latex')
 no latex in /usr/local/sage-4.3.0.1-Solaris-10-SPARC-sun4u-or-
 sun4v/local/lib /usr/local/sage-4.3.0.1-Solaris-10-SPARC-sun4u-or-sun4v
 /usr/local/sage-4.3.0.1-Solaris-10-SPARC-sun4u-or-sun4v/local/bin
 /usr/local/gcc-4.4.1-sun-linker/bin /usr/local/bin2 /usr/bin /usr/ccs/bin
 /usr/local/bin /usr/sfw/bin /bin /usr/sbin
 0
 }}}

 So we should have a function which replaces this, and we should use it in
 the Sage library.  On IRC, mhansen says
 {{{
 <mhansen> I think you can use "type" on Solaris
 }}}
 The "type" command actually works for me on several different platforms,
 and so it's what the patch uses.

 This needs testing on lots more different platforms to make sure it's
 portable.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8474>
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