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

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

    config.add_data_dir('tests')

    # qhull
    qhull_src = list(glob.glob(join(dirname(__file__), 'qhull', 'src', '*.c')))

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())
    inc_dirs.append(join(dirname(dirname(__file__)), '_lib'))

    cfg = dict(get_sys_info('lapack_opt'))
    cfg.setdefault('include_dirs', []).extend(inc_dirs)
    config.add_extension('qhull', sources=['qhull.c'] + qhull_src, **cfg)

    # cKDTree
    ckdtree_src = [
        'query.cxx', 'build.cxx', 'globals.cxx', 'cpp_exc.cxx',
        'query_pairs.cxx', 'count_neighbors.cxx', 'query_ball_point.cxx',
        'query_ball_tree.cxx', 'sparse_distances.cxx'
    ]

    ckdtree_src = [join('ckdtree', 'src', x) for x in ckdtree_src]

    ckdtree_headers = [
        'ckdtree_decl.h', 'ckdtree_methods.h', 'coo_entries.h', 'cpp_exc.h',
        'cpp_utils.h', 'distance_base.h', 'distance.h', 'ordered_pair.h',
        'partial_sort.h', 'rectangle.h'
    ]

    ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]

    ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src
    config.add_extension('ckdtree',
                         sources=['ckdtree.cxx'] + ckdtree_src,
                         depends=ckdtree_dep,
                         include_dirs=inc_dirs + [join('ckdtree', 'src')])
    # _distance_wrap
    config.add_extension('_distance_wrap',
                         sources=[join('src', 'distance_wrap.c')],
                         depends=[join('src', 'distance_impl.h')],
                         include_dirs=[get_numpy_include_dirs()],
                         extra_info=get_misc_info("npymath"))

    config.add_extension('_voronoi', sources=['_voronoi.c'])

    config.add_extension('_hausdorff', sources=['_hausdorff.c'])

    # Add license files
    config.add_data_files('qhull/COPYING.txt')

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

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

    config.add_data_dir('tests')

    # qhull
    qhull_src = [
        'geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c', 'mem.c',
        'merge.c', 'poly2.c', 'poly.c', 'qset.c', 'random.c', 'rboxlib.c',
        'stat.c', 'user.c', 'usermem.c', 'userprintf.c', 'userprintf_rbox.c'
    ]
    qhull_src = [join('qhull', 'src', x) for x in qhull_src]

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())

    cfg = dict(get_sys_info('lapack_opt'))
    cfg.setdefault('include_dirs', []).extend(inc_dirs)
    cfg.setdefault('define_macros', []).append(('qh_QHpointer', '1'))
    config.add_extension('qhull', sources=['qhull.c'] + qhull_src, **cfg)
    # cKDTree
    ckdtree_src = [
        'query.cxx', 'build.cxx', 'globals.cxx', 'cpp_exc.cxx',
        'query_pairs.cxx', 'count_neighbors.cxx', 'query_ball_point.cxx',
        'query_ball_tree.cxx', 'sparse_distances.cxx'
    ]

    ckdtree_src = [join('ckdtree', 'src', x) for x in ckdtree_src]

    ckdtree_headers = [
        'ckdtree_decl.h', 'cpp_exc.h', 'ckdtree_methods.h', 'cpp_utils.h',
        'rectangle.h', 'distance.h', 'distance_box.h', 'ordered_pair.h'
    ]

    ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]

    ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src
    config.add_extension('ckdtree',
                         sources=['ckdtree.cxx'] + ckdtree_src,
                         depends=ckdtree_dep,
                         include_dirs=inc_dirs + [join('ckdtree', 'src')])
    # _distance_wrap
    config.add_extension('_distance_wrap',
                         sources=[join('src', 'distance_wrap.c')],
                         depends=[join('src', 'distance_impl.h')],
                         include_dirs=[get_numpy_include_dirs()],
                         extra_info=get_misc_info("npymath"))

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

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

    config.add_data_dir('tests')

    # qhull
    qhull_src = ['geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c',
                 'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c',
                 'random.c', 'rboxlib.c', 'stat.c', 'user.c', 'usermem.c',
                 'userprintf.c', 'userprintf_rbox.c']
    qhull_src = [join('qhull', 'src', x) for x in qhull_src]

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())

    cfg = dict(get_sys_info('lapack_opt'))
    cfg.setdefault('include_dirs', []).extend(inc_dirs)
    cfg.setdefault('define_macros', []).append(('qh_QHpointer','1'))
    config.add_extension('qhull',
                         sources=['qhull.c'] + qhull_src,
                         **cfg)
    # cKDTree
    ckdtree_src = ['ckdtree_query.cxx',
                   'ckdtree_globals.cxx',
                   'ckdtree_cpp_exc.cxx']
    ckdtree_src = [join('ckdtree', 'src', x) for x in ckdtree_src]
    
    ckdtree_headers = ['ckdtree_decl.h', 
                       'ckdtree_exc.h', 
                       'ckdtree_methods.h',
                       'ckdtree_utils.h']
    ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]
    
    ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src
    config.add_extension('ckdtree',
                         sources=[join('ckdtree', 'ckdtree.cxx')] + ckdtree_src,
                         depends=ckdtree_dep,
                         include_dirs=inc_dirs + [join('ckdtree','src')])
    # _distance_wrap
    config.add_extension('_distance_wrap',
        sources=[join('src', 'distance_wrap.c')],
        depends=[join('src', 'distance_impl.h')],
        include_dirs=[get_numpy_include_dirs()],
        extra_info=get_misc_info("npymath"))

    return config
