[Distutils] uses for setup.cfg and extracting data from it

P.J. Eby pje at telecommunity.com
Wed Sep 9 16:31:48 CEST 2009

At 11:25 PM 9/9/2009 +1000, Ben Finney wrote:
>That's one of the pain points of the current distutils capability: 
>there's no standard-library way to extract that information.

If you're talking about setup.cfg (and all the other distutils .cfg 
files), all you need to do is create a Distribution object and call 
parse_config_files() on it, then access the appropriate 
attributes.  Take you maybe 3 or 4 lines of code.

If you're talking about setup.py, all you need to do is use the 
distutils functions that allow you to run a setup.py without 
executing any of its commands.  (Of course, you then need to be able 
to deal with badly-behaved setup scripts, and it's true there's no 
stdlib support for that.)

More information about the Distutils-SIG mailing list