#10192: SageNB fails to install when SAGE_PATH is set to '.'
------------------------------+---------------------------------------------
   Reporter:  hivert          |          Owner:  jason, was                     
                                                        
       Type:  defect          |         Status:  needs_review                   
                                                        
   Priority:  major           |      Milestone:  sage-4.7.2                     
                                                        
  Component:  build           |       Keywords:  notebook installation dot 
PYTHONPATH easy_install easy-install pth sage-spkg setuptools
Work_issues:                  |       Upstream:  N/A                            
                                                        
   Reviewer:  Florent Hivert  |         Author:  Leif Leonhardy                 
                                                        
     Merged:                  |   Dependencies:                                 
                                                        
------------------------------+---------------------------------------------

Comment(by leif):

 Replying to [comment:14 ppurka]:
 > Replying to [comment:13 leif]:
 > > And what's the advantage of running `sed` (and twice `test`, and
 `echo`) multiple times in a loop? B)
 > >
 > > I'm not sure right now whether my patch is up-to-date btw., as the
 currently attached one doesn't remove redundant slashs and (e.g.) `./`...
 8/
 > The main point in the patch is the separator that is redefined to ':'.

 Well, I know `IFS`, but I don't want to run it in a loop; that was my
 point.

 My improved code snippet (simplified and catching additional instances;
 using a single invocation of `sed`) looks like this:
 {{{
 #!sh
 $ echo $EXAMPLE; echo; echo ":$EXAMPLE:" | sed \
 -e 's|/\+|/|g' \
 -e 's|:\(\./\)\+|:|g' \
 -e 's|\(/\.\)\+:|:|g' \
 -e 's|\(:\.\)\+:|:|g' \
 -e 's|:\+|:|g' -e 's|^:\+||' -e 's|:\+$||'
 .::./././//./://bingo//:baz:::://///:./.:.

 /bingo/:baz:/
 }}}

 [[BR]]

 > This is important because this catches all the bad cases like `..`,
 `./.`, `.`, etc.

 We only have to catch "`.`" (i.e., the current working directory)
 ''here''.

 [[BR]]

 > (In relation to #11914, I tried to cd to devel/sage/sage and ran sage as
 `SAGE_PATH=.. sage -n` and it failed to run. So we should definitely weed
 out at least `..` by itself.)

 IMHO not.  If you put things into `SAGE_PATH`, you have to live with the
 results (or side-effects) ''in that case''.  Or we have to do that in
 `sage-sage`, before we (try to) start the notebook only, independently of
 the fix to `sage-env` at #11914 (and of course `sage-spkg`, which is
 patched here).

 A better approach in the case of the notebook would perhaps be to directly
 test whether any component of `PYTHONPATH` yields `devel/sage-*/` (or has
 a subdirectory `sage` with an `__init__.py` file in it), or, probably
 easiest, ''prepend'' the correct directory to `PYTHONPATH` before running
 `sage-notebook`.

 (We should better discuss the latter on #11914.)

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