Пример #4
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
    from numpy.distutils.misc_util import get_info as get_misc_info
    from _build_utils.system_info import get_info as get_sys_info
    from distutils.sysconfig import get_python_inc

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

    config.add_data_dir('tests')

    # spatial.transform
    config.add_subpackage('transform')

    # qhull
    qhull_src = sorted(
        glob.glob(join(dirname(__file__), 'qhull_src', 'src', '*.c')))

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())
    inc_dirs.append(join(dirname(dirname(__file__)), '_lib'))

    cfg = dict(get_sys_info('lapack_opt'))
    cfg.setdefault('include_dirs', []).extend(inc_dirs)
    config.add_extension('qhull',
                         sources=['qhull.c', 'qhull_misc.c'] + qhull_src,
                         **cfg)

    # _distance_wrap
    config.add_extension('_distance_wrap',
                         sources=[join('src', 'distance_wrap.c')],
                         depends=[join('src', 'distance_impl.h')],
                         include_dirs=[get_numpy_include_dirs()],
                         extra_info=get_misc_info("npymath"))

    config.add_extension('_voronoi', sources=['_voronoi.c'])

    config.add_extension('_hausdorff', sources=['_hausdorff.c'])

    # Add license files
    config.add_data_files('qhull_src/COPYING.txt')

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

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

    config.add_data_dir('tests')

    # _distance_wrap
    config.add_extension('_distance_wrap',
                         sources=[join('src', 'distance_wrap.c')],
                         depends=[join('src', 'distance_impl.h')],
                         include_dirs=[get_numpy_include_dirs()],
                         extra_info=get_misc_info("npymath"))

    config.add_extension('_hausdorff', sources=['_hausdorff.c'])

    return config
Пример #6
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
    from numpy.distutils.misc_util import get_info as get_misc_info
    from scipy._build_utils.system_info import get_info
    from scipy._build_utils import combine_dict, uses_blas64, numpy_nodepr_api
    from scipy._build_utils.compiler_helper import set_cxx_flags_hook
    from distutils.sysconfig import get_python_inc
    import pybind11

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

    # spatial.transform
    config.add_subpackage('transform')

    # qhull
    qhull_src = sorted(
        glob.glob(join(dirname(__file__), 'qhull_src', 'src', '*.c')))

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())
    inc_dirs.append(join(dirname(dirname(__file__)), '_lib'))
    inc_dirs.append(join(dirname(dirname(__file__)), '_build_utils', 'src'))

    if uses_blas64():
        lapack_opt = get_info('lapack_ilp64_opt')
    else:
        lapack_opt = get_info('lapack_opt')

    cfg = combine_dict(lapack_opt, include_dirs=inc_dirs)
    config.add_extension('qhull',
                         sources=['qhull.c', 'qhull_misc.c'] + qhull_src,
                         **cfg)

    # cKDTree
    ckdtree_src = [
        'query.cxx', 'build.cxx', 'query_pairs.cxx', 'count_neighbors.cxx',
        'query_ball_point.cxx', 'query_ball_tree.cxx', 'sparse_distances.cxx'
    ]

    ckdtree_src = [join('ckdtree', 'src', x) for x in ckdtree_src]

    ckdtree_headers = [
        'ckdtree_decl.h', 'coo_entries.h', 'distance_base.h', 'distance.h',
        'ordered_pair.h', 'partial_sort.h', 'rectangle.h'
    ]

    ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]

    ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src
    ext = config.add_extension('ckdtree',
                               sources=['ckdtree.cxx'] + ckdtree_src,
                               depends=ckdtree_dep,
                               include_dirs=inc_dirs +
                               [join('ckdtree', 'src')])
    ext._pre_build_hook = set_cxx_flags_hook

    # _distance_wrap
    config.add_extension('_distance_wrap',
                         sources=[join('src', 'distance_wrap.c')],
                         depends=[join('src', 'distance_impl.h')],
                         include_dirs=[
                             get_numpy_include_dirs(),
                             join(dirname(dirname(__file__)), '_lib')
                         ],
                         extra_info=get_misc_info("npymath"))

    distance_pybind_includes = [
        pybind11.get_include(True),
        pybind11.get_include(False),
        get_numpy_include_dirs()
    ]
    ext = config.add_extension('_distance_pybind',
                               sources=[join('src', 'distance_pybind.cpp')],
                               depends=[
                                   join('src', 'function_ref.h'),
                                   join('src', 'views.h'),
                                   join('src', 'distance_metrics.h')
                               ],
                               include_dirs=distance_pybind_includes,
                               language='c++',
                               **numpy_nodepr_api)
    ext._pre_build_hook = pre_build_hook

    config.add_extension('_voronoi', sources=['_voronoi.c'])

    config.add_extension('_hausdorff', sources=['_hausdorff.c'])

    # Add license files
    config.add_data_files('qhull_src/COPYING.txt')

    # Type stubs
    config.add_data_files('*.pyi')

    return config
