[Scons-users] Reading SCons.Variables from file

Pawel Tomulik ptomulik at meil.pw.edu.pl
Tue Nov 13 19:39:17 EST 2012


W dniu 14.11.2012 01:20, Evan Driscoll pisze:

> On 11/13/2012 05:29 PM, Pawel Tomulik wrote:

>> Hi,

>>

>> The API documentation for SCons.Variables.Variables.__init__()

>>

>> http://www.scons.org/doc/latest/HTML/scons-api/SCons.Variables.Variables-class.html#__init__

>>

>>

>> states what follows:

>>

>> files - [optional] List of option configuration files to load

>> (backward compatibility) If a single string is passed it is

>> automatically placed in a file list

>>

>> Does the "backward compatibility" mean that there is another

>> better way to read variables from file, another/better way to

>> specify the filename(s), the function accepts a list only for

>> backward compatibility reasons or what can it mean at all?

>

> My reading:

>

> Variables.__init__() can take multiple files:

>

> Variables(files=["myfile1", "myfile2"])

>

> or a single file:

>

> Variables(file=["myfile"])

>

> and that the latter is also accepted as

>

> Variables(file="myfile")

>

> for backwards compatibility reasons (maybe at one point you could only

> specify a single file?).

>

>

> I don't know of another way to read variables from a file (well, you

> could code it up manually...), just that it may be recommended to use

> the Variables(file=["myfile"]) form even for singletons. I am not sure

> how strong of a recommendation this is, however.

>

> Evan

>

>


It makes sense, thanks.

Another question:

Current implementation reads values from file during 'Update()'.
The only documented way to introduce filename(s) to the object
is at initialization phase (__init__()). The filenames are kept
in objects 'files' attribute. If I need to modify the file list
on already initialized object, do you think is this a good idea
to do this by accessing this (undocumented) attribute?


--
Paweł Tomulik



More information about the Scons-users mailing list