On 2010-Jul-19 23:20:40 +0100, "Dr. David Kirkby" <david.kir...@onetel.net> 
wrote:
>> How about an extension to the standard environment variable parsing
>> so that SAGE_FOO_bar is equivalent to (and overrides) SAGE_FOO in
>> package 'bar' only?  This allows variables to be overridden for
>> specific packages without having to explicitly define lots of
>> specific environment variables.
>>
>> Assuming $pkg contains the package name, you can assign the result
>> to 'FOO' with:
>>     eval FOO="\${SAGE_FOO_$pkg:-$SAGE_FOO}"
>>
>
>So if I understand you correctly,
>
>SAGE_NUM_THREADS=10
>
>would set 10 threads globally in Sage, but
>
>SAGE_NUM_THREADS_ATLAS=1
>
>would override the 10 to 1 (single threaded) for just ATLAS. Have I got you 
>correct? If so, that sounds an excellent idea.

In general, yes, except I was thinking that it would be
  SAGE_NUM_THREADS_atlas=1
(ie using $PKG_BASE). This means the override would be something like:
  eval FOO="\${SAGE_NUM_THREADS_$PKG_BASE:-$SAGE_NUM_THREADS}"

Note that I haven't looked at the detail of specifically implementing
this, I've just seen this approach to eval'd variables used elsewhere.

-- 
Peter Jeremy

Attachment: pgpwVjXel7sj5.pgp
Description: PGP signature

Reply via email to