Пример #7
0
def in_src(name):
    return osp.join('src', name)


# =========================================================================
config = Configuration(package_name='numpy_linalg')

inc_dirs = [get_python_inc()]
if inc_dirs[0] != get_python_inc(plat_specific=1):
    inc_dirs.append(get_python_inc(plat_specific=1))
inc_dirs.append(get_numpy_include_dirs())
inc_dirs.append('src')

lapack_info = get_sys_info('lapack_opt', 0)  # and {}
npymath_info = get_misc_info("npymath")
all_info = {k: lapack_info[k] + npymath_info[k] for k in lapack_info.keys()}
rearrange = in_src('rearrange_data.c.src')
module_loc = 'gufuncs.'

# =============================================================================
config.add_extension(module_loc + '_gufuncs_cloop',
                     sources=[in_src('gufuncs_cloop.c.src')],
                     include_dirs=inc_dirs,
                     extra_info=npymath_info)
# =============================================================================
config.add_extension(module_loc + '_gufuncs_blas',
                     sources=[in_src('gufuncs_blas.c.src'), rearrange],
                     include_dirs=inc_dirs,
                     extra_info=all_info)
# =============================================================================
Пример #8
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
    from numpy.distutils.misc_util import get_info as get_misc_info
    from numpy.distutils.system_info import get_info as get_sys_info
    from distutils.sysconfig import get_python_inc

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

    config.add_data_dir('tests')

    # qhull
    qhull_src = list(glob.glob(join(dirname(__file__), 'qhull', 'src', '*.c')))

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())

    cfg = dict(get_sys_info('lapack_opt'))
    cfg.setdefault('include_dirs', []).extend(inc_dirs)

    def get_qhull_misc_config(ext, build_dir):
        # Generate a header file containing defines
        config_cmd = config.get_config_cmd()
        defines = []
        if config_cmd.check_func('open_memstream', decl=True, call=True):
            defines.append(('HAVE_OPEN_MEMSTREAM', '1'))
        target = join(dirname(__file__), 'qhull_misc_config.h')
        with open(target, 'w') as f:
            for name, value in defines:
                f.write('#define {0} {1}\n'.format(name, value))

    config.add_extension('qhull',
                         sources=['qhull.c'] + qhull_src +
                         [get_qhull_misc_config],
                         **cfg)

    # cKDTree
    ckdtree_src = [
        'query.cxx', 'build.cxx', 'globals.cxx', 'cpp_exc.cxx',
        'query_pairs.cxx', 'count_neighbors.cxx', 'query_ball_point.cxx',
        'query_ball_tree.cxx', 'sparse_distances.cxx'
    ]

    ckdtree_src = [join('ckdtree', 'src', x) for x in ckdtree_src]

    ckdtree_headers = [
        'ckdtree_decl.h', 'cpp_exc.h', 'ckdtree_methods.h', 'cpp_utils.h',
        'rectangle.h', 'distance.h', 'distance_box.h', 'ordered_pair.h'
    ]

    ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]

    ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src
    config.add_extension('ckdtree',
                         sources=['ckdtree.cxx'] + ckdtree_src,
                         depends=ckdtree_dep,
                         include_dirs=inc_dirs + [join('ckdtree', 'src')])
    # _distance_wrap
    config.add_extension('_distance_wrap',
                         sources=[join('src', 'distance_wrap.c')],
                         depends=[join('src', 'distance_impl.h')],
                         include_dirs=[get_numpy_include_dirs()],
                         extra_info=get_misc_info("npymath"))

    return config
