Пример #1
0
def configuration(parent_package='',top_path=None):
    import numpy
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, dict_append

    config = Configuration('umfpack', parent_package, top_path)
    config.add_data_dir('tests')

    umf_info = get_info('umfpack', notfound_action=1)

    umfpack_i_file = config.paths('umfpack.i')[0]

    def umfpack_i(ext, build_dir):
        if umf_info:
            return umfpack_i_file

    blas_info = get_info('blas_opt')
    build_info = {}
    dict_append(build_info, **umf_info)
    dict_append(build_info, **blas_info)

    #config.add_extension('__umfpack',
    #                      sources=[umfpack_i],
    #                      depends=['umfpack.i'],
    #                      **build_info)

    return config
Пример #2
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, dict_append

    config = Configuration('umfpack', parent_package, top_path)
    config.add_data_dir('tests')

    umf_info = get_info('umfpack', notfound_action=1)

    ## The following addition is needed when linking against a umfpack built
    ## from the latest SparseSuite. Not (strictly) needed when linking against
    ## the version in the ubuntu repositories.
    umf_info['libraries'].insert(0, 'rt')

    umfpack_i_file = config.paths('umfpack.i')[0]

    def umfpack_i(ext, build_dir):
        if umf_info:
            return umfpack_i_file

    blas_info = get_info('blas_opt')
    build_info = {}
    dict_append(build_info, **umf_info)
    dict_append(build_info, **blas_info)

    config.add_extension('__umfpack',
                         sources=[umfpack_i],
                         depends=['umfpack.i'],
                         **build_info)

    return config
