I noticed that for non-sage code that is imported from site-packages, the 
current editor code does not get us the right file:

here it does the right substitution (because it's part of sage!)

sage: sage.misc.sageinspect.sage_getfile(edit)
'/usr/local/sage/sage-git/local/lib/python2.7/site-packages/sage/misc/edit_module.py'
sage: sage.misc.edit_module.file_and_line(edit)
('/usr/local/sage/sage-git/src/sage/misc/edit_module.py', 214)

Here I don't think it gets it right:

sage: sage.misc.sageinspect.sage_getfile(Crypto)
'/usr/local/sage/sage-git/local/lib/python2.7/site-packages/Crypto/__init__.py'
sage: sage.misc.edit_module.file_and_line(Crypto)
('/usr/local/sage/sage-git/src/Crypto/__init__.py', 0)

As you can see it redirects to $SAGE_SRC/Crypto/__init__.py which doesn't 
exist (and probably never did, because I think the python spkg gets built 
elsewhere). So, I think the current heuristic gets it wrong in these cases. 
Hence, I would propose including the "/sage" in the regexp, i.e.:

   runpathpattern = '^'+sage.env.SAGE_LIB+"/sage"
   develbranch = sage.env.SAGE_SRC+"/sage"
   filename=re.sub(runpathpattern,develbranch,filename)

(or perhaps we need to do something more fancy to get the right match)

A similar change would be made to the function edit_devel in the same file 
(which provides the "%ed" magic IPython command)

Am I overlooking something that would make such a change a bad idea?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to