Пример #9
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
    from numpy.distutils.misc_util import get_info as get_misc_info
    from scipy._build_utils.system_info import get_info as get_sys_info
    from distutils.sysconfig import get_python_inc

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

    config.add_data_dir('tests')

    # spatial.transform
    config.add_subpackage('transform')

    # qhull
    qhull_src = list(glob.glob(join(dirname(__file__), 'qhull_src',
                                    'src', '*.c')))

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())
    inc_dirs.append(join(dirname(dirname(__file__)), '_lib'))

    cfg = dict(get_sys_info('lapack_opt'))
    cfg.setdefault('include_dirs', []).extend(inc_dirs)
    config.add_extension('qhull',
                         sources=['qhull.c'] + qhull_src,
                         **cfg)

    # cKDTree
    ckdtree_src = ['query.cxx',
                   'build.cxx',
                   'globals.cxx',
                   'cpp_exc.cxx',
                   'query_pairs.cxx',
                   'count_neighbors.cxx',
                   'query_ball_point.cxx',
                   'query_ball_tree.cxx',
                   'sparse_distances.cxx']

    ckdtree_src = [join('ckdtree', 'src', x) for x in ckdtree_src]

    ckdtree_headers = ['ckdtree_decl.h',
                       'ckdtree_methods.h',
                       'coo_entries.h',
                       'cpp_exc.h',
                       'cpp_utils.h',
                       'distance_base.h',
                       'distance.h',
                       'ordered_pair.h',
                       'partial_sort.h',
                       'rectangle.h']

    ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]

    ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src
    config.add_extension('ckdtree',
                         sources=['ckdtree.cxx'] + ckdtree_src,
                         depends=ckdtree_dep,
                         include_dirs=inc_dirs + [join('ckdtree', 'src')])
    # _distance_wrap
    config.add_extension('_distance_wrap',
                         sources=[join('src', 'distance_wrap.c')],
                         depends=[join('src', 'distance_impl.h')],
                         include_dirs=[get_numpy_include_dirs()],
                         extra_info=get_misc_info("npymath"))

    config.add_extension('_voronoi',
                         sources=['_voronoi.c'])

    config.add_extension('_hausdorff',
                         sources=['_hausdorff.c'])

    # Add license files
    config.add_data_files('qhull_src/COPYING.txt')

    return config
Пример #10
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
    from numpy.distutils.misc_util import get_info as get_misc_info
    from numpy.distutils.system_info import get_info as get_sys_info
    from distutils.sysconfig import get_python_inc

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

    config.add_data_dir('tests')

    # qhull
    qhull_src = list(glob.glob(join(dirname(__file__), 'qhull',
                                    'src', '*.c')))

    inc_dirs = [get_python_inc()]
    if inc_dirs[0] != get_python_inc(plat_specific=1):
        inc_dirs.append(get_python_inc(plat_specific=1))
    inc_dirs.append(get_numpy_include_dirs())

    cfg = dict(get_sys_info('lapack_opt'))
    cfg.setdefault('include_dirs', []).extend(inc_dirs)

    def get_qhull_misc_config(ext, build_dir):
        # Generate a header file containing defines
        config_cmd = config.get_config_cmd()
        defines = []
        if config_cmd.check_func('open_memstream', decl=True, call=True):
            defines.append(('HAVE_OPEN_MEMSTREAM', '1'))
        target = join(dirname(__file__), 'qhull_misc_config.h')
        with open(target, 'w') as f:
            for name, value in defines:
                f.write('#define {0} {1}\n'.format(name, value))

    config.add_extension('qhull',
                         sources=['qhull.c'] + qhull_src + [get_qhull_misc_config],
                         **cfg)

    # cKDTree
    ckdtree_src = ['query.cxx',
                   'build.cxx',
                   'globals.cxx',
                   'cpp_exc.cxx',
                   'query_pairs.cxx',
                   'count_neighbors.cxx',
                   'query_ball_point.cxx',
                   'query_ball_tree.cxx',
                   'sparse_distances.cxx']

    ckdtree_src = [join('ckdtree', 'src', x) for x in ckdtree_src]

    ckdtree_headers = ['ckdtree_decl.h',
                       'cpp_exc.h',
                       'ckdtree_methods.h',
                       'cpp_utils.h',
                       'rectangle.h',
                       'distance.h',
                       'distance_box.h',
                       'ordered_pair.h']

    ckdtree_headers = [join('ckdtree', 'src', x) for x in ckdtree_headers]

    ckdtree_dep = ['ckdtree.cxx'] + ckdtree_headers + ckdtree_src
    config.add_extension('ckdtree',
                         sources=['ckdtree.cxx'] + ckdtree_src,
                         depends=ckdtree_dep,
                         include_dirs=inc_dirs + [join('ckdtree','src')])
    # _distance_wrap
    config.add_extension('_distance_wrap',
        sources=[join('src', 'distance_wrap.c')],
        depends=[join('src', 'distance_impl.h')],
        include_dirs=[get_numpy_include_dirs()],
        extra_info=get_misc_info("npymath"))

    config.add_extension('_voronoi',
                         sources=['_voronoi.c'])

    config.add_extension('_hausdorff',
                         sources=['_hausdorff.c'])

    return config