Пример #3
0
def configuration(parent_package='',top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, dict_append

    config = Configuration('umfpack', parent_package, top_path)
    config.add_data_dir('tests')

    umf_info = get_info('umfpack', notfound_action=1)

    ## The following addition is needed when linking against a umfpack built
    ## from the latest SparseSuite. Not (strictly) needed when linking against
    ## the version in the ubuntu repositories.
    if not sys.platform == 'darwin':
        umf_info['libraries'].insert(0, 'rt')

    umfpack_i_file = config.paths('umfpack.i')[0]

    def umfpack_i(ext, build_dir):
        if umf_info:
            return umfpack_i_file

    blas_info = get_info('blas_opt')
    build_info = {}
    dict_append(build_info, **umf_info)
    dict_append(build_info, **blas_info)

    config.add_extension('__umfpack',
                         sources=[umfpack_i],
                         depends=['umfpack.i'],
                         **build_info)

    return config
Пример #4
0
def configuration(parent_package='', top_path=None):
    import numpy
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, dict_append

    config = Configuration('umfpack', parent_package, top_path)
    config.add_data_dir('tests')

    umf_info = get_info('umfpack', notfound_action=1)

    umfpack_i_file = config.paths('umfpack.i')[0]

    def umfpack_i(ext, build_dir):
        if umf_info:
            return umfpack_i_file

    blas_info = get_info('blas_opt')
    build_info = {}
    dict_append(build_info, **umf_info)
    dict_append(build_info, **blas_info)

    config.add_extension('__umfpack',
                         sources=[umfpack_i],
                         depends=['umfpack.i'],
                         **build_info)

    return config
Пример #5
0
 def calc_info(self):
     info = self.calc_libraries_info()
     include_dirs = self.get_include_dirs()
     inc_dir = None
     for d in include_dirs:
         if self.combine_paths(d, 'netcdf.h'):
             inc_dir = d
             break
     if inc_dir is not None:
         dict_append(info, include_dirs=[inc_dir])
     self.set_info(**info)
Пример #6
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, dict_append
    confgr = Configuration('pyloess', parent_package, top_path)
    # Configuration of LOWESS
    confgr.add_extension('_lowess',
                         sources=[
                             join('src', 'f_lowess.pyf'),
                             join('src', 'lowess.f'),
                         ])
    # Configuration of STL
    confgr.add_extension(
        '_stl',
        sources=[join('src', 'f_stl.pyf'),
                 join('src', 'stl.f')],
    )
    # Configuration of LOESS
    f_sources = ('loessf.f', 'linpack_lite.f')
    confgr.add_library('floess', sources=[join('src', x) for x in f_sources])
    blas_info = get_info('blas_opt')
    build_info = {}
    dict_append(build_info, **blas_info)
    dict_append(build_info, libraries=['floess'])
    c_sources = [
        'loess.c',
        'loessc.c',
        'misc.c',
        'predict.c',
    ]
    confgr.add_extension('_loess',
                         sources=[join('src','_loess.c')] + \
                                 [join('src', x) for x in c_sources],
                         depends = [join('src','*.h'),
                                    join('src','*.pyx'),
                                    join('src','*.pxd')
                                    ],
                         **build_info
                        )
    confgr.add_extension('_mloess',
                         sources=[join('src','_mloess.c')] + \
                                 [join('src', x) for x in c_sources],
                         depends = [join('src','*.h'),
                                    join('src','*.pyx'),
                                    join('src','*.pxd')
                                    ],
                         **build_info
                        )
    confgr.add_data_dir('tests')
    return confgr
Пример #7
0
def configuration(parent_package='',top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, dict_append
    confgr = Configuration('pyloess',parent_package,top_path)
    # Configuration of LOWESS
    confgr.add_extension('_lowess',
                         sources=[join('src', 'f_lowess.pyf'),
                                  join('src', 'lowess.f'),]
                         )
    # Configuration of STL
    confgr.add_extension('_stl',
                         sources=[join('src', 'f_stl.pyf'),
                                  join('src', 'stl.f')],
                         )
    # Configuration of LOESS
    build_info = {
        'f2py_options': ['--verbose', '-L/usr/lib', '-lblas']
    }
    f_sources = ('loessf.f', 'linpack_lite.f')
    confgr.add_library('floess',
                       sources = [join('src',x) for x in f_sources],
                       **build_info)

    blas_info = get_info('blas_opt')
    build_info = {}
    dict_append(build_info, **blas_info)
    dict_append(build_info, libraries=['floess'])
    c_sources = ['loess.c', 'loessc.c', 'misc.c', 'predict.c',]
    confgr.add_extension('_loess',
                         sources=[join('src','_loess.c')] + \
                                 [join('src', x) for x in c_sources],
                         depends = [join('src','*.h'),
                                    join('src','*.pyx'),
                                    join('src','*.pxd')
                                    ],
                         **build_info
                        )
    confgr.add_extension('_mloess',
                         sources=[join('src','_mloess.c')] + \
                                 [join('src', x) for x in c_sources],
                         depends = [join('src','*.h'),
                                    join('src','*.pyx'),
                                    join('src','*.pxd')
                                    ],
                         **build_info
                        )
    confgr.add_data_dir('tests')
    return confgr
Пример #8
0
        def calc_info(self):
            """ Compute the informations of the library """
            if libnames:
                libs = self.get_libs("libraries", "")
                if not libs:
                    libs = libnames
                # Look for the shared library
                lib_dirs = self.get_lib_dirs()
                lib_dirs.append("/app/libs")
                tmp = None
                for d in lib_dirs:
                    tmp = self.check_libs(d, libs)
                    if tmp is not None:
                        info = tmp
                        break
                if tmp is None:
                    return

                # Look for the header file
                include_dirs = self.get_include_dirs()
                inc_dir = None
                for d in include_dirs:
                    p = self.combine_paths(d, headers)
                    if p:
                        inc_dir = os.path.dirname(p[0])
                        dict_append(info, include_dirs=[d])
                        break

                if inc_dir is None:
                    log.info("  %s not found" % name)
                    return

                self.set_info(**info)
            else:
                # Look for frameworks
                if frameworks:
                    fargs = []
                    for f in frameworks:
                        p = "/System/Library/Frameworks/%s.framework" % f
                        if os.path.exists(p):
                            fargs.append("-framework")
                            fargs.append(f)
                    if fargs:
                        self.set_info(extra_link_args=fargs)
            return
Пример #9
0
        def calc_info(self):
            """ Compute the informations of the library """
            if libnames:
                libs = self.get_libs('libraries', '')
                if not libs:
                    libs = libnames
                # Look for the shared library
                lib_dirs = self.get_lib_dirs()
                tmp = None
                for d in lib_dirs:
                    tmp = self.check_libs(d, libs)
                    if tmp is not None:
                        info = tmp
                        break
                if tmp is None:
                    return

                # Look for the header file
                include_dirs = self.get_include_dirs()
                inc_dir = None
                for d in include_dirs:
                    p = self.combine_paths(d, headers)
                    if p:
                        inc_dir = os.path.dirname(p[0])
                        dict_append(info, include_dirs=[d])
                        break

                if inc_dir is None:
                    log.info('  %s not found' % name)
                    return

                self.set_info(**info)
            else:
                # Look for frameworks
                if frameworks:
                    fargs = []
                    for f in frameworks:
                        p = "/System/Library/Frameworks/%s.framework" % f
                        if os.path.exists(p):
                            fargs.append("-framework")
                            fargs.append(f)
                    if fargs:
                        self.set_info(extra_link_args=fargs)
            return
Пример #10
0
def set_cxx_flags_clib_hook(build_clib, build_info):
    cc = build_clib.compiler
    new_args = []
    new_link_args = []

    std_flag = get_cxx_std_flag(cc)
    if std_flag is not None:
        new_args.append(std_flag)

    if sys.platform == 'darwin':
        # Set min macOS version
        min_macos_flag = '-mmacosx-version-min=10.9'
        if has_flag(cc, min_macos_flag):
            new_args.append(min_macos_flag)
            new_link_args.append(min_macos_flag)

    dict_append(build_info,
                extra_compiler_args=new_args,
                extra_link_args=new_link_args)
Пример #11
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import dict_append, get_info

    agg_dir = 'agg-24'
    agg_lib = 'agg24_src'

    config = Configuration('agg', parent_package,top_path)
    numerix_info = get_info('numerix')

    if ('NUMPY', None) in numerix_info.get('define_macros',[]):
        dict_append(numerix_info,
                    define_macros = [('PY_ARRAY_TYPES_PREFIX','NUMPY_CXX'),
                                     ('OWN_DIMENSIONS','0'),
                                     ('OWN_STRIDES','0')])

    #-------------------------------------------------------------------------
    # Configure the Agg backend to use on each platform
    #-------------------------------------------------------------------------
    if sys.platform=='win32':
        plat = 'win32'
    elif sys.platform == 'darwin':
        plat = 'gl'
    else:
        #plat = 'gtk1'  # use with gtk1, it's fast
        plat = 'x11'  # use with gtk2, it's slow but reliable
        #plat = 'gdkpixbuf2'


    #-------------------------------------------------------------------------
    # Add the freetype library (agg 2.4 links against this)
    #-------------------------------------------------------------------------

    prefix = config.paths('freetype2/src')[0]
    freetype_lib = 'freetype2_src'

    def get_ft2_sources((lib_name, build_info), build_dir):
        sources = [prefix + "/" + s for s in freetype2_sources]
        if sys.platform=='darwin':
            return sources[:]
        return sources[:-1]
Пример #12
0
 def calc_ver_info(self,ver_param):
     """Returns True on successful version detection, else False"""
     args = ['-O3','-mtune=generic','-msse2','-mfpmath=sse','-malign-double','-std=c99']
     lib_dirs = self.get_lib_dirs()
     incl_dirs = self.get_include_dirs()
     incl_dir = None
     libs = self.get_libs(self.section+'_libs', ver_param['libs'])
     info = None
     for d in lib_dirs:
         r = self.check_libs(d,libs)
         if r is not None:
             info = r
             break
     if info is not None:
         npsi.dict_append(info,include_dirs=incl_dirs)
         npsi.dict_append(info,extra_compile_args=args)
         self.set_info(**info)
         return True
     else:
         log.info('  %s not found' % (ver_param['name']))
         return False
Пример #13
0
 def calc_ver_info(self,ver_param):
     """Returns True on successful version detection, else False"""
     args = ['-O3','-mtune=generic','-msse2','-mfpmath=sse','-mstackrealign',
         '-mpreferred-stack-boundary=4','-m128bit-long-double','-lstdc++_s']
     lib_dirs = self.get_lib_dirs()
     incl_dirs = self.get_include_dirs()
     incl_dir = None
     libs = self.get_libs(self.section+'_libs', ver_param['libs'])
     info = None
     for d in lib_dirs:
         r = self.check_libs(d,libs)
         if r is not None:
             info = r
             break
     if info is not None:
         flag = 0
         for d in incl_dirs:
             if len(self.combine_paths(d,ver_param['includes']))==len(ver_param['includes']):
                 npsi.dict_append(info,include_dirs=[d])
                 npsi.dict_append(info,extra_compile_args=args)
                 flag = 1
                 incl_dirs = [d]
                 incl_dir = d
                 break
         if flag:
             npsi.dict_append(info,define_macros=ver_param['macros'])
         else:
             info = None
     if info is not None:
         self.set_info(**info)
         return True
     else:
         log.info('  %s not found' % (ver_param['name']))
         return False
Пример #14
0
def set_cxx_flags_clib_hook(build_clib, build_info):
    cc = build_clib.compiler
    new_args = []
    new_link_args = []

    std_flag = get_cxx_std_flag(cc)
    if std_flag is not None:
        new_args.append(std_flag)

    if sys.platform == 'darwin':
        platform = os.getenv('PLATFORM') or 'macosx'
        if platform.startswith('iphone'):
            min_macos_flag = '-miphoneos-version-min=14.0'
        else:
            # Set min macOS version
            min_macos_flag = '-mmacosx-version-min=10.9'
        if has_flag(cc, min_macos_flag):
            new_args.append(min_macos_flag)
            new_link_args.append(min_macos_flag)

    dict_append(build_info,
                extra_compiler_args=new_args,
                extra_link_args=new_link_args)
Пример #15
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, dict_append
    config = Configuration('loess', parent_package, top_path)

    # Configuration of LOESS
    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')
    build_info = {}
    dict_append(build_info, libraries=['floess'])
    dict_append(build_info, **blas_info)
    sources = ['_loess.c', 'loess.c', 'loessc.c', 'misc.c', 'predict.c']
    depends = ['S.h', 'loess.h',
               '_loess.pyx',
               'c_loess.pxd']
    config.add_extension('_loess',
                         sources=[join('src', x) for x in sources],
                         depends=[join('src', x) for x in depends],
                         **build_info)
    config.add_data_dir('tests')
    return config
Пример #16
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.system_info import get_info, dict_append
    from numpy.distutils.misc_util import Configuration
    package_name = 'libdeconv'
    config = Configuration(package_name, parent_package, top_path)
    deconv_src = os.path.join(config.local_path, 'src', 'deconv', 'libdeconv')
    assert os.path.isdir(
        deconv_src), 'Directory %r not found. Fix deconv_src in %s' % (
            deconv_src, __file__)

    libs_info = dict(libraries=['deconv_shared', 'gsl'])
    blas_opt = get_info('blas_opt', notfound_action=2)
    if not blas_opt:
        raise NotFoundError, 'no blas resources found'
    define_macros = blas_opt.get('define_macros', [])
    atlas_version = ([v[3:-3] for k,v in define_macros \
                          if k=='ATLAS_INFO']+[None])[0]
    if atlas_version:
        print('ATLAS version: %s' % atlas_version)
    dict_append(libs_info, **blas_opt)
    if ('ATLAS_REQUIRES_GFORTRAN', None) in define_macros:
        dict_append(libs_info, libraries=['gfortran'])
    fftw3_info = get_info('fftw3', notfound_action=2)
    dict_append(fftw3_info, libraries=['fftw3f'])
    if not fftw3_info:
        raise NotFoundError, 'no fftw3 resources found'
    dict_append(libs_info, **fftw3_info)

    config.add_library('deconv_shared',
                       sources=glob.glob(os.path.join(deconv_src, '*.cc')),
                       depends=glob.glob(os.path.join(deconv_src, '*.h')))
    config.add_extension(
        '_deconv',
        sources=['deconv.i'],
        include_dirs=[deconv_src],
        extra_info=libs_info,
    )

    config.make_svn_version_py()

    return config
Пример #17
0
        def calc_info(self):

            blas_mkl_info = get_info('blas_mkl')
            if blas_mkl_info:
                self.set_info(**blas_mkl_info)
                return

            blis_info = get_info('blis')
            if blis_info:
                self.set_info(**blis_info)
                return

            openblas_info = get_info('openblas')
            if openblas_info:
                self.set_info(**openblas_info)
                return

            atlas_info = get_info('atlas_3_10_blas_threads')
            if not atlas_info:
                atlas_info = get_info('atlas_3_10_blas')
            if not atlas_info:
                atlas_info = get_info('atlas_blas_threads')
            if not atlas_info:
                atlas_info = get_info('atlas_blas')

            need_blas = 0
            info = {}
            if atlas_info:
                info = atlas_info
            else:
                warnings.warn(AtlasNotFoundError.__doc__, stacklevel=2)
                need_blas = 1
                dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])

            if need_blas:
                blas_info = get_info('blas')
                if blas_info:
                    dict_append(info, **blas_info)
                else:
                    warnings.warn(BlasNotFoundError.__doc__, stacklevel=2)
                    blas_src_info = get_info('blas_src')
                    if not blas_src_info:
                        warnings.warn(BlasSrcNotFoundError.__doc__,
                                      stacklevel=2)
                        return
                    dict_append(info, libraries=[('fblas_src', blas_src_info)])

            self.set_info(**info)
            return
