Path: blob/master/ invest-robot-contest_TinkoffBotTwitch-main/venv/lib/python3.8/site-packages/numpy/distutils/extension.py
7757 views
"""distutils.extension12Provides the Extension class, used to describe C/C++ extension3modules in setup scripts.45Overridden to support f2py.67"""8import re9from distutils.extension import Extension as old_Extension101112cxx_ext_re = re.compile(r'.*\.(cpp|cxx|cc)\Z', re.I).match13fortran_pyf_ext_re = re.compile(r'.*\.(f90|f95|f77|for|ftn|f|pyf)\Z', re.I).match141516class Extension(old_Extension):17"""18Parameters19----------20name : str21Extension name.22sources : list of str23List of source file locations relative to the top directory of24the package.25extra_compile_args : list of str26Extra command line arguments to pass to the compiler.27extra_f77_compile_args : list of str28Extra command line arguments to pass to the fortran77 compiler.29extra_f90_compile_args : list of str30Extra command line arguments to pass to the fortran90 compiler.31"""32def __init__(33self, name, sources,34include_dirs=None,35define_macros=None,36undef_macros=None,37library_dirs=None,38libraries=None,39runtime_library_dirs=None,40extra_objects=None,41extra_compile_args=None,42extra_link_args=None,43export_symbols=None,44swig_opts=None,45depends=None,46language=None,47f2py_options=None,48module_dirs=None,49extra_c_compile_args=None,50extra_cxx_compile_args=None,51extra_f77_compile_args=None,52extra_f90_compile_args=None,):5354old_Extension.__init__(55self, name, [],56include_dirs=include_dirs,57define_macros=define_macros,58undef_macros=undef_macros,59library_dirs=library_dirs,60libraries=libraries,61runtime_library_dirs=runtime_library_dirs,62extra_objects=extra_objects,63extra_compile_args=extra_compile_args,64extra_link_args=extra_link_args,65export_symbols=export_symbols)6667# Avoid assert statements checking that sources contains strings:68self.sources = sources6970# Python 2.4 distutils new features71self.swig_opts = swig_opts or []72# swig_opts is assumed to be a list. Here we handle the case where it73# is specified as a string instead.74if isinstance(self.swig_opts, str):75import warnings76msg = "swig_opts is specified as a string instead of a list"77warnings.warn(msg, SyntaxWarning, stacklevel=2)78self.swig_opts = self.swig_opts.split()7980# Python 2.3 distutils new features81self.depends = depends or []82self.language = language8384# numpy_distutils features85self.f2py_options = f2py_options or []86self.module_dirs = module_dirs or []87self.extra_c_compile_args = extra_c_compile_args or []88self.extra_cxx_compile_args = extra_cxx_compile_args or []89self.extra_f77_compile_args = extra_f77_compile_args or []90self.extra_f90_compile_args = extra_f90_compile_args or []9192return9394def has_cxx_sources(self):95for source in self.sources:96if cxx_ext_re(str(source)):97return True98return False99100def has_f2py_sources(self):101for source in self.sources:102if fortran_pyf_ext_re(source):103return True104return False105106# class Extension107108109