[Numpy-discussion] distutils for a Pyrex module

Pierre GM pgmdevlist@gmail....
Tue Mar 20 17:45:35 CDT 2007


On Tuesday 20 March 2007 18:13:09 Robert Kern wrote:
> Pierre GM wrote:
> Hmm. Okay, put the FORTRAN files into a library instead.

Robert, Pearu, great ! Creating a library did the trick. I eventually come 
with that:
########################
def configuration(parent_package='',top_path=None):
    from numpy.distutils.misc_util import Configuration, get_mathlibs
    config = Configuration('cloess',parent_package,top_path)
    from numpy.distutils.system_info import get_info, dict_append
    #
    f_sources = ('loessf.f', 'linpack_lite.f')
    config.add_library('floess', 
                       sources = [join('src',x) for x in f_sources])
    #
    blas_info = get_info('blas_opt')
    lapack_info = get_info('lapack_opt')
    #    
    c_sources = ['cloess.c', 'loess.c', 'loessc.c', 'misc.c', 'predict.c',]
    #
    build_info = {}
    dict_append(build_info, **blas_info)
    dict_append(build_info, **lapack_info)    
    dict_append(build_info, libraries=['floess'])
    #  
    config.add_extension('_loess',
                         sources=[join('src', x) for x in c_sources],
                         **build_info
                        )
    config.add_data_dir(join('.','examples'))
    config.add_data_files('pyloess.py')
    return config
#########################
However, I still don't get a usable module: I have:
ImportError: dynamic module does not define init function (init_loess). It 
looks like src/loess.c gets compiled before /src/cloess.c... 


More information about the Numpy-discussion mailing list