Пример #18
0
        def calc_info(self):

            blas_mkl_info = get_info('blas_mkl')
            if blas_mkl_info:
                self.set_info(**blas_mkl_info)
                return

            blis_info = get_info('blis')
            if blis_info:
                self.set_info(**blis_info)
                return

            openblas_info = get_info('openblas')
            if openblas_info:
                self.set_info(**openblas_info)
                return

            atlas_info = get_info('atlas_3_10_blas_threads')
            if not atlas_info:
                atlas_info = get_info('atlas_3_10_blas')
            if not atlas_info:
                atlas_info = get_info('atlas_blas_threads')
            if not atlas_info:
                atlas_info = get_info('atlas_blas')

            need_blas = 0
            info = {}
            if atlas_info:
                info = atlas_info
            else:
                warnings.warn(AtlasNotFoundError.__doc__, stacklevel=2)
                need_blas = 1
                dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])

            if need_blas:
                blas_info = get_info('blas')
                if blas_info:
                    dict_append(info, **blas_info)
                else:
                    warnings.warn(BlasNotFoundError.__doc__, stacklevel=2)
                    blas_src_info = get_info('blas_src')
                    if not blas_src_info:
                        warnings.warn(BlasSrcNotFoundError.__doc__, stacklevel=2)
                        return
                    dict_append(info, libraries=[('fblas_src', blas_src_info)])

            self.set_info(**info)
            return
Пример #19
0
def configuration(parent_package='',top_path=None):
    from numpy.distutils.system_info import get_info, dict_append
    from numpy.distutils.misc_util import Configuration
    package_name = 'libdeconv'
    config = Configuration(package_name,parent_package,top_path)
    deconv_src = os.path.join(config.local_path, 'src','deconv','libdeconv')
    assert os.path.isdir(deconv_src),'Directory %r not found. Fix deconv_src in %s' % (deconv_src, __file__)

    libs_info = dict (libraries = ['deconv_shared', 'gsl'])
    blas_opt = get_info('blas_opt',notfound_action=2)
    if not blas_opt:
        raise NotFoundError,'no blas resources found'
    define_macros = blas_opt.get('define_macros',[])
    atlas_version = ([v[3:-3] for k,v in define_macros \
                          if k=='ATLAS_INFO']+[None])[0]
    if atlas_version:
        print ('ATLAS version: %s' % atlas_version)
    dict_append(libs_info, **blas_opt)
    if ('ATLAS_REQUIRES_GFORTRAN', None) in define_macros:
        dict_append(libs_info, libraries = ['gfortran'])
    fftw3_info = get_info('fftw3',notfound_action=2)
    dict_append (fftw3_info, libraries = ['fftw3f'])
    if not fftw3_info:
        raise NotFoundError,'no fftw3 resources found'
    dict_append(libs_info, **fftw3_info)

    config.add_library('deconv_shared',
                       sources = glob.glob (os.path.join (deconv_src, '*.cc')),
                       depends = glob.glob (os.path.join (deconv_src, '*.h')))
    config.add_extension('_deconv',
                         sources = ['deconv.i'],
                         include_dirs = [deconv_src],
                         extra_info = libs_info,
                         )

    config.make_svn_version_py()

    return config
