[Numpy-tickets] [NumPy] #751: distutils does not seem to handle the ALL section in site.cfg

NumPy numpy-tickets@scipy....
Thu Apr 24 21:06:02 CDT 2008

#751: distutils does not seem to handle the ALL section in site.cfg
 Reporter:  cdavid  |        Owner:  cdavid  
     Type:  defect  |       Status:  assigned
 Priority:  normal  |    Milestone:          
Component:  Other   |      Version:  none    
 Severity:  normal  |   Resolution:          
 Keywords:          |  
Changes (by cdavid):

  * status:  new => assigned
  * owner:  somebody => cdavid


 I am talking about numpy build, i.e. when bootstrapping. I made sure I had
 no numpy/scipy installer to avoid possible confusion, too.

 I don't know the exact changes you made, but the problem is that the
 DEFAULT section is handled automatically by the OptionParser, which is why
 you don't see any mention of it in distutils. More precisely, OptionParser
 takes an option dictiobnary for default option values, which is
 automatically appended to any other section. If you have a [DEFAULT] value
 in the site.cfg, it overrides this, and you get the default option values
 from there instead.

 For example:

 from ConfigParser import ConfigParser

 # Add a default library_dirs option
 defaults = {}
 defaults['library_dirs'] = "foo"

 # Create the config parser
 cfg = ConfigParser(defaults)
 # Put a library_dirs option bar in the section [ALL] or [DEFAULT] in

 # Add the (empty) section foosec, which is NOT present in the site.cfg
 # system_info)

 # foosec section has the values in the defaults dict, although it was
 # empty
 print cfg.get("foosec", "library_dirs")

 In the case of [DEFAULT], you will get bar. In the case of [ALL], you will
 get foo.

 I don't really know what to do here: I think there is way too much magic
 in this part of the code anyway, it should be simplified. But doing so
 without breaking system_info may not be trivial.

Ticket URL: <http://scipy.org/scipy/numpy/ticket/751#comment:2>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.

More information about the Numpy-tickets mailing list