[SciPy-User] [SciPy-user] Custom sections in site.cfg

dpo dominique.orban@gmail....
Fri Oct 9 13:10:39 CDT 2009



dpo wrote:
> 
> Hi all,
> 
> Is it possible / easy to add custom sections to a site.cfg for a project
> that relies upon Numpy? I need BLAS, LAPACK etc., and Numpy distutils lets
> me grab those conveniently from site.cfg but I'd like to also add a few
> extra sections.
> 
> Thanks for any pointer, suggestion, or example!
> 

For anybody who might be interested, my temporary solution consists in
having each setup.py script read the config file using a ConfigParser
instance. The downside is that the file is read many times; I am not sure
how to read it once and make all config info visible to other setup.py
scripts.

Each 'configuration' function has bits like the following:

def configuration(parent_package='',top_path=None):
    import ConfigParser
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info

    # Read our custom configuration options.
    custom_config = ConfigParser.SafeConfigParser()
    custom_config.read(os.path.join(top_path, 'site.cfg'))
    custom_option = custom_config.get('CUSTOMSECTION', 'custom_option')

    config = Configuration('mypkg', parent_package, top_path)

    # Get info from site.cfg using the Numpy distutils infrastructure.
    blas_info = get_info('blas_opt',0)
    if not blas_info:
        print 'No blas info found'

    ...

-- 
View this message in context: http://www.nabble.com/Custom-sections-in-site.cfg-tp25788619p25825593.html
Sent from the Scipy-User mailing list archive at Nabble.com.



More information about the SciPy-User mailing list