Пример #20
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import dict_append, get_info

    agg_dir = 'agg-24'
    agg_lib = 'agg24_src'

    config = Configuration('agg', parent_package,top_path)
    numerix_info = get_info('numerix')

    if ('NUMPY', None) in numerix_info.get('define_macros',[]):
        dict_append(numerix_info,
                    define_macros = [('PY_ARRAY_TYPES_PREFIX','NUMPY_CXX'),
                                     ('OWN_DIMENSIONS','0'),
                                     ('OWN_STRIDES','0')])

    #-------------------------------------------------------------------------
    # Configure the Agg backend to use on each platform
    #-------------------------------------------------------------------------
    if sys.platform=='win32':
        plat = 'win32'
    elif sys.platform == 'darwin':
        plat = 'gl'
    else:
        #plat = 'gtk1'  # use with gtk1, it's fast
        plat = 'x11'  # use with gtk2, it's slow but reliable
        #plat = 'gdkpixbuf2'


    #-------------------------------------------------------------------------
    # Add the freetype library (agg 2.4 links against this)
    #-------------------------------------------------------------------------

    prefix = config.paths('freetype2/src')[0]
    freetype_lib = 'freetype2_src'

    def get_ft2_sources(name_info, build_dir):
        (lib_name, build_info) = name_info
        sources = [prefix + "/" + s for s in freetype2_sources]
        if sys.platform=='darwin':
            return sources[:]
        return sources[:-1]

    ft2_incl_dirs = ['freetype2/src/' + s for s in freetype2_dirs] \
                    + ['freetype2/include', 'freetype2/src']
    ft2_incl_dirs = config.paths(*ft2_incl_dirs)
    if sys.platform == 'darwin' and '64bit' not in platform.architecture():
        ft2_incl_dirs.append("/Developer/Headers/FlatCarbon")

    config.add_library(freetype_lib,
                       sources = [get_ft2_sources],
                       include_dirs = ft2_incl_dirs,

                       # This macro was introduced in Freetype 2.2; if it is
                       # not defined, then the ftheader.h file (one of the
                       # primary headers) won't pull in any additional internal
                       # Freetype headers, and the library will mysteriously
                       # fail to build.
                       macros = [("FT2_BUILD_LIBRARY", None)],

                       depends = ['freetype2'],
                       )

    #-------------------------------------------------------------------------
    # Add the Agg sources
    #-------------------------------------------------------------------------

    agg_include_dirs = [agg_dir+'/include',agg_dir+'/font_freetype'] + \
                                   ft2_incl_dirs
    agg_sources = [agg_dir+'/src/*.cpp',
                    agg_dir+'/font_freetype/*.cpp']
    config.add_library(agg_lib,
                       agg_sources,
                       include_dirs = agg_include_dirs,
                       depends = [agg_dir])

    #-------------------------------------------------------------------------
    # Add the Kiva sources
    #-------------------------------------------------------------------------
    if sys.platform == 'darwin':
        define_macros = [('__DARWIN__', None)]
        macros = [('__DARWIN__', None)]
        extra_link_args = ['-framework', 'Carbon']
    else:
        define_macros = []
        macros = []
        extra_link_args = []

    kiva_include_dirs = ['src'] + agg_include_dirs
    config.add_library('kiva_src',
                       ['src/kiva_*.cpp', 'src/gl_graphics_context.cpp'],
                       include_dirs = kiva_include_dirs,
                       # Use "macros" instead of "define_macros" because the
                       # latter is only used for extensions, and not clibs
                       macros = macros,
                       )

    # MSVC6.0: uncomment to handle template parameters:
    #extra_compile_args = ['/Zm1000']
    extra_compile_args = []

    # XXX: test whether numpy has weakref support

    #-------------------------------------------------------------------------
    # Build the extension itself
    #-------------------------------------------------------------------------

    # Check for g++ < 4.0 on 64-bit Linux
    use_32bit_workaround = False

    if sys.platform == 'linux2' and '64bit' in platform.architecture():
        f = os.popen("g++ --version")
        line0 = f.readline()
        f.close()
        m = re.match(r'.+?\s([3-5])\.\d+', line0)
        if m is not None and int(m.group(1)) < 4:
            use_32bit_workaround = True

    # Enable workaround of agg bug on 64-bit machines with g++ < 4.0
    if use_32bit_workaround:
        define_macros.append(("ALWAYS_32BIT_WORKAROUND", 1))

    # Options to make OS X link OpenGL
    if '64bit' not in platform.architecture():
        darwin_frameworks = ['Carbon', 'ApplicationServices', 'OpenGL']
    else:
        darwin_frameworks = ['ApplicationServices', 'OpenGL']    
    darwin_opengl_opts = dict(
            include_dirs = [
              '/System/Library/Frameworks/%s.framework/Versions/A/Headers' % x
              for x in darwin_frameworks],
            define_macros = [('__DARWIN__',None)],
            extra_link_args = ['-framework %s' % x for x in darwin_frameworks]
            )

    build_info = {}
    kiva_lib = 'kiva_src'
    build_libraries = [kiva_lib, agg_lib, freetype_lib]
    if sys.platform == "win32":
        build_libraries += ["opengl32", "glu32"]
    elif sys.platform == "darwin":
        dict_append(build_info, **darwin_opengl_opts)
    else:
        # This should work for most linuxes (linuces?)
        build_libraries += ["GL", "GLU"]
    dict_append(build_info,
                sources = ['agg.i'],
                include_dirs = kiva_include_dirs,
                libraries = build_libraries,
                depends = ['src/*.[ih]'],
                extra_compile_args = extra_compile_args,
                extra_link_args = extra_link_args,
                define_macros=define_macros,
                )
    dict_append(build_info, **numerix_info)
    config.add_extension('_agg', **build_info)

    sources = [os.path.join('src',plat,'plat_support.i'),
               os.path.join('src',plat,'agg_bmp.cpp'),
               ]
    if plat != 'gl':
        sources.append(os.path.join('src',plat,'agg_platform_specific.cpp'))

    plat_info = {}
    dict_append(plat_info, libraries = [agg_lib],
                include_dirs = kiva_include_dirs,
                extra_compile_args = extra_compile_args,
                depends = ['src'])
    dict_append(plat_info, **numerix_info)

    if plat=='win32':
        dict_append(plat_info, libraries = ['gdi32','user32'])

    elif plat in ['x11','gtk1']:
        # Make sure we raise an error if the information is not found.
        # Frequently, the 64-bit libraries are not in a known location and need
        # manual configuration. From experience, this is usually not detected by
        # the builder if we do not raise an exception.
        x11_info = get_info('x11', notfound_action=2)
        dict_append(plat_info, **x11_info)

    elif plat=='gdkpixbuf2':
        #gdk_pixbuf_xlib_2 = get_info('gdk_pixbuf_xlib_2',notfound_action=1)
        #dict_append(plat_info,**gdk_pixbuf_xlib_2)
        gtk_info = get_info('gtk+-2.0')
        dict_append(plat_info, **gtk_info)
        #x11_info = get_info('x11',notfound_action=1)
        #dict_append(plat_info,**x11_info)

    elif plat == 'gl':
        if sys.platform == 'darwin':
            dict_append(plat_info, **darwin_opengl_opts)
        else:
            msg = "OpenGL build support only on MacOSX right now."
            raise NotImplementedError(msg)


    config.add_extension('_plat_support',
                         sources,
                         **plat_info
                         )

    config.add_data_dir('tests')
    config.add_data_files('*.txt', '*.bat')

    return config
