#378: User-specified path for load and attach
------------------------------+---------------------------------------------
Reporter: was | Owner: was
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-4.3.3
Component: user interface | Keywords:
Author: Mitesh Patel | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
------------------------------+---------------------------------------------
Changes (by newvalueoldvalue):
* priority: minor => major
* status: new => needs_review
* author: => Mitesh Patel
Old description:
> {{{
> Utpal Sarkar <[email protected]>
> to sage-support
>
> show details
> 9:17 am (7 minutes ago)
>
> I thought it could work something like this:
> As a command line option it could be like an include path or a library
> path to gcc, i.e. every option "-I path" (or any other name of the
> switch, this is the one for includes in gcc) is added to the existing
> default list of paths. This could be useful e.g. when calling sage
> from a launcher, in which case you could put these options in the
> launcher so that it will always be called with these paths when ran
> from the launcher.
> As an environment variable it could work just like LD_LIBRARY_PATH,
> PYTHONPATH or MAGMA_PATH: a list of paths separated by colons (or some
> other separator) whose constituents are also added to the existing
> list of paths. For reasons of implementation, maybe it is easier to
> just use PYTHONPATH for sage files as well.
> If this list would be directly accessible from sage, as in python
> where it is stored in sys.path (which is read/write), and moreover
> there were the possibility to specify a startup script which would be
> executed just before entering the session (like in magma when called
> with -s, or in bash and many other linux programs where it is a
> standard file .bashrc), then you could also append your paths to the
> standard list in the startup script.
> When calling "load" or "attach" from sage with a non-absolute path, it
> would cycle through this list, concatenating the paths with the string
> passed to load or attach, until it finds the file.
> If you consider this useful, and you could implement any of these in
> sage, that would be great!
>
> Thanks,
>
> Utpal
>
> }}}
New description:
The attached patch is a first take on
{{{
#!python
sage: load_attach_path()
['.']
sage: load_attach_path('/path/to/my/sage/scripts')
sage: load_attach_path()
['.', '/path/to/my/sage/scripts']
sage: attach('nifty_script1.sage')
sage: attached_files()
['/path/to/my/sage/scripts/nifty_script1.sage']
}}}
Please see `sage.misc.preparser.load_attach_path`'s docstring for options.
You can also set an environment variable:
{{{
#!sh
$ export SAGE_LOAD_ATTACH_PATH="$HOME/foo:$HOME/bar"
$ sage
sage: load_attach_path()
['.', '/home/mpatel/foo', '/home/mpatel/bar']
}}}
Note: We now use the full path in the attached files dictionary.
--
Comment:
Feel free to improve the patch!
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/378#comment:5>
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.