#9992: Python scripts try to run before Python is built.
------------------------+---------------------------------------------------
   Reporter:  drkirkby  |          Owner:  GeorgSWeber                 
       Type:  defect    |         Status:  needs_review                
   Priority:  major     |      Milestone:  sage-4.7.2                  
  Component:  build     |       Keywords:  sage-make_relative sage-spkg
Work_issues:            |       Upstream:  N/A                         
   Reviewer:            |         Author:  Leif Leonhardy              
     Merged:            |   Dependencies:                              
------------------------+---------------------------------------------------
Changes (by newvalueoldvalue):

  * keywords:  => sage-make_relative sage-spkg
  * status:  new => needs_review
  * author:  => Leif Leonhardy


Old description:

> As discussed [http://groups.google.com/group/sage-
> devel/browse_thread/thread/9788a6ad6fe03ab9 here], the Python script
> {{{$SAGE_ROOT/spkg/base/sage-make_relative}}} is run before Python is
> built in Sage. On a system that do not have Python installed (like a
> fresh install of IBM's AIX operating system),  this generates an error
> message message as this script is run.
>
> {{{
> Making Sage/Python scripts relocatable...
> python: No such file or directory
> }}}
>
> This could be quite worrying, to find that an important program like
> Python is missing.
>
> The bottom of the file {{{$SAGE_ROOT/spkg/base/sage-spkg}}} has this:
>
> {{{
> #!sh
> echo "Making Sage/Python scripts relocatable..."
>
> cd "$SAGE_LOCAL"/bin
> ./sage-make_relative
>
> echo "Finished installing $PKG_NAME.spkg"
>
> # It's OK if the above fails -- in fact it will until Python
> # itself gets installed. That's fine.
> exit 0
> }}}
>
> which indicates a failure of {{{sage-make_relative}}} is unimportant. But
> still it is annoying and led me to believe there was a more serious bug.
>
> It does not seem appropriate to let {{{sage-make_relative}}} fail, but it
> would be much better if {{{sage-make_relative}}} can be removed, and its
> functionality moved to the script that calls it, which is
> {{{$SAGE_ROOT/spkg/base/sage-spkg}}}.
>
> I've attached a copy of {{{$SAGE_ROOT/spkg/base/sage-make_relative}}},
> which I believe could be written much better. I'm attaching it, since I
> will want to create an external link to this file.
>
> Dave

New description:

 As discussed [http://groups.google.com/group/sage-
 devel/browse_thread/thread/9788a6ad6fe03ab9 here], the Python script
 {{{$SAGE_ROOT/spkg/base/sage-make_relative}}} is run before Python is
 built in Sage. On a system that do not have Python installed (like a fresh
 install of IBM's AIX operating system),  this generates an error message
 message as this script is run.

 {{{
 Making Sage/Python scripts relocatable...
 python: No such file or directory
 }}}

 This could be quite worrying, to find that an important program like
 Python is missing.

 The bottom of the file {{{$SAGE_ROOT/spkg/base/sage-spkg}}} has this:

 {{{
 #!sh
 echo "Making Sage/Python scripts relocatable..."

 cd "$SAGE_LOCAL"/bin
 ./sage-make_relative

 echo "Finished installing $PKG_NAME.spkg"

 # It's OK if the above fails -- in fact it will until Python
 # itself gets installed. That's fine.
 exit 0
 }}}

 which indicates a failure of {{{sage-make_relative}}} is unimportant. But
 still it is annoying and led me to believe there was a more serious bug.

 It does not seem appropriate to let {{{sage-make_relative}}} fail, but it
 would be much better if {{{sage-make_relative}}} can be removed, and its
 functionality moved to the script that calls it, which is
 {{{$SAGE_ROOT/spkg/base/sage-spkg}}}.

 I've attached a copy of {{{$SAGE_ROOT/spkg/base/sage-make_relative}}},
 which I believe could be written much better. I'm attaching it, since I
 will want to create an external link to this file.

 Dave

 ----

 Apply
  1. [attachment:trac_9992-run_sage-
 make_relative_conditionally.scripts.patch]
 to the Sage '''scripts repository'''.

--

Comment:

 Attached patch only runs `sage-make_relative` if '''Sage's''' Python is
 installed (which Dave wanted).

 If we want to allow other `python`s as well, we'd have to change it to
 e.g.
 {{{
 #!sh
 if command -v python >/dev/null; then
     ...
 }}}

 I've left the `exit 0` at the end (which is in principle superfluous since
 `echo` is unlikely to fail), as it clarifies that this part is (hopefully
 ;-) ) only reached if no errors occurred previously.

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