Ejemplo n.º 1
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from scipy._build_utils.compiler_helper import set_cxx_flags_hook
    import numpy as np
    config = Configuration('stats', parent_package, top_path)

    config.add_data_dir('tests')

    statlib_src = [join('statlib', '*.f')]
    config.add_library('statlib', sources=statlib_src)

    # add statlib module
    config.add_extension('statlib',
                         sources=['statlib.pyf'],
                         f2py_options=['--no-wrap-functions'],
                         libraries=['statlib'],
                         depends=statlib_src)

    # add _stats module
    config.add_extension('_stats', sources=['_stats.c'])

    # add mvn module
    config.add_extension('mvn', sources=['mvn.pyf', 'mvndst.f'])

    # add _sobol module
    config.add_extension('_sobol', sources=['_sobol.c'])
    config.add_data_files('_sobol_direction_numbers.npz')

    # add _qmc_cy module
    ext = config.add_extension('_qmc_cy', sources=['_qmc_cy.cxx'])
    ext._pre_build_hook = set_cxx_flags_hook

    # add BiasedUrn module
    config.add_data_files('biasedurn.pxd')
    from _generate_pyx import isNPY_OLD  # type: ignore[import]
    NPY_OLD = isNPY_OLD()

    if NPY_OLD:
        biasedurn_libs = []
        biasedurn_libdirs = []
    else:
        biasedurn_libs = ['npyrandom', 'npymath']
        biasedurn_libdirs = [
            join(np.get_include(), '..', '..', 'random', 'lib')
        ]
        biasedurn_libdirs += get_info('npymath')['library_dirs']

    ext = config.add_extension(
        'biasedurn',
        sources=[
            'biasedurn.cxx', 'biasedurn/impls.cpp', 'biasedurn/fnchyppr.cpp',
            'biasedurn/wnchyppr.cpp', 'biasedurn/stoc1.cpp',
            'biasedurn/stoc3.cpp'
        ],
        include_dirs=[np.get_include()],
        library_dirs=biasedurn_libdirs,
        libraries=biasedurn_libs,
        define_macros=[('R_BUILD', None)],
        language='c++',
        extra_compile_args=['-Wno-narrowing'] if system() == 'Darwin' else [],
        depends=['biasedurn/stocR.h'],
    )
    ext._pre_build_hook = pre_build_hook

    # add boost stats distributions
    config.add_subpackage('_boost')

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

    return config
Ejemplo n.º 2
0
def configuration(parent_package='', top_path=None):
    from numpy.distutils.misc_util import Configuration
    from scipy._build_utils.compiler_helper import set_cxx_flags_hook
    import numpy as np
    config = Configuration('stats', parent_package, top_path)

    statlib_src = [join('statlib', '*.f')]
    config.add_library('statlib', sources=statlib_src)

    # add statlib module
    config.add_extension('statlib',
                         sources=['statlib.pyf'],
                         f2py_options=['--no-wrap-functions'],
                         libraries=['statlib'],
                         depends=statlib_src)

    # add _stats module
    config.add_extension('_stats', sources=['_stats.c'])

    # add mvn module
    config.add_extension('mvn', sources=['mvn.pyf', 'mvndst.f'])

    # add _sobol module
    config.add_extension('_sobol', sources=['_sobol.c'])
    config.add_data_files('_sobol_direction_numbers.npz')

    # add _qmc_cy module
    ext = config.add_extension('_qmc_cy', sources=['_qmc_cy.cxx'])
    ext._pre_build_hook = set_cxx_flags_hook

    if int(os.environ.get('SCIPY_USE_PYTHRAN', 1)):
        import pythran
        ext = pythran.dist.PythranExtension(
            'scipy.stats._hypotests_pythran',
            sources=["scipy/stats/_hypotests_pythran.py"],
            config=['compiler.blas=none'])
        config.ext_modules.append(ext)

    # add BiasedUrn module
    config.add_data_files('biasedurn.pxd')
    from _generate_pyx import isNPY_OLD  # type: ignore[import]
    NPY_OLD = isNPY_OLD()

    if NPY_OLD:
        biasedurn_libs = []
        biasedurn_libdirs = []
    else:
        biasedurn_libs = ['npyrandom', 'npymath']
        biasedurn_libdirs = [
            join(np.get_include(), '..', '..', 'random', 'lib')
        ]
        biasedurn_libdirs += get_info('npymath')['library_dirs']

    ext = config.add_extension(
        'biasedurn',
        sources=[
            'biasedurn.cxx', 'biasedurn/impls.cpp', 'biasedurn/fnchyppr.cpp',
            'biasedurn/wnchyppr.cpp', 'biasedurn/stoc1.cpp',
            'biasedurn/stoc3.cpp'
        ],
        include_dirs=[np.get_include()],
        library_dirs=biasedurn_libdirs,
        libraries=biasedurn_libs,
        define_macros=[('R_BUILD', None)],
        language='c++',
        depends=['biasedurn/stocR.h'],
    )
    ext._pre_build_hook = pre_build_hook

    # add boost stats distributions
    config.add_subpackage('_boost')

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

    return config
Ejemplo n.º 3
0
def configuration(parent_package='',top_path=None):
    from numpy.distutils.misc_util import Configuration
    import numpy as np
    config = Configuration('stats', parent_package, top_path)

    config.add_data_dir('tests')

    statlib_src = [join('statlib', '*.f')]
    config.add_library('statlib', sources=statlib_src)

    # add statlib module
    config.add_extension('statlib',
        sources=['statlib.pyf'],
        f2py_options=['--no-wrap-functions'],
        libraries=['statlib'],
        depends=statlib_src
    )

    # add _stats module
    config.add_extension('_stats',
        sources=['_stats.c'],
    )

    # add mvn module
    config.add_extension('mvn',
        sources=['mvn.pyf', 'mvndst.f'],
    )

    # add _sobol module
    config.add_extension('_sobol',
        sources=['_sobol.c', ],
    )
    config.add_data_files('_sobol_direction_numbers.npz')

    # add BiasedUrn module
    config.add_data_files('biasedurn.pxd')
    from _generate_pyx import isNPY_OLD
    NPY_OLD = isNPY_OLD()
    biasedurn_libs = [] if NPY_OLD else ['npyrandom']
    biasedurn_libdirs = [] if NPY_OLD else [join(np.get_include(),
                                                 '..', '..', 'random', 'lib')]
    ext = config.add_extension(
        'biasedurn',
        sources=[
            'biasedurn.cxx',
            'biasedurn/impls.cpp',
            'biasedurn/fnchyppr.cpp',
            'biasedurn/wnchyppr.cpp',
            'biasedurn/stoc1.cpp',
            'biasedurn/stoc3.cpp'],
        include_dirs=[np.get_include()],
        library_dirs=biasedurn_libdirs,
        libraries=biasedurn_libs,
        define_macros=[('R_BUILD', None)],
        language='c++',
        extra_compile_args=['-Wno-narrowing'] if system() == 'Darwin' else [],
        depends=['biasedurn/stocR.h'],
    )
    ext._pre_build_hook = pre_build_hook

    return config