Path: blob/master/ invest-robot-contest_TinkoffBotTwitch-main/venv/lib/python3.8/site-packages/numpy/random/setup.py
7757 views
import os1import platform2import sys3from os.path import join45from numpy.distutils.system_info import platform_bits67is_msvc = (platform.platform().startswith('Windows') and8platform.python_compiler().startswith('MS'))91011def configuration(parent_package='', top_path=None):12from numpy.distutils.misc_util import Configuration, get_mathlibs13config = Configuration('random', parent_package, top_path)1415def generate_libraries(ext, build_dir):16config_cmd = config.get_config_cmd()17libs = get_mathlibs()18if sys.platform == 'win32':19libs.extend(['Advapi32', 'Kernel32'])20ext.libraries.extend(libs)21return None2223# enable unix large file support on 32 bit systems24# (64 bit off_t, lseek -> lseek64 etc.)25if sys.platform[:3] == 'aix':26defs = [('_LARGE_FILES', None)]27else:28defs = [('_FILE_OFFSET_BITS', '64'),29('_LARGEFILE_SOURCE', '1'),30('_LARGEFILE64_SOURCE', '1')]3132defs.append(('NPY_NO_DEPRECATED_API', 0))33config.add_subpackage('tests')34config.add_data_dir('tests/data')35config.add_data_dir('_examples')3637EXTRA_LINK_ARGS = []38EXTRA_LIBRARIES = ['npyrandom']39if os.name != 'nt':40# Math lib41EXTRA_LIBRARIES.append('m')42# Some bit generators exclude GCC inlining43EXTRA_COMPILE_ARGS = ['-U__GNUC_GNU_INLINE__']4445if is_msvc and platform_bits == 32:46# 32-bit windows requires explicit sse2 option47EXTRA_COMPILE_ARGS += ['/arch:SSE2']48elif not is_msvc:49# Some bit generators require c9950EXTRA_COMPILE_ARGS += ['-std=c99']5152# Use legacy integer variable sizes53LEGACY_DEFS = [('NP_RANDOM_LEGACY', '1')]54PCG64_DEFS = []55# One can force emulated 128-bit arithmetic if one wants.56#PCG64_DEFS += [('PCG_FORCE_EMULATED_128BIT_MATH', '1')]57depends = ['__init__.pxd', 'c_distributions.pxd', 'bit_generator.pxd']5859# npyrandom - a library like npymath60npyrandom_sources = [61'src/distributions/logfactorial.c',62'src/distributions/distributions.c',63'src/distributions/random_mvhg_count.c',64'src/distributions/random_mvhg_marginals.c',65'src/distributions/random_hypergeometric.c',66]6768def gl_if_msvc(build_cmd):69""" Add flag if we are using MSVC compiler7071We can't see this in our scope, because we have not initialized the72distutils build command, so use this deferred calculation to run when73we are building the library.74"""75# Keep in sync with numpy/core/setup.py76if build_cmd.compiler.compiler_type == 'msvc':77# explicitly disable whole-program optimization78return ['/GL-']79return []8081config.add_installed_library('npyrandom',82sources=npyrandom_sources,83install_dir='lib',84build_info={85'include_dirs' : [], # empty list required for creating npyrandom.h86'extra_compiler_args': [gl_if_msvc],87})8889for gen in ['mt19937']:90# gen.pyx, src/gen/gen.c, src/gen/gen-jump.c91config.add_extension(f'_{gen}',92sources=[f'_{gen}.c',93f'src/{gen}/{gen}.c',94f'src/{gen}/{gen}-jump.c'],95include_dirs=['.', 'src', join('src', gen)],96libraries=EXTRA_LIBRARIES,97extra_compile_args=EXTRA_COMPILE_ARGS,98extra_link_args=EXTRA_LINK_ARGS,99depends=depends + [f'_{gen}.pyx'],100define_macros=defs,101)102for gen in ['philox', 'pcg64', 'sfc64']:103# gen.pyx, src/gen/gen.c104_defs = defs + PCG64_DEFS if gen == 'pcg64' else defs105config.add_extension(f'_{gen}',106sources=[f'_{gen}.c',107f'src/{gen}/{gen}.c'],108include_dirs=['.', 'src', join('src', gen)],109libraries=EXTRA_LIBRARIES,110extra_compile_args=EXTRA_COMPILE_ARGS,111extra_link_args=EXTRA_LINK_ARGS,112depends=depends + [f'_{gen}.pyx',113'bit_generator.pyx', 'bit_generator.pxd'],114define_macros=_defs,115)116for gen in ['_common', 'bit_generator']:117# gen.pyx118config.add_extension(gen,119sources=[f'{gen}.c'],120libraries=EXTRA_LIBRARIES,121extra_compile_args=EXTRA_COMPILE_ARGS,122extra_link_args=EXTRA_LINK_ARGS,123include_dirs=['.', 'src'],124depends=depends + [f'{gen}.pyx', f'{gen}.pxd',],125define_macros=defs,126)127config.add_data_files(f'{gen}.pxd')128for gen in ['_generator', '_bounded_integers']:129# gen.pyx, src/distributions/distributions.c130config.add_extension(gen,131sources=[f'{gen}.c'],132libraries=EXTRA_LIBRARIES + ['npymath'],133extra_compile_args=EXTRA_COMPILE_ARGS,134include_dirs=['.', 'src'],135extra_link_args=EXTRA_LINK_ARGS,136depends=depends + [f'{gen}.pyx'],137define_macros=defs,138)139config.add_data_files('_bounded_integers.pxd')140mtrand_libs = ['m', 'npymath'] if os.name != 'nt' else ['npymath']141config.add_extension('mtrand',142sources=['mtrand.c',143'src/legacy/legacy-distributions.c',144'src/distributions/distributions.c',145],146include_dirs=['.', 'src', 'src/legacy'],147libraries=mtrand_libs,148extra_compile_args=EXTRA_COMPILE_ARGS,149extra_link_args=EXTRA_LINK_ARGS,150depends=depends + ['mtrand.pyx'],151define_macros=defs + LEGACY_DEFS,152)153config.add_data_files(*depends)154config.add_data_files('*.pyi')155return config156157158if __name__ == '__main__':159from numpy.distutils.core import setup160161setup(configuration=configuration)162163164