Пример #21
0
 def calc_info(self):
     """Read in *all* options in the [phono3py] section of site.cfg."""
     info = self.calc_libraries_info()
     dict_append(info, **self.calc_extra_info())
     dict_append(info, include_dirs=self.get_include_dirs())
     self.set_info(**info)
Пример #22
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import dict_append, get_info
    config = Configuration('quartz', parent_package, top_path)

    def generate_c_from_cython(extension, build_dir):
        if not sys.platform == 'darwin':
            print 'No %s will be built for this platform.' % (extension.name)
            return
        from distutils.dep_util import newer_group
        name = extension.name.split('.')[-1]
        source = extension.depends[0]
        target = os.path.join(build_dir, name+'.c')

        if newer_group(extension.depends, target):
            from Cython.Compiler import Main
            options = Main.CompilationOptions(
                defaults=Main.default_options,
                output_file=target)
            cython_result = Main.compile(source, options=options)
            if cython_result.num_errors != 0:
                raise RuntimeError("%d errors in Cython compile" %
                    cython_result.num_errors)
        return target

    frameworks = ['Cocoa', 'CoreFoundation','ApplicationServices','Foundation']
    extra_link_args=['-framework %s' % x for x in frameworks]
    include_dirs = [
        '/System/Library/Frameworks/%s.framework/Versions/A/Headers' % x
        for x in frameworks
    ]

    config.add_extension('ABCGI',
                         [generate_c_from_cython],
                         extra_link_args = extra_link_args,
                         depends = ["ABCGI.pyx",
                                    "Python.pxi",
                                    "numpy.pxi",
                                    "c_numpy.pxd",
                                    "CoreFoundation.pxi",
                                    "CoreGraphics.pxi",
                                    "CoreText.pxi",
                                    ]
                         )

    config.add_extension('CTFont',
                         [generate_c_from_cython],
                         extra_link_args = extra_link_args,
                         depends=["CTFont.pyx",
                                  "CoreFoundation.pxi",
                                  "CoreGraphics.pxi",
                                  "CoreText.pxi",
                                  ],
                        )

    config.add_extension("mac_context",
                         ["mac_context.c", "mac_context_cocoa.m"],
                         include_dirs = include_dirs,
                         extra_link_args = extra_link_args,
                         depends = ["mac_context.h"],
                         )

    wx_info = get_info('wx')
    if wx_info:
        wx_release = '2.6'
        for macro, value in wx_info['define_macros']:
            if macro.startswith('WX_RELEASE_'):
                wx_release = macro[len('WX_RELEASE_'):].replace('_', '.')
                break

        # only build macport for wxPython version 2.6, it's not needed in the
        # newer releases (see __init__.py)
        if wx_release == '2.6':
            macport_cpp = config.paths('macport26.cpp')[0]

            def get_macport_cpp(extension, build_dir):
                if sys.platform != 'darwin':
                    print 'No %s will be built for this platform.'%(extension.name)
                    return None
    
                elif wx_release not in ('2.6', '2.8'):
                    print ('No %s will be built because we do not recognize '
                           'wx version %s' % (extension.name, wx_release))
                    return None
    
                return macport_cpp
    
            info = {}
            dict_append(info, define_macros=[("__WXMAC__", 1)])
            dict_append(info, **wx_info)
            config.add_extension('macport', [get_macport_cpp],
                                 depends = [macport_cpp],
                                 **wx_info
                                 )
    return config
Пример #23
0
def configuration(parent_package='', top_path=None):
    """Configure all packages that need to be built."""
    config = Configuration('', parent_package, top_path)

    F95FLAGS = get_compiler_flags()

    kwargs = {
        'libraries': [],
        'include_dirs': [],
        'library_dirs': [],
    }
    kwargs['extra_compile_args'] = F95FLAGS
    kwargs['f2py_options'] = ['--quiet']

    # numpy.distutils.fcompiler.FCompiler doesn't support .F95 extension
    compiler = FCompiler(get_default_fcompiler())
    compiler.src_extensions.append('.F95')
    compiler.language_map['.F95'] = 'f90'

    # collect all Fortran sources
    files = os.listdir('src')
    exclude_sources = ['PlanetsConstants.f95', 'PythonWrapper.f95']
    sources = [os.path.join('src', file) for file in files if
               file.lower().endswith(('.f95', '.c')) and file not in exclude_sources]

    # (from http://stackoverflow.com/questions/14320220/
    #              testing-python-c-libraries-get-build-path)):
    build_lib_dir = "{dirname}.{platform}-{version[0]}.{version[1]}"
    dirparams = {'dirname': 'temp',
                 'platform': sysconfig.get_platform(),
                 'version': sys.version_info}
    libdir = os.path.join('build', build_lib_dir.format(**dirparams))
    print('searching SHTOOLS in:', libdir)

    # Fortran compilation
    config.add_library('SHTOOLS',
                       sources=sources,
                       **kwargs)

    # SHTOOLS
    kwargs['libraries'].extend(['SHTOOLS'])
    kwargs['include_dirs'].extend([libdir])
    kwargs['library_dirs'].extend([libdir])

    # FFTW info
    fftw_info = get_info('fftw', notfound_action=2)
    dict_append(kwargs, **fftw_info)

    if sys.platform != 'win32':
        kwargs['libraries'].extend(['m'])

    # BLAS / Lapack info
    lapack_info = get_info('lapack_opt', notfound_action=2)
    blas_info = get_info('blas_opt', notfound_action=2)
    dict_append(kwargs, **blas_info)
    dict_append(kwargs, **lapack_info)

    config.add_extension('pyshtools._SHTOOLS',
                         sources=['src/pyshtools.pyf',
                                  'src/PythonWrapper.f95'],
                         **kwargs)

    # constants
    config.add_extension('pyshtools._constant',
                         sources=['src/PlanetsConstants.f95'],
                         **kwargs)

    return config
Пример #24
0
# these are the basic definitions for all extensions
opts = lapack_info_d.copy()
if "mkl" in opts.get("libraries", ""):
    with_mkl = True

if with_mkl:
    with_threaded_blas = True
    # generally this should not be needed since the numpy distutils
    # finding of MKL creates the SCIPY_MKL_H flag
    macros.append(("MKL_LAPACKE", None))

if with_threaded_blas:
    macros.append(("MULTITHREADED_BLAS", None))

# Create the dictionary for compiling the codes
dict_append(opts, **all_info_d)
dict_append(opts, include_dirs=["c"])
dict_append(opts, define_macros=macros)
# Add numpy's headers
include_dirs = numpy.get_include()
if include_dirs is not None:
    dict_append(opts, include_dirs=[include_dirs])

# Add any phono3py manual flags from here
add_opts = phono3py_info().get_info()
dict_append(opts, **add_opts)

# Different extensions
extensions = []

