コード例 #1
0
ファイル: setup.py プロジェクト: ronnix/scikit-learn
def configuration(parent_package="", top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, get_standard_file, BlasNotFoundError

    config = Configuration("glm", parent_package, top_path)

    site_cfg = ConfigParser()
    site_cfg.read(get_standard_file("site.cfg"))

    # cd fast needs CBLAS
    blas_info = get_info("blas_opt", 0)
    if (not blas_info) or (("NO_ATLAS_INFO", 1) in blas_info.get("define_macros", [])):
        cblas_libs = ["cblas"]
        blas_info.pop("libraries", None)
    else:
        cblas_libs = blas_info.pop("libraries", [])

    config.add_extension(
        "cd_fast",
        sources=[join("src", "cd_fast.c")],
        libraries=cblas_libs,
        include_dirs=[join("..", "src", "cblas"), numpy.get_include(), blas_info.pop("include_dirs", [])],
        extra_compile_args=blas_info.pop("extra_compile_args", []),
        **blas_info
    )

    # add other directories
    config.add_subpackage("tests")
    config.add_subpackage("benchmarks")
    config.add_subpackage("sparse")

    return config
コード例 #2
0
ファイル: setup.py プロジェクト: YBonnemay/scikit-learn
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, get_standard_file, BlasNotFoundError
    config = Configuration('glm', parent_package, top_path)

    site_cfg  = ConfigParser()
    site_cfg.read(get_standard_file('site.cfg'))


    # cd fast needs CBLAS
    blas_info = get_info('blas_opt', 0)
    if (not blas_info) or (
        ('NO_ATLAS_INFO', 1) in blas_info.get('define_macros', [])) :
        cblas_libs = ['cblas']
        blas_info.pop('libraries', None)
    else:
        cblas_libs = blas_info.pop('libraries', [])

    config.add_extension('cd_fast',
                         sources=[join('src', 'cd_fast.c')],
                         libraries=cblas_libs,
                         include_dirs=[join('..', 'src', 'cblas'),
                                       numpy.get_include(),
                                       blas_info.pop('include_dirs', [])],
                         extra_compile_args=blas_info.pop('extra_compile_args', []),
                         **blas_info
                         )


    # add other directories
    config.add_subpackage('tests')
    config.add_subpackage('benchmarks')
    config.add_subpackage('sparse')

    return config
コード例 #3
0
ファイル: setup.py プロジェクト: AnneLaureF/scikit-learn
def configuration(parent_package="", top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_standard_file

    config = Configuration("sparse", parent_package, top_path)
    site_cfg = ConfigParser()
    site_cfg.read(get_standard_file("site.cfg"))

    # add other directories
    # config.add_subpackage('tests')
    return config
コード例 #4
0
ファイル: setup.py プロジェクト: AnneLaureF/scikit-learn
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, get_standard_file, BlasNotFoundError

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

    site_cfg  = ConfigParser()
    site_cfg.read(get_standard_file('site.cfg'))

    config.add_subpackage('tests')
    config.add_subpackage('sparse')

    return config
コード例 #5
0
ファイル: setup.py プロジェクト: kurtosis-zz/scikit-learn
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_standard_file

    config = Configuration('sparse', parent_package, top_path)
    site_cfg  = ConfigParser()
    site_cfg.read(get_standard_file('site.cfg'))

    config.add_extension('sgd_fast_sparse',
                         sources=[join('src', 'sgd_fast_sparse.c')],
                         include_dirs=[numpy.get_include()]
                         )

    # add other directories
    # config.add_subpackage('tests')
    return config
コード例 #6
0
ファイル: setup.py プロジェクト: kurtosis-zz/scikit-learn
def configuration(parent_package="", top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info
    from numpy.distutils.system_info import get_standard_file
    from numpy.distutils.system_info import BlasNotFoundError

    config = Configuration("sparse", parent_package, top_path)

    site_cfg = ConfigParser()
    site_cfg.read(get_standard_file("site.cfg"))

    config.add_extension(
        "_preprocessing", sources=[join("src", "_preprocessing.c")], include_dirs=[numpy.get_include()]
    )

    return config
コード例 #7
0
ファイル: setup.py プロジェクト: Lx37/nipy
def get_nipy_info():
    """ Reuse numpy's distutils to get and store information about nipy
        in the site.cfg.
    """
    from numpy.distutils.system_info import get_standard_file
    files = get_standard_file('site.cfg')
    cp = ConfigParser(NIPY_DEFAULTS)
    cp.read(files)
    if not cp.has_section('nipy'):
        cp.add_section('nipy')
    info = dict(cp.items('nipy'))
    for key, value in info.items():
        if value.startswith('~'):
            info[key] = os.path.expanduser(value)
    # Ugly fix for bug 409269
    if 'libraries' in info and isinstance(info['libraries'], basestring):
        info['libraries'] = [info['libraries']]
    # End of ugly fix
    return info
コード例 #8
0
ファイル: setup.py プロジェクト: Raniac/NEURO-LEARN
def get_nipy_info():
    """ Reuse numpy's distutils to get and store information about nipy
        in the site.cfg.
    """
    from numpy.distutils.system_info import get_standard_file
    files = get_standard_file('site.cfg')
    cp = ConfigParser(NIPY_DEFAULTS)
    cp.read(files)
    if not cp.has_section('nipy'):
        cp.add_section('nipy')
    info = dict(cp.items('nipy'))
    for key, value in info.items():
        if value.startswith('~'):
            info[key] = os.path.expanduser(value)
    # Ugly fix for bug 409269
    if 'libraries' in info and isinstance(info['libraries'], string_types):
        info['libraries'] = [info['libraries']]
    # End of ugly fix
    return info
コード例 #9
0
ファイル: setup.py プロジェクト: ronnix/scikit-learn
def configuration(parent_package="", top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info
    from numpy.distutils.system_info import get_standard_file
    from numpy.distutils.system_info import BlasNotFoundError

    config = Configuration("glm", parent_package, top_path)

    site_cfg = ConfigParser()
    site_cfg.read(get_standard_file("site.cfg"))

    config.add_extension(
        "cd_fast_sparse",
        sources=[join("src", "cd_fast_sparse.c")],
        include_dirs=[numpy.get_include()],
        extra_compile_args=["-std=c99"],
    )

    # add other directories
    config.add_subpackage("tests")
    return config
コード例 #10
0
ファイル: setup.py プロジェクト: mszafran/scikit-learn
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, get_standard_file, \
         BlasNotFoundError

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

    config.add_subpackage('tests')
    config.add_subpackage('sparse')

    # we parse site.cfg file for section libsvm
    site_cfg  = ConfigParser()
    site_cfg.read(get_standard_file('site.cfg'))

    # Section LibSVM
    libsvm_includes = [numpy.get_include()]
    libsvm_libraries = []
    libsvm_library_dirs = []
    libsvm_sources = [join('src', 'libsvm', '_libsvm.c')]
    libsvm_depends = [join('src', 'libsvm', 'libsvm_helper.c')]

    # we try to link against system-wide libsvm
    if site_cfg.has_section('libsvm'):
        libsvm_includes.append(site_cfg.get('libsvm', 'include_dirs'))
        libsvm_libraries.append(site_cfg.get('libsvm', 'libraries'))
        libsvm_library_dirs.append(site_cfg.get('libsvm', 'library_dirs'))
    else:
        # if not specified, we build our own libsvm
        libsvm_sources.append(join('src', 'libsvm', 'svm.cpp'))
        libsvm_depends.append(join('src', 'libsvm', 'svm.h'))

    config.add_extension('_libsvm',
                         sources=libsvm_sources,
                         include_dirs=libsvm_includes,
                         libraries=libsvm_libraries,
                         library_dirs=libsvm_library_dirs,
                         depends=libsvm_depends,
                         )


    ### liblinear module
    blas_sources = [join('src', 'blas', 'daxpy.c'),
                    join('src', 'blas', 'ddot.c'),
                    join('src', 'blas', 'dnrm2.c'),
                    join('src', 'blas', 'dscal.c')]

    liblinear_sources = [join('src', 'liblinear', '_liblinear.c'),
                         join('src', 'liblinear', '*.cpp')]

    liblinear_depends = [join('src', 'liblinear', '*.h'),
                         join('src', 'liblinear', 'liblinear_helper.c')]

    # we try to link agains system-wide blas
    blas_info = get_info('blas_opt', 0)

    if not blas_info:
        config.add_library('blas', blas_sources)
        warnings.warn(BlasNotFoundError.__doc__)

    config.add_extension('_liblinear',
                         sources=liblinear_sources,
                         libraries = blas_info.pop('libraries', ['blas']),
                         include_dirs=['src',
                                       numpy.get_include(),
                                       blas_info.pop('include_dirs', [])],
                         depends=liblinear_depends,
                         **blas_info)

    ## end liblinear module

    return config
コード例 #11
0
ファイル: setup.py プロジェクト: ronnix/scikit-learn
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from numpy.distutils.system_info import get_info, get_standard_file, \
        BlasNotFoundError
    config = Configuration('learn', parent_package, top_path)

    site_cfg  = ConfigParser()
    site_cfg.read(get_standard_file('site.cfg'))

    config.add_subpackage('datasets')
    config.add_subpackage('features')
    config.add_subpackage('features/tests')
    config.add_subpackage('cluster')
    config.add_subpackage('cluster/tests')
    config.add_subpackage('covariance')
    config.add_subpackage('covariance/tests')
    config.add_subpackage('feature_selection')
    config.add_subpackage('feature_selection/tests')
    config.add_subpackage('sparse')
    config.add_subpackage('sparse/tests/')
    config.add_subpackage('utils')
    config.add_subpackage('utils/tests')
    config.add_subpackage('externals')

    # Section LibSVM
    libsvm_includes = [numpy.get_include()]
    libsvm_libraries = []
    libsvm_library_dirs = []
    libsvm_sources = [join('src', 'libsvm', '_libsvm.c')]

    # we try to link against system-wide libsvm
    if site_cfg.has_section('libsvm'):
        libsvm_includes.append(site_cfg.get('libsvm', 'include_dirs'))
        libsvm_libraries.append(site_cfg.get('libsvm', 'libraries'))
        libsvm_library_dirs.append(site_cfg.get('libsvm', 'library_dirs'))
    else:
        # if not specified, we build our own libsvm
        libsvm_sources.append(join('src', 'libsvm', 'svm.cpp'))

    config.add_extension('_libsvm',
                         sources=libsvm_sources,
                         include_dirs=libsvm_includes,
                         libraries=libsvm_libraries,
                         library_dirs=libsvm_library_dirs,
                         depends=[join('src', 'libsvm', 'svm.h'),
                                  join('src', 'libsvm', 'libsvm_helper.c')],
                         # add this for gdb debug
                         extra_compile_args=['-O0 -fno-inline']
                                  )

    ### liblinear module
    blas_sources = [join('src', 'blas', 'daxpy.c'),
                    join('src', 'blas', 'ddot.c'),
                    join('src', 'blas', 'dnrm2.c'),
                    join('src', 'blas', 'dscal.c')]

    liblinear_sources = [join('src', 'liblinear', '_liblinear.c'),
                         join('src', 'liblinear', '*.cpp')]

    # we try to link agains system-wide blas
    blas_info = get_info('blas_opt', 0)

    if not blas_info:
        config.add_library('blas', blas_sources)
        warnings.warn(BlasNotFoundError.__doc__)

    config.add_extension('_liblinear',
                         sources=liblinear_sources,
                         libraries = blas_info.pop('libraries', ['blas']),
                         include_dirs=['src',
                                       numpy.get_include(),
                                       blas_info.pop('include_dirs', [])],
                         depends=[join('src', 'liblinear', '*.h')],
                         **blas_info)

    ## end liblinear module

    # minilear needs cblas, fortran-compiled BLAS will not be sufficient
    blas_info = get_info('blas_opt', 0)
    if (not blas_info) or (
        ('NO_ATLAS_INFO', 1) in blas_info.get('define_macros', [])) :
        config.add_library('cblas',
                           sources=[
                               join('src', 'cblas', '*.c'),
                               ]
                           )
        cblas_libs = ['cblas']
        blas_info.pop('libraries', None)
    else:
        cblas_libs = blas_info.pop('libraries', [])

    minilearn_sources = [
        join('src', 'minilearn', 'lars.c'),
        join('src', 'minilearn', '_minilearn.c')]

    config.add_extension('_minilearn',
                         sources = minilearn_sources,
                         libraries = cblas_libs,
                         include_dirs=[join('src', 'minilearn'),
                                       join('src', 'cblas'),
                                       numpy.get_include(),
                                       blas_info.pop('include_dirs', [])],
                         extra_compile_args=['-std=c99'] + \
                                             blas_info.pop('extra_compile_args', []),
                         **blas_info
                         )

    config.add_extension('ball_tree',
                         sources=[join('src', 'BallTree.cpp')],
                         include_dirs=[numpy.get_include()]
                         )


    # this has to be build *after* cblas
    config.add_subpackage('glm')
    config.add_subpackage('utils')

    # add the test directory
    config.add_subpackage('tests')

    return config
コード例 #12
0
ファイル: siteconfig.py プロジェクト: cournape/numscons
def _get_standard_file(fname):
    try:
        from numpy.distutils.system_info import get_standard_file
        return get_standard_file(fname)
    except ImportError:
        return fname