Changes between Initial Version and Version 5 of Ticket #378


Ignore:
Timestamp:
02/16/10 00:22:23 (12 years ago)
Author:
mpatel
Comment:

Feel free to improve the patch!

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #378

    • Property Status changed from new to needs_review
    • Property Authors changed from to Mitesh Patel
    • Property Milestone changed from to Sage-2.10
    • Property Summary changed from user-specified sage load path to User-specified path for load and attach
    • Property Priority changed from minor to major
    • Property Report Upstream changed from to N/A
  • Ticket #378 – Description

    initial v5  
     1The attached patch is a first take on
    12{{{
    2 Utpal Sarkar <doetoe@gmail.com>         
    3 to sage-support
    4        
    5 show details
    6          9:17 am (7 minutes ago)
     3#!python
     4sage: load_attach_path()
     5['.']
     6sage: load_attach_path('/path/to/my/sage/scripts')
     7sage: load_attach_path()
     8['.', '/path/to/my/sage/scripts']
     9sage: attach('nifty_script1.sage')
     10sage: attached_files()
     11['/path/to/my/sage/scripts/nifty_script1.sage']
     12}}}
    713
    8 I thought it could work something like this:
    9 As a command line option it could be like an include path or a library
    10 path to gcc, i.e. every option "-I path" (or any other name of the
    11 switch, this is the one for includes in gcc) is added to the existing
    12 default list of paths. This could be useful e.g. when calling sage
    13 from a launcher, in which case you could put these options in the
    14 launcher so that it will always be called with these paths when ran
    15 from the launcher.
    16 As an environment variable it could work just like LD_LIBRARY_PATH,
    17 PYTHONPATH or MAGMA_PATH: a list of paths separated by colons (or some
    18 other separator) whose constituents are also added to the existing
    19 list of paths. For reasons of implementation, maybe it is easier to
    20 just use PYTHONPATH for sage files as well.
    21 If this list would be directly accessible from sage, as in python
    22 where it is stored in sys.path (which is read/write), and moreover
    23 there were the possibility to specify a startup script which would be
    24 executed just before entering the session (like in magma when called
    25 with -s, or in bash and many other linux programs where it is a
    26 standard file .bashrc), then you could also append your paths to the
    27 standard list in the startup script.
    28 When calling "load" or "attach" from sage with a non-absolute path, it
    29 would cycle through this list, concatenating the paths with the string
    30 passed to load or attach, until it finds the file.
    31 If you consider this useful, and you could implement any of these in
    32 sage, that would be great!
    33 
    34 Thanks,
    35 
    36 Utpal
    37 
    38 
     14Please see `sage.misc.preparser.load_attach_path`'s docstring for options.  You can also set an environment variable:
     15{{{
     16#!sh
     17$ export SAGE_LOAD_ATTACH_PATH="$HOME/foo:$HOME/bar"
     18$ sage
     19sage: load_attach_path()
     20['.', '/home/mpatel/foo', '/home/mpatel/bar']
    3921}}}
     22Note:  We now use the full path in the attached files dictionary.