# Define the modules
Пример #25
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import dict_append, get_info
    config = Configuration('quartz', parent_package, top_path)

    def generate_c_from_cython(extension, build_dir):
        if not sys.platform == 'darwin':
            print('No %s will be built for this platform.' % extension.name)
            return
        from distutils.dep_util import newer_group
        name = extension.name.split('.')[-1]
        source = extension.depends[0]
        target = os.path.join(build_dir, name + '.c')

        if newer_group(extension.depends, target):
            from Cython.Compiler import Main
            options = Main.CompilationOptions(defaults=Main.default_options,
                                              output_file=target)
            cython_result = Main.compile(source, options=options)
            if cython_result.num_errors != 0:
                raise RuntimeError("%d errors in Cython compile" %
                                   cython_result.num_errors)
        return target

    frameworks = [
        'Cocoa', 'CoreFoundation', 'ApplicationServices', 'Foundation'
    ]
    extra_link_args = ['-framework %s' % x for x in frameworks]
    include_dirs = [
        '/System/Library/Frameworks/%s.framework/Versions/A/Headers' % x
        for x in frameworks
    ]

    config.add_extension('ABCGI', [generate_c_from_cython],
                         extra_link_args=extra_link_args,
                         depends=[
                             "ABCGI.pyx",
                             "Python.pxi",
                             "numpy.pxi",
                             "c_numpy.pxd",
                             "CoreFoundation.pxi",
                             "CoreGraphics.pxi",
                             "CoreText.pxi",
                         ])

    config.add_extension(
        'CTFont',
        [generate_c_from_cython],
        extra_link_args=extra_link_args,
        depends=[
            "CTFont.pyx",
            "CoreFoundation.pxi",
            "CoreGraphics.pxi",
            "CoreText.pxi",
        ],
    )

    config.add_extension(
        "mac_context",
        ["mac_context.c", "mac_context_cocoa.m"],
        include_dirs=include_dirs,
        extra_link_args=extra_link_args,
        depends=["mac_context.h"],
    )

    wx_info = get_info('wx')
    if wx_info:
        wx_release = '2.6'
        for macro, value in wx_info['define_macros']:
            if macro.startswith('WX_RELEASE_'):
                wx_release = macro[len('WX_RELEASE_'):].replace('_', '.')
                break

        # only build macport for wxPython version 2.6, it's not needed in the
        # newer releases (see __init__.py)
        if wx_release == '2.6':
            macport_cpp = config.paths('macport26.cpp')[0]

            def get_macport_cpp(extension, build_dir):
                if sys.platform != 'darwin':
                    print('No %s will be built for this platform.' %
                          extension.name)
                    return None

                elif wx_release not in ('2.6', '2.8'):
                    print('No %s will be built because we do not recognize '
                          'wx version %s' % (extension.name, wx_release))
                    return None

                return macport_cpp

            info = {}
            dict_append(info, define_macros=[("__WXMAC__", 1)])
            dict_append(info, **wx_info)
            config.add_extension('macport', [get_macport_cpp],
                                 depends=[macport_cpp],
                                 **wx_info)
    return config
Пример #26
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import dict_append, get_info

    agg_dir = 'agg-24'
    agg_lib = 'agg24_src'

    config = Configuration('agg', parent_package, top_path)
    numerix_info = get_info('numerix')

    if ('NUMPY', None) in numerix_info.get('define_macros', []):
        dict_append(numerix_info,
                    define_macros=[('PY_ARRAY_TYPES_PREFIX', 'NUMPY_CXX'),
                                   ('OWN_DIMENSIONS', '0'),
                                   ('OWN_STRIDES', '0')])

    #-------------------------------------------------------------------------
    # Configure the Agg backend to use on each platform
    #-------------------------------------------------------------------------
    if sys.platform == 'win32':
        plat = 'win32'
    elif sys.platform == 'darwin':
        plat = 'gl'
    else:
        #plat = 'gtk1'  # use with gtk1, it's fast
        plat = 'x11'  # use with gtk2, it's slow but reliable
        #plat = 'gdkpixbuf2'

    #-------------------------------------------------------------------------
    # Add the freetype library (agg 2.4 links against this)
    #-------------------------------------------------------------------------

    prefix = config.paths('freetype2/src')[0]
    freetype_lib = 'freetype2_src'

    def get_ft2_sources(name_info, build_dir):
        (lib_name, build_info) = name_info
        sources = [prefix + "/" + s for s in freetype2_sources]
        if sys.platform == 'darwin':
            return sources[:]
        return sources[:-1]

    ft2_incl_dirs = ['freetype2/src/' + s for s in freetype2_dirs] \
                    + ['freetype2/include', 'freetype2/src']
    ft2_incl_dirs = config.paths(*ft2_incl_dirs)
    if sys.platform == 'darwin' and '64bit' not in platform.architecture():
        ft2_incl_dirs.append("/Developer/Headers/FlatCarbon")

    config.add_library(
        freetype_lib,
        sources=[get_ft2_sources],
        include_dirs=ft2_incl_dirs,

        # This macro was introduced in Freetype 2.2; if it is
        # not defined, then the ftheader.h file (one of the
        # primary headers) won't pull in any additional internal
        # Freetype headers, and the library will mysteriously
        # fail to build.
        macros=[("FT2_BUILD_LIBRARY", None)],
        depends=['freetype2'],
    )

    #-------------------------------------------------------------------------
    # Add the Agg sources
    #-------------------------------------------------------------------------

    agg_include_dirs = [agg_dir+'/include',agg_dir+'/font_freetype'] + \
                                   ft2_incl_dirs
    agg_sources = [agg_dir + '/src/*.cpp', agg_dir + '/font_freetype/*.cpp']
    config.add_library(agg_lib,
                       agg_sources,
                       include_dirs=agg_include_dirs,
                       depends=[agg_dir])

    #-------------------------------------------------------------------------
    # Add the Kiva sources
    #-------------------------------------------------------------------------
    if sys.platform == 'darwin':
        define_macros = [('__DARWIN__', None)]
        macros = [('__DARWIN__', None)]
    else:
        define_macros = []
        macros = []

    kiva_include_dirs = ['src'] + agg_include_dirs
    config.add_library(
        'kiva_src',
        ['src/kiva_*.cpp', 'src/gl_graphics_context.cpp'],
        include_dirs=kiva_include_dirs,
        # Use "macros" instead of "define_macros" because the
        # latter is only used for extensions, and not clibs
        macros=macros,
    )

    # MSVC6.0: uncomment to handle template parameters:
    #extra_compile_args = ['/Zm1000']
    extra_compile_args = []

    # XXX: test whether numpy has weakref support

    #-------------------------------------------------------------------------
    # Build the extension itself
    #-------------------------------------------------------------------------

    # Check for g++ < 4.0 on 64-bit Linux
    use_32bit_workaround = False

    if sys.platform == 'linux2' and '64bit' in platform.architecture():
        f = os.popen("g++ --version")
        line0 = f.readline()
        f.close()
        m = re.match(r'.+?\s([3-5])\.\d+', line0)
        if m is not None and int(m.group(1)) < 4:
            use_32bit_workaround = True

    # Enable workaround of agg bug on 64-bit machines with g++ < 4.0
    if use_32bit_workaround:
        define_macros.append(("ALWAYS_32BIT_WORKAROUND", 1))

    # Options to make OS X link OpenGL
    if '64bit' not in platform.architecture():
        darwin_frameworks = ['Carbon', 'ApplicationServices', 'OpenGL']
    else:
        darwin_frameworks = ['ApplicationServices', 'OpenGL']

    darwin_extra_link_args = []
    for framework in darwin_frameworks:
        darwin_extra_link_args.extend(['-framework', framework])

    darwin_opengl_opts = dict(include_dirs=[
        '/System/Library/Frameworks/%s.framework/Versions/A/Headers' % x
        for x in darwin_frameworks
    ],
                              define_macros=[('__DARWIN__', None)],
                              extra_link_args=darwin_extra_link_args)

    build_info = {}
    kiva_lib = 'kiva_src'
    build_libraries = [kiva_lib, agg_lib, freetype_lib]
    if sys.platform == "win32":
        build_libraries += ["opengl32", "glu32"]
    elif sys.platform == "darwin":
        dict_append(build_info, **darwin_opengl_opts)
    else:
        # This should work for most linuxes (linuces?)
        build_libraries += ["GL", "GLU"]
    dict_append(
        build_info,
        sources=['agg.i'],
        include_dirs=kiva_include_dirs,
        libraries=build_libraries,
        depends=['src/*.[ih]'],
        extra_compile_args=extra_compile_args,
        extra_link_args=[],
        define_macros=define_macros,
    )
    dict_append(build_info, **numerix_info)
    config.add_extension('_agg', **build_info)

    sources = [
        os.path.join('src', plat, 'plat_support.i'),
        os.path.join('src', plat, 'agg_bmp.cpp'),
    ]
    if plat != 'gl':
        sources.append(os.path.join('src', plat, 'agg_platform_specific.cpp'))

    plat_info = {}
    dict_append(plat_info,
                libraries=[agg_lib],
                include_dirs=kiva_include_dirs,
                extra_compile_args=extra_compile_args,
                depends=['src'])
    dict_append(plat_info, **numerix_info)

    if plat == 'win32':
        dict_append(plat_info, libraries=['gdi32', 'user32'])

    elif plat in ['x11', 'gtk1']:
        # Make sure we raise an error if the information is not found.
        # Frequently, the 64-bit libraries are not in a known location and need
        # manual configuration. From experience, this is usually not detected by
        # the builder if we do not raise an exception.
        x11_info = get_info('x11', notfound_action=2)
        dict_append(plat_info, **x11_info)

    elif plat == 'gdkpixbuf2':
        #gdk_pixbuf_xlib_2 = get_info('gdk_pixbuf_xlib_2',notfound_action=1)
        #dict_append(plat_info,**gdk_pixbuf_xlib_2)
        gtk_info = get_info('gtk+-2.0')
        dict_append(plat_info, **gtk_info)
        #x11_info = get_info('x11',notfound_action=1)
        #dict_append(plat_info,**x11_info)

    elif plat == 'gl':
        if sys.platform == 'darwin':
            dict_append(plat_info, **darwin_opengl_opts)
        else:
            msg = "OpenGL build support only on MacOSX right now."
            raise NotImplementedError(msg)

    config.add_extension('_plat_support', sources, **plat_info)

    config.add_data_dir('tests')
    config.add_data_files('*.txt', '*.bat')

    return config
