[Distutils] Package Meta-information Patch

Greg Stein gstein@lyra.org
Tue, 18 Jan 2000 16:19:51 -0800 (PST)

On Tue, 18 Jan 2000, Michael Muller wrote:
> You are correct (with the exception of "shlib" - which I seem to be unable to
> import; new module?).  However, none of these was as easy to use as this:
>    execfile(os.path.join(default_location, name), globals)

I use:

     parser = ConfigParser.ConfigParser()
     parser.read(os.path.join(default_location, name)

The biggest difference between the ConfigParser and the execfile()
approach is that the latter can easily create complicated structures. For
the ConfigParser, you may need to do something like:

    files = map(string.strip,
                string.split(parser.get('info', 'files'), ','))

For each "structured" entry.

> Writing the file was slightly more difficult, it took a whopping 9 lines of
> code.

Writing a .ini might be a bit longer, but it mostly depends on the input
structures and the number of output sections.


Greg Stein, http://www.lyra.org/