Пример #27
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import dict_append, get_info
    config = Configuration('quartz', parent_package, top_path)

    wx_info = get_info('wx')
    # Find the release number of wx.
    wx_release = '2.6'
    for macro, value in wx_info['define_macros']:
        if macro.startswith('WX_RELEASE_'):
            wx_release = macro[len('WX_RELEASE_'):].replace('_', '.')
            break

    def generate_c_from_cython(extension, build_dir):
        if not sys.platform == 'darwin':
            print 'No %s will be built for this platform.' % (extension.name)
            return
        from distutils.dep_util import newer_group
        name = extension.name.split('.')[-1]
        source = extension.depends[0]
        target = os.path.join(build_dir, name+'.c')

        if newer_group(extension.depends, target):
            from Cython.Compiler import Main
            options = Main.CompilationOptions(
                defaults=Main.default_options,
                output_file=target)
            cython_result = Main.compile(source, options=options)
            if cython_result.num_errors != 0:
                raise RuntimeError("%d errors in Cython compile" %
                    cython_result.num_errors)
        return target

    extra_link_args=[
        '-Wl,-framework', '-Wl,CoreFoundation',
        '-Wl,-framework', '-Wl,ApplicationServices',
        '-Wl,-framework', '-Wl,Carbon',
        '-Wl,-framework', '-Wl,Foundation',
    ]
    include_dirs = ['/Developer/Headers/FlatCarbon']
    config.add_extension('ATSFont',
                         [generate_c_from_cython],
                         include_dirs = include_dirs,
                         extra_link_args = extra_link_args,
                         depends=["ATSFont.pyx",
                                  "Python.pxi",
                                  "ATS.pxi",
                                  ],
                         )
    config.add_extension('ABCGI',
                         [generate_c_from_cython],
                         include_dirs = include_dirs,
                         depends = ["ABCGI.pyx",
                                    "ATSUI.pxi",
                                    "Python.pxi",
                                    "numpy.pxi",
                                    "c_numpy.pxd",
                                    "CoreFoundation.pxi",
                                    "CoreGraphics.pxi",
                                    "QuickDraw.pxi",
                                    ]
                         )

    if wx_release == '2.6':
        macport_cpp = config.paths('macport26.cpp')[0]
    else:
        macport_cpp = config.paths('macport28.cpp')[0]

    def get_macport_cpp(extension, build_dir):
        if sys.platform != 'darwin':
            print 'No %s will be built for this platform.' % (extension.name)
            return None

        elif wx_release not in ('2.6', '2.8'):
            print ('No %s will be built because we do not recognize '
                   'wx version %s' % (extension.name, wx_release))
            return None

        return macport_cpp

    info = {}
    dict_append(info, define_macros=[("__WXMAC__", 1)])
    dict_append(info, **wx_info)
    config.add_extension('macport', [get_macport_cpp],
                         depends = [macport_cpp],
                         **wx_info
                         )
    return config
Пример #28
0
        darwin_frameworks = ['ApplicationServices', 'OpenGL']    
    darwin_opengl_opts = dict(
            include_dirs = [
              '/System/Library/Frameworks/%s.framework/Versions/A/Headers' % x
              for x in darwin_frameworks],
            define_macros = [('__DARWIN__',None)],
            extra_link_args = ['-framework %s' % x for x in darwin_frameworks]
            )

    build_info = {}
    kiva_lib = 'kiva_src'
    build_libraries = [kiva_lib, agg_lib, freetype_lib]
    if sys.platform == "win32":
        build_libraries += ["opengl32", "glu32"]
    elif sys.platform == "darwin":
        dict_append(build_info, **darwin_opengl_opts)
    else:
        # This should work for most linuxes (linuces?)
        build_libraries += ["GL", "GLU"]
    dict_append(build_info,
                sources = ['agg.i'],
                include_dirs = kiva_include_dirs,
                libraries = build_libraries,
                depends = ['src/*.[ih]'],
                extra_compile_args = extra_compile_args,
                extra_link_args = extra_link_args,
                define_macros=define_macros,
                )
    dict_append(build_info, **numerix_info)
    config.add_extension('_agg', **build_info)
Пример #29
0
        def calc_info(self):

            lapack_mkl_info = get_info('lapack_mkl')
            if lapack_mkl_info:
                self.set_info(**lapack_mkl_info)
                return

            openblas_info = get_info('openblas_lapack')
            if openblas_info:
                self.set_info(**openblas_info)
                return

            openblas_info = get_info('openblas_clapack')
            if openblas_info:
                self.set_info(**openblas_info)
                return

            atlas_info = get_info('atlas_3_10_threads')
            if not atlas_info:
                atlas_info = get_info('atlas_3_10')
            if not atlas_info:
                atlas_info = get_info('atlas_threads')
            if not atlas_info:
                atlas_info = get_info('atlas')

            need_lapack = 0
            need_blas = 0
            info = {}
            if atlas_info:
                l = atlas_info.get('define_macros', [])
                if ('ATLAS_WITH_LAPACK_ATLAS', None) in l \
                       or ('ATLAS_WITHOUT_LAPACK', None) in l:
                    need_lapack = 1
                info = atlas_info

            else:
                warnings.warn(AtlasNotFoundError.__doc__, stacklevel=2)
                need_blas = 1
                need_lapack = 1
                dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])

            if need_lapack:
                lapack_info = get_info('lapack')
                #lapack_info = {} ## uncomment for testing
                if lapack_info:
                    dict_append(info, **lapack_info)
                else:
                    warnings.warn(LapackNotFoundError.__doc__, stacklevel=2)
                    lapack_src_info = get_info('lapack_src')
                    if not lapack_src_info:
                        warnings.warn(LapackSrcNotFoundError.__doc__, stacklevel=2)
                        return
                    dict_append(info, libraries=[('flapack_src', lapack_src_info)])

            if need_blas:
                blas_info = get_info('blas')
                if blas_info:
                    dict_append(info, **blas_info)
                else:
                    warnings.warn(BlasNotFoundError.__doc__, stacklevel=2)
                    blas_src_info = get_info('blas_src')
                    if not blas_src_info:
                        warnings.warn(BlasSrcNotFoundError.__doc__, stacklevel=2)
                        return
                    dict_append(info, libraries=[('fblas_src', blas_src_info)])

            self.set_info(**info)
            return
Пример #30
0
        def calc_info(self):

            lapack_mkl_info = get_info('lapack_mkl')
            if lapack_mkl_info:
                self.set_info(**lapack_mkl_info)
                return

            openblas_info = get_info('openblas_lapack')
            if openblas_info:
                self.set_info(**openblas_info)
                return

            openblas_info = get_info('openblas_clapack')
            if openblas_info:
                self.set_info(**openblas_info)
                return

            atlas_info = get_info('atlas_3_10_threads')
            if not atlas_info:
                atlas_info = get_info('atlas_3_10')
            if not atlas_info:
                atlas_info = get_info('atlas_threads')
            if not atlas_info:
                atlas_info = get_info('atlas')

            need_lapack = 0
            need_blas = 0
            info = {}
            if atlas_info:
                l = atlas_info.get('define_macros', [])
                if ('ATLAS_WITH_LAPACK_ATLAS', None) in l \
                       or ('ATLAS_WITHOUT_LAPACK', None) in l:
                    need_lapack = 1
                info = atlas_info

            else:
                warnings.warn(AtlasNotFoundError.__doc__, stacklevel=2)
                need_blas = 1
                need_lapack = 1
                dict_append(info, define_macros=[('NO_ATLAS_INFO', 1)])

            if need_lapack:
                lapack_info = get_info('lapack')
                #lapack_info = {} ## uncomment for testing
                if lapack_info:
                    dict_append(info, **lapack_info)
                else:
                    warnings.warn(LapackNotFoundError.__doc__, stacklevel=2)
                    lapack_src_info = get_info('lapack_src')
                    if not lapack_src_info:
                        warnings.warn(LapackSrcNotFoundError.__doc__, stacklevel=2)
                        return
                    dict_append(info, libraries=[('flapack_src', lapack_src_info)])

            if need_blas:
                blas_info = get_info('blas')
                if blas_info:
                    dict_append(info, **blas_info)
                else:
                    warnings.warn(BlasNotFoundError.__doc__, stacklevel=2)
                    blas_src_info = get_info('blas_src')
                    if not blas_src_info:
                        warnings.warn(BlasSrcNotFoundError.__doc__, stacklevel=2)
                        return
                    dict_append(info, libraries=[('fblas_src', blas_src_info)])

            self.set_info(**info)
            return
Пример #31
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, dict_append
    confgr = Configuration('pyloess', parent_package, top_path)
    # Configuration of LOWESS
    confgr.add_extension('_lowess',
                         sources=[
                             join('src', 'f_lowess.pyf'),
                             join('src', 'lowess.f'),
                         ])
    # Configuration of STL
    confgr.add_extension(
        '_stl',
        sources=[join('src', 'f_stl.pyf'),
                 join('src', 'stl.f')],
    )
    # Configuration of LOESS
    build_info = {'f2py_options': ['--verbose', '-L/usr/lib', '-lblas']}
    f_sources = ('loessf.f', 'linpack_lite.f')
    confgr.add_library('floess',
                       sources=[join('src', x) for x in f_sources],
                       **build_info)

    blas_info = get_info('blas_opt')
    build_info = {}
    dict_append(build_info, **blas_info)
    dict_append(build_info, libraries=['floess'])

    # Shared library doesn't link properly when -lfloess refers to a
    # static library (.a file).  No errors at link time, but ldd shows
    # that it loads only core libraries.  Maybe a bug in gfortran???
    # Or a bug in distutils that chooses gfortran as the linker???
    # It works when I specify the .a file directly without using -l.
    temp_dir = "temp.%s-%s" % (get_platform(), sys.version[0:3])
    floess_archive = join('build', temp_dir, 'libfloess.a')
    dict_append(build_info, extra_objects=[floess_archive])

    c_sources = [
        'loess.c',
        'loessc.c',
        'misc.c',
        'predict.c',
    ]
    confgr.add_extension('_loess',
                         sources=[join('src','_loess.c')] + \
                                 [join('src', x) for x in c_sources],
                         depends = [join('src','*.h'),
                                    join('src','*.pyx'),
                                    join('src','*.pxd')
                                    ],
                         **build_info
                        )
    confgr.add_extension('_mloess',
                         sources=[join('src','_mloess.c')] + \
                                 [join('src', x) for x in c_sources],
                         depends = [join('src','*.h'),
                                    join('src','*.pyx'),
                                    join('src','*.pxd')
                                    ],
                         **build_info
                        )
    confgr.add_data_dir('tests')
    return confgr