summaryrefslogtreecommitdiffstats
path: root/contrib/python/numpy/py3
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-11-28 20:07:09 +0300
committerrobot-piglet <[email protected]>2025-11-28 20:36:39 +0300
commit58231bec0c447968e213059860a163e950407ead (patch)
tree5217719928b918ab1aba154e8306ec4f74b469f3 /contrib/python/numpy/py3
parent9d52d4f24be288da2d493e05aa33834b726914aa (diff)
Intermediate changes
commit_hash:30f4602dbcd98a42145163d6890ec6ee6bfee959
Diffstat (limited to 'contrib/python/numpy/py3')
-rw-r--r--contrib/python/numpy/py3/numpy/__config__.py.in162
-rw-r--r--contrib/python/numpy/py3/numpy/_build_utils/setup.py12
-rw-r--r--contrib/python/numpy/py3/numpy/_typing/setup.py10
-rw-r--r--contrib/python/numpy/py3/numpy/array_api/setup.py12
-rw-r--r--contrib/python/numpy/py3/numpy/compat/setup.py10
-rw-r--r--contrib/python/numpy/py3/numpy/core/config.h.in117
-rw-r--r--contrib/python/numpy/py3/numpy/core/include/numpy/_numpyconfig.h.in32
-rw-r--r--contrib/python/numpy/py3/numpy/core/mlib.ini.in12
-rw-r--r--contrib/python/numpy/py3/numpy/core/npymath.ini.in20
-rw-r--r--contrib/python/numpy/py3/numpy/core/setup.py1112
-rw-r--r--contrib/python/numpy/py3/numpy/core/setup_common.py430
-rw-r--r--contrib/python/numpy/py3/numpy/core/tests/examples/cython/setup.py25
-rw-r--r--contrib/python/numpy/py3/numpy/core/tests/examples/limited_api/setup.py22
-rw-r--r--contrib/python/numpy/py3/numpy/distutils/setup.py17
-rw-r--r--contrib/python/numpy/py3/numpy/f2py/setup.py74
-rw-r--r--contrib/python/numpy/py3/numpy/fft/setup.py22
-rw-r--r--contrib/python/numpy/py3/numpy/lib/setup.py12
-rw-r--r--contrib/python/numpy/py3/numpy/linalg/setup.py91
-rw-r--r--contrib/python/numpy/py3/numpy/ma/setup.py12
-rw-r--r--contrib/python/numpy/py3/numpy/matrixlib/setup.py12
-rw-r--r--contrib/python/numpy/py3/numpy/polynomial/setup.py10
-rw-r--r--contrib/python/numpy/py3/numpy/random/_bounded_integers.pxd.in26
-rw-r--r--contrib/python/numpy/py3/numpy/random/_bounded_integers.pyx.in369
-rw-r--r--contrib/python/numpy/py3/numpy/random/setup.py159
-rw-r--r--contrib/python/numpy/py3/numpy/setup.py34
-rw-r--r--contrib/python/numpy/py3/numpy/testing/setup.py21
-rw-r--r--contrib/python/numpy/py3/numpy/typing/setup.py11
27 files changed, 0 insertions, 2846 deletions
diff --git a/contrib/python/numpy/py3/numpy/__config__.py.in b/contrib/python/numpy/py3/numpy/__config__.py.in
deleted file mode 100644
index f3b32c28c10..00000000000
--- a/contrib/python/numpy/py3/numpy/__config__.py.in
+++ /dev/null
@@ -1,162 +0,0 @@
-# This file is generated by numpy's build process
-# It contains system_info results at the time of building this package.
-from enum import Enum
-from numpy.core._multiarray_umath import (
- __cpu_features__,
- __cpu_baseline__,
- __cpu_dispatch__,
-)
-
-__all__ = ["show"]
-_built_with_meson = True
-
-
-class DisplayModes(Enum):
- stdout = "stdout"
- dicts = "dicts"
-
-
-def _cleanup(d):
- """
- Removes empty values in a `dict` recursively
- This ensures we remove values that Meson could not provide to CONFIG
- """
- if isinstance(d, dict):
- return {k: _cleanup(v) for k, v in d.items() if v and _cleanup(v)}
- else:
- return d
-
-
-CONFIG = _cleanup(
- {
- "Compilers": {
- "c": {
- "name": "@C_COMP@",
- "linker": r"@C_COMP_LINKER_ID@",
- "version": "@C_COMP_VERSION@",
- "commands": r"@C_COMP_CMD_ARRAY@",
- "args": r"@C_COMP_ARGS@",
- "linker args": r"@C_COMP_LINK_ARGS@",
- },
- "cython": {
- "name": "@CYTHON_COMP@",
- "linker": r"@CYTHON_COMP_LINKER_ID@",
- "version": "@CYTHON_COMP_VERSION@",
- "commands": r"@CYTHON_COMP_CMD_ARRAY@",
- "args": r"@CYTHON_COMP_ARGS@",
- "linker args": r"@CYTHON_COMP_LINK_ARGS@",
- },
- "c++": {
- "name": "@CPP_COMP@",
- "linker": r"@CPP_COMP_LINKER_ID@",
- "version": "@CPP_COMP_VERSION@",
- "commands": r"@CPP_COMP_CMD_ARRAY@",
- "args": r"@CPP_COMP_ARGS@",
- "linker args": r"@CPP_COMP_LINK_ARGS@",
- },
- },
- "Machine Information": {
- "host": {
- "cpu": "@HOST_CPU@",
- "family": "@HOST_CPU_FAMILY@",
- "endian": "@HOST_CPU_ENDIAN@",
- "system": "@HOST_CPU_SYSTEM@",
- },
- "build": {
- "cpu": "@BUILD_CPU@",
- "family": "@BUILD_CPU_FAMILY@",
- "endian": "@BUILD_CPU_ENDIAN@",
- "system": "@BUILD_CPU_SYSTEM@",
- },
- "cross-compiled": bool("@CROSS_COMPILED@".lower().replace("false", "")),
- },
- "Build Dependencies": {
- "blas": {
- "name": "@BLAS_NAME@",
- "found": bool("@BLAS_FOUND@".lower().replace("false", "")),
- "version": "@BLAS_VERSION@",
- "detection method": "@BLAS_TYPE_NAME@",
- "include directory": r"@BLAS_INCLUDEDIR@",
- "lib directory": r"@BLAS_LIBDIR@",
- "openblas configuration": r"@BLAS_OPENBLAS_CONFIG@",
- "pc file directory": r"@BLAS_PCFILEDIR@",
- },
- "lapack": {
- "name": "@LAPACK_NAME@",
- "found": bool("@LAPACK_FOUND@".lower().replace("false", "")),
- "version": "@LAPACK_VERSION@",
- "detection method": "@LAPACK_TYPE_NAME@",
- "include directory": r"@LAPACK_INCLUDEDIR@",
- "lib directory": r"@LAPACK_LIBDIR@",
- "openblas configuration": r"@LAPACK_OPENBLAS_CONFIG@",
- "pc file directory": r"@LAPACK_PCFILEDIR@",
- },
- },
- "Python Information": {
- "path": r"@PYTHON_PATH@",
- "version": "@PYTHON_VERSION@",
- },
- "SIMD Extensions": {
- "baseline": __cpu_baseline__,
- "found": [
- feature for feature in __cpu_dispatch__ if __cpu_features__[feature]
- ],
- "not found": [
- feature for feature in __cpu_dispatch__ if not __cpu_features__[feature]
- ],
- },
- }
-)
-
-
-def _check_pyyaml():
- import yaml
-
- return yaml
-
-
-def show(mode=DisplayModes.stdout.value):
- """
- Show libraries and system information on which NumPy was built
- and is being used
-
- Parameters
- ----------
- mode : {`'stdout'`, `'dicts'`}, optional.
- Indicates how to display the config information.
- `'stdout'` prints to console, `'dicts'` returns a dictionary
- of the configuration.
-
- Returns
- -------
- out : {`dict`, `None`}
- If mode is `'dicts'`, a dict is returned, else None
-
- See Also
- --------
- get_include : Returns the directory containing NumPy C
- header files.
-
- Notes
- -----
- 1. The `'stdout'` mode will give more readable
- output if ``pyyaml`` is installed
-
- """
- if mode == DisplayModes.stdout.value:
- try: # Non-standard library, check import
- yaml = _check_pyyaml()
-
- print(yaml.dump(CONFIG))
- except ModuleNotFoundError:
- import warnings
- import json
-
- warnings.warn("Install `pyyaml` for better output", stacklevel=1)
- print(json.dumps(CONFIG, indent=2))
- elif mode == DisplayModes.dicts.value:
- return CONFIG
- else:
- raise AttributeError(
- f"Invalid `mode`, use one of: {', '.join([e.value for e in DisplayModes])}"
- )
diff --git a/contrib/python/numpy/py3/numpy/_build_utils/setup.py b/contrib/python/numpy/py3/numpy/_build_utils/setup.py
deleted file mode 100644
index 73a8f2fff58..00000000000
--- a/contrib/python/numpy/py3/numpy/_build_utils/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
-
- config = Configuration('_build_utils', parent_package, top_path)
- config.add_data_dir('tests')
- return config
-
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
-
- setup(**configuration(top_path='').todict())
diff --git a/contrib/python/numpy/py3/numpy/_typing/setup.py b/contrib/python/numpy/py3/numpy/_typing/setup.py
deleted file mode 100644
index 24022fdaa32..00000000000
--- a/contrib/python/numpy/py3/numpy/_typing/setup.py
+++ /dev/null
@@ -1,10 +0,0 @@
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('_typing', parent_package, top_path)
- config.add_data_files('*.pyi')
- return config
-
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/array_api/setup.py b/contrib/python/numpy/py3/numpy/array_api/setup.py
deleted file mode 100644
index c8bc2910268..00000000000
--- a/contrib/python/numpy/py3/numpy/array_api/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-def configuration(parent_package="", top_path=None):
- from numpy.distutils.misc_util import Configuration
-
- config = Configuration("array_api", parent_package, top_path)
- config.add_subpackage("tests")
- return config
-
-
-if __name__ == "__main__":
- from numpy.distutils.core import setup
-
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/compat/setup.py b/contrib/python/numpy/py3/numpy/compat/setup.py
deleted file mode 100644
index c1b34a2cc95..00000000000
--- a/contrib/python/numpy/py3/numpy/compat/setup.py
+++ /dev/null
@@ -1,10 +0,0 @@
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
-
- config = Configuration('compat', parent_package, top_path)
- config.add_subpackage('tests')
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/core/config.h.in b/contrib/python/numpy/py3/numpy/core/config.h.in
deleted file mode 100644
index cd63a59b2af..00000000000
--- a/contrib/python/numpy/py3/numpy/core/config.h.in
+++ /dev/null
@@ -1,117 +0,0 @@
-#mesondefine SIZEOF_PY_INTPTR_T
-#mesondefine SIZEOF_OFF_T
-#mesondefine SIZEOF_PY_LONG_LONG
-
-#mesondefine HAVE_BACKTRACE
-#mesondefine HAVE_MADVISE
-#mesondefine HAVE_FTELLO
-#mesondefine HAVE_FSEEKO
-#mesondefine HAVE_FALLOCATE
-#mesondefine HAVE_STRTOLD_L
-#mesondefine HAVE__THREAD
-#mesondefine HAVE___DECLSPEC_THREAD_
-
-/* Optional headers */
-#mesondefine HAVE_FEATURES_H
-#mesondefine HAVE_XLOCALE_H
-#mesondefine HAVE_DLFCN_H
-#mesondefine HAVE_EXECINFO_H
-#mesondefine HAVE_LIBUNWIND_H
-#mesondefine HAVE_SYS_MMAN_H
-#mesondefine HAVE_XMMINTRIN_H
-#mesondefine HAVE_EMMINTRIN_H
-#mesondefine HAVE_IMMINTRIN_H
-
-/* Optional intrinsics */
-#mesondefine HAVE___BUILTIN_ISNAN
-#mesondefine HAVE___BUILTIN_ISINF
-#mesondefine HAVE___BUILTIN_ISFINITE
-#mesondefine HAVE___BUILTIN_BSWAP32
-#mesondefine HAVE___BUILTIN_BSWAP64
-#mesondefine HAVE___BUILTIN_EXPECT
-#mesondefine HAVE___BUILTIN_MUL_OVERFLOW
-#mesondefine HAVE___BUILTIN_PREFETCH
-
-#mesondefine HAVE_ATTRIBUTE_OPTIMIZE_UNROLL_LOOPS
-#mesondefine HAVE_ATTRIBUTE_OPTIMIZE_OPT_3
-#mesondefine HAVE_ATTRIBUTE_OPTIMIZE_OPT_2
-#mesondefine HAVE_ATTRIBUTE_NONNULL
-
-/* C99 complex support and complex.h are not universal */
-#mesondefine HAVE_COMPLEX_H
-#mesondefine HAVE_CABS
-#mesondefine HAVE_CACOS
-#mesondefine HAVE_CACOSH
-#mesondefine HAVE_CARG
-#mesondefine HAVE_CASIN
-#mesondefine HAVE_CASINH
-#mesondefine HAVE_CATAN
-#mesondefine HAVE_CATANH
-#mesondefine HAVE_CEXP
-#mesondefine HAVE_CLOG
-#mesondefine HAVE_CPOW
-#mesondefine HAVE_CSQRT
-#mesondefine HAVE_CABSF
-#mesondefine HAVE_CACOSF
-#mesondefine HAVE_CACOSHF
-#mesondefine HAVE_CARGF
-#mesondefine HAVE_CASINF
-#mesondefine HAVE_CASINHF
-#mesondefine HAVE_CATANF
-#mesondefine HAVE_CATANHF
-#mesondefine HAVE_CEXPF
-#mesondefine HAVE_CLOGF
-#mesondefine HAVE_CPOWF
-#mesondefine HAVE_CSQRTF
-#mesondefine HAVE_CABSL
-#mesondefine HAVE_CACOSL
-#mesondefine HAVE_CACOSHL
-#mesondefine HAVE_CARGL
-#mesondefine HAVE_CASINL
-#mesondefine HAVE_CASINHL
-#mesondefine HAVE_CATANL
-#mesondefine HAVE_CATANHL
-#mesondefine HAVE_CEXPL
-#mesondefine HAVE_CLOGL
-#mesondefine HAVE_CPOWL
-#mesondefine HAVE_CSQRTL
-/* FreeBSD */
-#mesondefine HAVE_CSINF
-#mesondefine HAVE_CSINHF
-#mesondefine HAVE_CCOSF
-#mesondefine HAVE_CCOSHF
-#mesondefine HAVE_CTANF
-#mesondefine HAVE_CTANHF
-#mesondefine HAVE_CSIN
-#mesondefine HAVE_CSINH
-#mesondefine HAVE_CCOS
-#mesondefine HAVE_CCOSH
-#mesondefine HAVE_CTAN
-#mesondefine HAVE_CTANH
-#mesondefine HAVE_CSINL
-#mesondefine HAVE_CSINHL
-#mesondefine HAVE_CCOSL
-#mesondefine HAVE_CCOSHL
-#mesondefine HAVE_CTANL
-#mesondefine HAVE_CTANHL
-
-#mesondefine NPY_CAN_LINK_SVML
-#mesondefine NPY_RELAXED_STRIDES_DEBUG
-
-#mesondefine HAVE_LDOUBLE_INTEL_EXTENDED_16_BYTES_LE
-#mesondefine HAVE_LDOUBLE_INTEL_EXTENDED_12_BYTES_LE
-#mesondefine HAVE_LDOUBLE_MOTOROLA_EXTENDED_12_BYTES_BE
-#mesondefine HAVE_LDOUBLE_IEEE_DOUBLE_LE
-#mesondefine HAVE_LDOUBLE_IEEE_DOUBLE_BE
-#mesondefine HAVE_LDOUBLE_IEEE_QUAD_LE
-#mesondefine HAVE_LDOUBLE_IEEE_QUAD_BE
-#mesondefine HAVE_LDOUBLE_IBM_DOUBLE_DOUBLE_LE
-#mesondefine HAVE_LDOUBLE_IBM_DOUBLE_DOUBLE_BE
-
-#ifndef __cplusplus
-/* #undef inline */
-#endif
-
-#ifndef NUMPY_CORE_SRC_COMMON_NPY_CONFIG_H_
-#error config.h should never be included directly, include npy_config.h instead
-#endif
diff --git a/contrib/python/numpy/py3/numpy/core/include/numpy/_numpyconfig.h.in b/contrib/python/numpy/py3/numpy/core/include/numpy/_numpyconfig.h.in
deleted file mode 100644
index a218200264e..00000000000
--- a/contrib/python/numpy/py3/numpy/core/include/numpy/_numpyconfig.h.in
+++ /dev/null
@@ -1,32 +0,0 @@
-#mesondefine NPY_HAVE_ENDIAN_H
-
-#mesondefine NPY_SIZEOF_SHORT
-#mesondefine NPY_SIZEOF_INT
-#mesondefine NPY_SIZEOF_LONG
-#mesondefine NPY_SIZEOF_FLOAT
-#mesondefine NPY_SIZEOF_COMPLEX_FLOAT
-#mesondefine NPY_SIZEOF_DOUBLE
-#mesondefine NPY_SIZEOF_COMPLEX_DOUBLE
-#mesondefine NPY_SIZEOF_LONGDOUBLE
-#mesondefine NPY_SIZEOF_COMPLEX_LONGDOUBLE
-#mesondefine NPY_SIZEOF_PY_INTPTR_T
-#mesondefine NPY_SIZEOF_OFF_T
-#mesondefine NPY_SIZEOF_PY_LONG_LONG
-#mesondefine NPY_SIZEOF_LONGLONG
-
-#mesondefine NPY_USE_C99_COMPLEX
-#mesondefine NPY_HAVE_COMPLEX_DOUBLE
-#mesondefine NPY_HAVE_COMPLEX_FLOAT
-#mesondefine NPY_HAVE_COMPLEX_LONG_DOUBLE
-#mesondefine NPY_USE_C99_FORMATS
-
-#mesondefine NPY_NO_SIGNAL
-#mesondefine NPY_NO_SMP
-
-#mesondefine NPY_VISIBILITY_HIDDEN
-#mesondefine NPY_ABI_VERSION
-#mesondefine NPY_API_VERSION
-
-#ifndef __STDC_FORMAT_MACROS
-#define __STDC_FORMAT_MACROS 1
-#endif
diff --git a/contrib/python/numpy/py3/numpy/core/mlib.ini.in b/contrib/python/numpy/py3/numpy/core/mlib.ini.in
deleted file mode 100644
index badaa2ae9de..00000000000
--- a/contrib/python/numpy/py3/numpy/core/mlib.ini.in
+++ /dev/null
@@ -1,12 +0,0 @@
-[meta]
-Name = mlib
-Description = Math library used with this version of numpy
-Version = 1.0
-
-[default]
-Libs=@posix_mathlib@
-Cflags=
-
-[msvc]
-Libs=@msvc_mathlib@
-Cflags=
diff --git a/contrib/python/numpy/py3/numpy/core/npymath.ini.in b/contrib/python/numpy/py3/numpy/core/npymath.ini.in
deleted file mode 100644
index a233b8f3bfa..00000000000
--- a/contrib/python/numpy/py3/numpy/core/npymath.ini.in
+++ /dev/null
@@ -1,20 +0,0 @@
-[meta]
-Name=npymath
-Description=Portable, core math library implementing C99 standard
-Version=0.1
-
-[variables]
-pkgname=@pkgname@
-prefix=${pkgdir}
-libdir=${prefix}@sep@lib
-includedir=${prefix}@sep@include
-
-[default]
-Libs=-L${libdir} -lnpymath
-Cflags=-I${includedir}
-Requires=mlib
-
-[msvc]
-Libs=/LIBPATH:${libdir} npymath.lib
-Cflags=/INCLUDE:${includedir}
-Requires=mlib
diff --git a/contrib/python/numpy/py3/numpy/core/setup.py b/contrib/python/numpy/py3/numpy/core/setup.py
deleted file mode 100644
index a05b5da7963..00000000000
--- a/contrib/python/numpy/py3/numpy/core/setup.py
+++ /dev/null
@@ -1,1112 +0,0 @@
-import os
-import sys
-import sysconfig
-import pickle
-import copy
-import warnings
-import textwrap
-import glob
-from os.path import join
-
-from numpy.distutils import log
-from numpy.distutils.msvccompiler import lib_opts_if_msvc
-from distutils.dep_util import newer
-from sysconfig import get_config_var
-from numpy.compat import npy_load_module
-from setup_common import * # noqa: F403
-
-# Set to True to enable relaxed strides checking. This (mostly) means
-# that `strides[dim]` is ignored if `shape[dim] == 1` when setting flags.
-NPY_RELAXED_STRIDES_CHECKING = (os.environ.get('NPY_RELAXED_STRIDES_CHECKING', "1") != "0")
-if not NPY_RELAXED_STRIDES_CHECKING:
- raise SystemError(
- "Support for NPY_RELAXED_STRIDES_CHECKING=0 has been removed as of "
- "NumPy 1.23. This error will eventually be removed entirely.")
-
-# Put NPY_RELAXED_STRIDES_DEBUG=1 in the environment if you want numpy to use a
-# bogus value for affected strides in order to help smoke out bad stride usage
-# when relaxed stride checking is enabled.
-NPY_RELAXED_STRIDES_DEBUG = (os.environ.get('NPY_RELAXED_STRIDES_DEBUG', "0") != "0")
-NPY_RELAXED_STRIDES_DEBUG = NPY_RELAXED_STRIDES_DEBUG and NPY_RELAXED_STRIDES_CHECKING
-
-# Set NPY_DISABLE_SVML=1 in the environment to disable the vendored SVML
-# library. This option only has significance on a Linux x86_64 host and is most
-# useful to avoid improperly requiring SVML when cross compiling.
-NPY_DISABLE_SVML = (os.environ.get('NPY_DISABLE_SVML', "0") == "1")
-
-# XXX: ugly, we use a class to avoid calling twice some expensive functions in
-# config.h/numpyconfig.h. I don't see a better way because distutils force
-# config.h generation inside an Extension class, and as such sharing
-# configuration information between extensions is not easy.
-# Using a pickled-based memoize does not work because config_cmd is an instance
-# method, which cPickle does not like.
-#
-# Use pickle in all cases, as cPickle is gone in python3 and the difference
-# in time is only in build. -- Charles Harris, 2013-03-30
-
-class CallOnceOnly:
- # NOTE: we don't need any of this in the Meson build,
- # it takes care of caching
- def __init__(self):
- self._check_types = None
- self._check_ieee_macros = None
- self._check_complex = None
-
- def check_types(self, *a, **kw):
- if self._check_types is None:
- out = check_types(*a, **kw)
- self._check_types = pickle.dumps(out)
- else:
- out = copy.deepcopy(pickle.loads(self._check_types))
- return out
-
- def check_complex(self, *a, **kw):
- if self._check_complex is None:
- out = check_complex(*a, **kw)
- self._check_complex = pickle.dumps(out)
- else:
- out = copy.deepcopy(pickle.loads(self._check_complex))
- return out
-
-def can_link_svml():
- """SVML library is supported only on x86_64 architecture and currently
- only on linux
- """
- if NPY_DISABLE_SVML:
- return False
- platform = sysconfig.get_platform()
- return ("x86_64" in platform
- and "linux" in platform
- and sys.maxsize > 2**31)
-
-def can_link_svml_fp16():
- """SVML FP16 requires binutils >= 2.38 for an updated assembler
- """
- if can_link_svml():
- import re
- binutils_ver = os.popen("ld -v").readlines()[0].strip()
- binutils_ver = re.search(r"\d\.\d\d", binutils_ver)
- if binutils_ver is not None:
- return float(binutils_ver.group()) >= 2.38
- else:
- return False
-
-def check_git_submodules():
- out = os.popen("git submodule status")
- modules = out.readlines()
- for submodule in modules:
- if (submodule.strip()[0] == "-"):
- raise RuntimeError("git submodules are not initialized."
- "Please run `git submodule update --init` to fix this.")
-
-def pythonlib_dir():
- """return path where libpython* is."""
- if sys.platform == 'win32':
- return os.path.join(sys.prefix, "libs")
- else:
- return get_config_var('LIBDIR')
-
-def is_npy_no_signal():
- """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration
- header."""
- return sys.platform == 'win32'
-
-def is_npy_no_smp():
- """Return True if the NPY_NO_SMP symbol must be defined in public
- header (when SMP support cannot be reliably enabled)."""
- # Perhaps a fancier check is in order here.
- # so that threads are only enabled if there
- # are actually multiple CPUS? -- but
- # threaded code can be nice even on a single
- # CPU so that long-calculating code doesn't
- # block.
- return 'NPY_NOSMP' in os.environ
-
-def win32_checks(deflist):
- from numpy.distutils.misc_util import get_build_architecture
- a = get_build_architecture()
-
- # Distutils hack on AMD64 on windows
- print('BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' %
- (a, os.name, sys.platform))
- if a == 'AMD64':
- deflist.append('DISTUTILS_USE_SDK')
-
- # On win32, force long double format string to be 'g', not
- # 'Lg', since the MS runtime does not support long double whose
- # size is > sizeof(double)
- if a == "Intel" or a == "AMD64":
- deflist.append('FORCE_NO_LONG_DOUBLE_FORMATTING')
-
-def check_math_capabilities(config, ext, moredefs, mathlibs):
- def check_func(
- func_name,
- decl=False,
- headers=["feature_detection_math.h", "feature_detection_cmath.h"],
- ):
- return config.check_func(
- func_name,
- libraries=mathlibs,
- decl=decl,
- call=True,
- call_args=FUNC_CALL_ARGS[func_name],
- headers=headers,
- )
-
- def check_funcs_once(
- funcs_name,
- headers=["feature_detection_math.h", "feature_detection_cmath.h"],
- add_to_moredefs=True):
- call = dict([(f, True) for f in funcs_name])
- call_args = dict([(f, FUNC_CALL_ARGS[f]) for f in funcs_name])
- st = config.check_funcs_once(
- funcs_name,
- libraries=mathlibs,
- decl=False,
- call=call,
- call_args=call_args,
- headers=headers,
- )
- if st and add_to_moredefs:
- moredefs.extend([(fname2def(f), 1) for f in funcs_name])
- return st
-
- def check_funcs(
- funcs_name,
- headers=["feature_detection_math.h", "feature_detection_cmath.h"]):
- # Use check_funcs_once first, and if it does not work, test func per
- # func. Return success only if all the functions are available
- if not check_funcs_once(funcs_name, headers=headers):
- # Global check failed, check func per func
- for f in funcs_name:
- if check_func(f, headers=headers):
- moredefs.append((fname2def(f), 1))
- return 0
- else:
- return 1
-
- #use_msvc = config.check_decl("_MSC_VER")
- if not check_funcs_once(MANDATORY_FUNCS, add_to_moredefs=False):
- raise SystemError("One of the required function to build numpy is not"
- " available (the list is %s)." % str(MANDATORY_FUNCS))
-
- # Standard functions which may not be available and for which we have a
- # replacement implementation. Note that some of these are C99 functions.
-
- # XXX: hack to circumvent cpp pollution from python: python put its
- # config.h in the public namespace, so we have a clash for the common
- # functions we test. We remove every function tested by python's
- # autoconf, hoping their own test are correct
- for f in OPTIONAL_FUNCS_MAYBE:
- if config.check_decl(fname2def(f), headers=["Python.h"]):
- OPTIONAL_FILE_FUNCS.remove(f)
-
- check_funcs(OPTIONAL_FILE_FUNCS, headers=["feature_detection_stdio.h"])
- check_funcs(OPTIONAL_MISC_FUNCS, headers=["feature_detection_misc.h"])
-
- for h in OPTIONAL_HEADERS:
- if config.check_func("", decl=False, call=False, headers=[h]):
- h = h.replace(".", "_").replace(os.path.sep, "_")
- moredefs.append((fname2def(h), 1))
-
- # Try with both "locale.h" and "xlocale.h"
- locale_headers = [
- "stdlib.h",
- "xlocale.h",
- "feature_detection_locale.h",
- ]
- if not check_funcs(OPTIONAL_LOCALE_FUNCS, headers=locale_headers):
- # It didn't work with xlocale.h, maybe it will work with locale.h?
- locale_headers[1] = "locale.h"
- check_funcs(OPTIONAL_LOCALE_FUNCS, headers=locale_headers)
-
- for tup in OPTIONAL_INTRINSICS:
- headers = None
- if len(tup) == 2:
- f, args, m = tup[0], tup[1], fname2def(tup[0])
- elif len(tup) == 3:
- f, args, headers, m = tup[0], tup[1], [tup[2]], fname2def(tup[0])
- else:
- f, args, headers, m = tup[0], tup[1], [tup[2]], fname2def(tup[3])
- if config.check_func(f, decl=False, call=True, call_args=args,
- headers=headers):
- moredefs.append((m, 1))
-
- for dec, fn in OPTIONAL_FUNCTION_ATTRIBUTES:
- if config.check_gcc_function_attribute(dec, fn):
- moredefs.append((fname2def(fn), 1))
-
- platform = sysconfig.get_platform()
- for fn in OPTIONAL_VARIABLE_ATTRIBUTES:
- if config.check_gcc_variable_attribute(fn):
- m = fn.replace("(", "_").replace(")", "_")
- moredefs.append((fname2def(m), 1))
-
-def check_complex(config, mathlibs):
- priv = []
- pub = []
-
- # Check for complex support
- st = config.check_header('complex.h')
- if st:
- priv.append(('HAVE_COMPLEX_H', 1))
- pub.append(('NPY_USE_C99_COMPLEX', 1))
-
- for t in C99_COMPLEX_TYPES:
- st = config.check_type(t, headers=["complex.h"])
- if st:
- pub.append(('NPY_HAVE_%s' % type2def(t), 1))
-
- def check_prec(prec):
- flist = [f + prec for f in C99_COMPLEX_FUNCS]
- decl = dict([(f, True) for f in flist])
- if not config.check_funcs_once(flist, call=decl, decl=decl,
- libraries=mathlibs):
- for f in flist:
- if config.check_func(f, call=True, decl=True,
- libraries=mathlibs):
- priv.append((fname2def(f), 1))
- else:
- priv.extend([(fname2def(f), 1) for f in flist])
-
- check_prec('')
- check_prec('f')
- check_prec('l')
-
- return priv, pub
-
-def check_types(config_cmd, ext, build_dir):
- private_defines = []
- public_defines = []
-
- # Expected size (in number of bytes) for each type. This is an
- # optimization: those are only hints, and an exhaustive search for the size
- # is done if the hints are wrong.
- expected = {'short': [2], 'int': [4], 'long': [8, 4],
- 'float': [4], 'double': [8], 'long double': [16, 12, 8],
- 'Py_intptr_t': [8, 4], 'PY_LONG_LONG': [8], 'long long': [8],
- 'off_t': [8, 4]}
-
- # Check we have the python header (-dev* packages on Linux)
- result = config_cmd.check_header('Python.h')
- if not result:
- python = 'python'
- if '__pypy__' in sys.builtin_module_names:
- python = 'pypy'
- raise SystemError(
- "Cannot compile 'Python.h'. Perhaps you need to "
- "install {0}-dev|{0}-devel.".format(python))
- res = config_cmd.check_header("endian.h")
- if res:
- private_defines.append(('HAVE_ENDIAN_H', 1))
- public_defines.append(('NPY_HAVE_ENDIAN_H', 1))
- res = config_cmd.check_header("sys/endian.h")
- if res:
- private_defines.append(('HAVE_SYS_ENDIAN_H', 1))
- public_defines.append(('NPY_HAVE_SYS_ENDIAN_H', 1))
-
- # Check basic types sizes
- for type in ('short', 'int', 'long'):
- res = config_cmd.check_decl("SIZEOF_%s" % sym2def(type), headers=["Python.h"])
- if res:
- public_defines.append(('NPY_SIZEOF_%s' % sym2def(type), "SIZEOF_%s" % sym2def(type)))
- else:
- res = config_cmd.check_type_size(type, expected=expected[type])
- if res >= 0:
- public_defines.append(('NPY_SIZEOF_%s' % sym2def(type), '%d' % res))
- else:
- raise SystemError("Checking sizeof (%s) failed !" % type)
-
- for type in ('float', 'double', 'long double'):
- already_declared = config_cmd.check_decl("SIZEOF_%s" % sym2def(type),
- headers=["Python.h"])
- res = config_cmd.check_type_size(type, expected=expected[type])
- if res >= 0:
- public_defines.append(('NPY_SIZEOF_%s' % sym2def(type), '%d' % res))
- if not already_declared and not type == 'long double':
- private_defines.append(('SIZEOF_%s' % sym2def(type), '%d' % res))
- else:
- raise SystemError("Checking sizeof (%s) failed !" % type)
-
- # Compute size of corresponding complex type: used to check that our
- # definition is binary compatible with C99 complex type (check done at
- # build time in npy_common.h)
- complex_def = "struct {%s __x; %s __y;}" % (type, type)
- res = config_cmd.check_type_size(complex_def,
- expected=[2 * x for x in expected[type]])
- if res >= 0:
- public_defines.append(('NPY_SIZEOF_COMPLEX_%s' % sym2def(type), '%d' % res))
- else:
- raise SystemError("Checking sizeof (%s) failed !" % complex_def)
-
- for type in ('Py_intptr_t', 'off_t'):
- res = config_cmd.check_type_size(type, headers=["Python.h"],
- library_dirs=[pythonlib_dir()],
- expected=expected[type])
-
- if res >= 0:
- private_defines.append(('SIZEOF_%s' % sym2def(type), '%d' % res))
- public_defines.append(('NPY_SIZEOF_%s' % sym2def(type), '%d' % res))
- else:
- raise SystemError("Checking sizeof (%s) failed !" % type)
-
- # We check declaration AND type because that's how distutils does it.
- if config_cmd.check_decl('PY_LONG_LONG', headers=['Python.h']):
- res = config_cmd.check_type_size('PY_LONG_LONG', headers=['Python.h'],
- library_dirs=[pythonlib_dir()],
- expected=expected['PY_LONG_LONG'])
- if res >= 0:
- private_defines.append(('SIZEOF_%s' % sym2def('PY_LONG_LONG'), '%d' % res))
- public_defines.append(('NPY_SIZEOF_%s' % sym2def('PY_LONG_LONG'), '%d' % res))
- else:
- raise SystemError("Checking sizeof (%s) failed !" % 'PY_LONG_LONG')
-
- res = config_cmd.check_type_size('long long',
- expected=expected['long long'])
- if res >= 0:
- #private_defines.append(('SIZEOF_%s' % sym2def('long long'), '%d' % res))
- public_defines.append(('NPY_SIZEOF_%s' % sym2def('long long'), '%d' % res))
- else:
- raise SystemError("Checking sizeof (%s) failed !" % 'long long')
-
- if not config_cmd.check_decl('CHAR_BIT', headers=['Python.h']):
- raise RuntimeError(
- "Config wo CHAR_BIT is not supported"
- ", please contact the maintainers")
-
- return private_defines, public_defines
-
-# NOTE: this isn't needed in the Meson build,
-# and we won't support a MATHLIB env var
-def check_mathlib(config_cmd):
- # Testing the C math library
- mathlibs = []
- mathlibs_choices = [[], ["m"], ["cpml"]]
- mathlib = os.environ.get("MATHLIB")
- if mathlib:
- mathlibs_choices.insert(0, mathlib.split(","))
- for libs in mathlibs_choices:
- if config_cmd.check_func(
- "log",
- libraries=libs,
- call_args="0",
- decl="double log(double);",
- call=True
- ):
- mathlibs = libs
- break
- else:
- raise RuntimeError(
- "math library missing; rerun setup.py after setting the "
- "MATHLIB env variable"
- )
- return mathlibs
-
-
-def visibility_define(config):
- """Return the define value to use for NPY_VISIBILITY_HIDDEN (may be empty
- string)."""
- hide = '__attribute__((visibility("hidden")))'
- if config.check_gcc_function_attribute(hide, 'hideme'):
- return hide
- else:
- return ''
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import (Configuration, dot_join,
- exec_mod_from_location)
- from numpy.distutils.system_info import (get_info, blas_opt_info,
- lapack_opt_info)
-
- config = Configuration('core', parent_package, top_path)
- local_dir = config.local_path
- codegen_dir = join(local_dir, 'code_generators')
-
- # Check whether we have a mismatch between the set C API VERSION and the
- # actual C API VERSION. Will raise a MismatchCAPIError if so.
- check_api_version(C_API_VERSION, codegen_dir)
-
- check_git_submodules()
-
- generate_umath_py = join(codegen_dir, 'generate_umath.py')
- n = dot_join(config.name, 'generate_umath')
- generate_umath = exec_mod_from_location('_'.join(n.split('.')),
- generate_umath_py)
-
- header_dir = 'include/numpy' # this is relative to config.path_in_package
-
- cocache = CallOnceOnly()
-
- def generate_config_h(ext, build_dir):
- target = join(build_dir, header_dir, 'config.h')
- d = os.path.dirname(target)
- if not os.path.exists(d):
- os.makedirs(d)
-
- if newer(__file__, target):
- config_cmd = config.get_config_cmd()
- log.info('Generating %s', target)
-
- # Check sizeof
- moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
-
- # Check math library and C99 math funcs availability
- mathlibs = check_mathlib(config_cmd)
- moredefs.append(('MATHLIB', ','.join(mathlibs)))
-
- check_math_capabilities(config_cmd, ext, moredefs, mathlibs)
- moredefs.extend(cocache.check_complex(config_cmd, mathlibs)[0])
-
- # Signal check
- if is_npy_no_signal():
- moredefs.append('NPY_NO_SIGNAL')
-
- # Windows checks
- if sys.platform == 'win32' or os.name == 'nt':
- win32_checks(moredefs)
-
- # C99 restrict keyword
- moredefs.append(('NPY_RESTRICT', config_cmd.check_restrict()))
-
- # Inline check
- inline = config_cmd.check_inline()
-
- if can_link_svml():
- moredefs.append(('NPY_CAN_LINK_SVML', 1))
-
- # Use bogus stride debug aid to flush out bugs where users use
- # strides of dimensions with length 1 to index a full contiguous
- # array.
- if NPY_RELAXED_STRIDES_DEBUG:
- moredefs.append(('NPY_RELAXED_STRIDES_DEBUG', 1))
- else:
- moredefs.append(('NPY_RELAXED_STRIDES_DEBUG', 0))
-
- # Get long double representation
- rep = check_long_double_representation(config_cmd)
- moredefs.append(('HAVE_LDOUBLE_%s' % rep, 1))
-
- if check_for_right_shift_internal_compiler_error(config_cmd):
- moredefs.append('NPY_DO_NOT_OPTIMIZE_LONG_right_shift')
- moredefs.append('NPY_DO_NOT_OPTIMIZE_ULONG_right_shift')
- moredefs.append('NPY_DO_NOT_OPTIMIZE_LONGLONG_right_shift')
- moredefs.append('NPY_DO_NOT_OPTIMIZE_ULONGLONG_right_shift')
-
- # Generate the config.h file from moredefs
- with open(target, 'w') as target_f:
- if sys.platform == 'darwin':
- target_f.write(
- "/* may be overridden by numpyconfig.h on darwin */\n"
- )
- for d in moredefs:
- if isinstance(d, str):
- target_f.write('#define %s\n' % (d))
- else:
- target_f.write('#define %s %s\n' % (d[0], d[1]))
-
- # define inline to our keyword, or nothing
- target_f.write('#ifndef __cplusplus\n')
- if inline == 'inline':
- target_f.write('/* #undef inline */\n')
- else:
- target_f.write('#define inline %s\n' % inline)
- target_f.write('#endif\n')
-
- # add the guard to make sure config.h is never included directly,
- # but always through npy_config.h
- target_f.write(textwrap.dedent("""
- #ifndef NUMPY_CORE_SRC_COMMON_NPY_CONFIG_H_
- #error config.h should never be included directly, include npy_config.h instead
- #endif
- """))
-
- log.info('File: %s' % target)
- with open(target) as target_f:
- log.info(target_f.read())
- log.info('EOF')
- else:
- mathlibs = []
- with open(target) as target_f:
- for line in target_f:
- s = '#define MATHLIB'
- if line.startswith(s):
- value = line[len(s):].strip()
- if value:
- mathlibs.extend(value.split(','))
-
- # Ugly: this can be called within a library and not an extension,
- # in which case there is no libraries attributes (and none is
- # needed).
- if hasattr(ext, 'libraries'):
- ext.libraries.extend(mathlibs)
-
- incl_dir = os.path.dirname(target)
- if incl_dir not in config.numpy_include_dirs:
- config.numpy_include_dirs.append(incl_dir)
-
- return target
-
- def generate_numpyconfig_h(ext, build_dir):
- """Depends on config.h: generate_config_h has to be called before !"""
- # put common include directory in build_dir on search path
- # allows using code generation in headers
- config.add_include_dirs(join(build_dir, "src", "common"))
- config.add_include_dirs(join(build_dir, "src", "npymath"))
-
- target = join(build_dir, header_dir, '_numpyconfig.h')
- d = os.path.dirname(target)
- if not os.path.exists(d):
- os.makedirs(d)
- if newer(__file__, target):
- config_cmd = config.get_config_cmd()
- log.info('Generating %s', target)
-
- # Check sizeof
- ignored, moredefs = cocache.check_types(config_cmd, ext, build_dir)
-
- if is_npy_no_signal():
- moredefs.append(('NPY_NO_SIGNAL', 1))
-
- if is_npy_no_smp():
- moredefs.append(('NPY_NO_SMP', 1))
- else:
- moredefs.append(('NPY_NO_SMP', 0))
-
- mathlibs = check_mathlib(config_cmd)
- moredefs.extend(cocache.check_complex(config_cmd, mathlibs)[1])
-
- if NPY_RELAXED_STRIDES_DEBUG:
- moredefs.append(('NPY_RELAXED_STRIDES_DEBUG', 1))
-
- # Check whether we can use inttypes (C99) formats
- if config_cmd.check_decl('PRIdPTR', headers=['inttypes.h']):
- moredefs.append(('NPY_USE_C99_FORMATS', 1))
-
- # visibility check
- hidden_visibility = visibility_define(config_cmd)
- moredefs.append(('NPY_VISIBILITY_HIDDEN', hidden_visibility))
-
- # Add the C API/ABI versions
- moredefs.append(('NPY_ABI_VERSION', '0x%.8X' % C_ABI_VERSION))
- moredefs.append(('NPY_API_VERSION', '0x%.8X' % C_API_VERSION))
-
- # Add moredefs to header
- with open(target, 'w') as target_f:
- for d in moredefs:
- if isinstance(d, str):
- target_f.write('#define %s\n' % (d))
- else:
- target_f.write('#define %s %s\n' % (d[0], d[1]))
-
- # Define __STDC_FORMAT_MACROS
- target_f.write(textwrap.dedent("""
- #ifndef __STDC_FORMAT_MACROS
- #define __STDC_FORMAT_MACROS 1
- #endif
- """))
-
- # Dump the numpyconfig.h header to stdout
- log.info('File: %s' % target)
- with open(target) as target_f:
- log.info(target_f.read())
- log.info('EOF')
- config.add_data_files((header_dir, target))
- return target
-
- def generate_api_func(module_name):
- def generate_api(ext, build_dir):
- script = join(codegen_dir, module_name + '.py')
- sys.path.insert(0, codegen_dir)
- try:
- m = __import__(module_name)
- log.info('executing %s', script)
- h_file, c_file = m.generate_api(os.path.join(build_dir, header_dir))
- finally:
- del sys.path[0]
- config.add_data_files((header_dir, h_file),
- )
- return (h_file,)
- return generate_api
-
- generate_numpy_api = generate_api_func('generate_numpy_api')
- generate_ufunc_api = generate_api_func('generate_ufunc_api')
-
- config.add_include_dirs(join(local_dir, "src", "common"))
- config.add_include_dirs(join(local_dir, "src"))
- config.add_include_dirs(join(local_dir))
-
- config.add_data_dir('include/numpy')
- config.add_include_dirs(join('src', 'npymath'))
- config.add_include_dirs(join('src', 'multiarray'))
- config.add_include_dirs(join('src', 'umath'))
- config.add_include_dirs(join('src', 'npysort'))
- config.add_include_dirs(join('src', '_simd'))
-
- config.add_define_macros([("NPY_INTERNAL_BUILD", "1")]) # this macro indicates that Numpy build is in process
- config.add_define_macros([("HAVE_NPY_CONFIG_H", "1")])
- if sys.platform[:3] == "aix":
- config.add_define_macros([("_LARGE_FILES", None)])
- else:
- config.add_define_macros([("_FILE_OFFSET_BITS", "64")])
- config.add_define_macros([('_LARGEFILE_SOURCE', '1')])
- config.add_define_macros([('_LARGEFILE64_SOURCE', '1')])
-
- config.numpy_include_dirs.extend(config.paths('include'))
-
- deps = [join('include', 'numpy', '*object.h'),
- join(codegen_dir, 'genapi.py'),
- ]
-
- #######################################################################
- # npymath library #
- #######################################################################
-
- subst_dict = dict([("sep", os.path.sep), ("pkgname", "numpy.core")])
-
- def get_mathlib_info(*args):
- # Another ugly hack: the mathlib info is known once build_src is run,
- # but we cannot use add_installed_pkg_config here either, so we only
- # update the substitution dictionary during npymath build
- config_cmd = config.get_config_cmd()
- mlibs = check_mathlib(config_cmd)
-
- posix_mlib = ' '.join(['-l%s' % l for l in mlibs])
- msvc_mlib = ' '.join(['%s.lib' % l for l in mlibs])
- subst_dict["posix_mathlib"] = posix_mlib
- subst_dict["msvc_mathlib"] = msvc_mlib
-
- npymath_sources = [join('src', 'npymath', 'npy_math_internal.h.src'),
- join('src', 'npymath', 'npy_math.c'),
- # join('src', 'npymath', 'ieee754.cpp'),
- join('src', 'npymath', 'ieee754.c.src'),
- join('src', 'npymath', 'npy_math_complex.c.src'),
- join('src', 'npymath', 'halffloat.cpp'),
- ]
-
- config.add_installed_library('npymath',
- sources=npymath_sources + [get_mathlib_info],
- install_dir='lib',
- build_info={
- 'include_dirs' : [], # empty list required for creating npy_math_internal.h
- 'extra_compiler_args': [lib_opts_if_msvc],
- })
- config.add_npy_pkg_config("npymath.ini.in", "lib/npy-pkg-config",
- subst_dict)
- config.add_npy_pkg_config("mlib.ini.in", "lib/npy-pkg-config",
- subst_dict)
-
- #######################################################################
- # multiarray_tests module #
- #######################################################################
-
- config.add_extension('_multiarray_tests',
- sources=[join('src', 'multiarray', '_multiarray_tests.c.src'),
- join('src', 'common', 'mem_overlap.c'),
- join('src', 'common', 'npy_argparse.c'),
- join('src', 'common', 'npy_hashtable.c')],
- depends=[join('src', 'common', 'mem_overlap.h'),
- join('src', 'common', 'npy_argparse.h'),
- join('src', 'common', 'npy_hashtable.h'),
- join('src', 'common', 'npy_extint128.h')],
- libraries=['npymath'])
-
- #######################################################################
- # _multiarray_umath module - common part #
- #######################################################################
-
- common_deps = [
- join('src', 'common', 'dlpack', 'dlpack.h'),
- join('src', 'common', 'array_assign.h'),
- join('src', 'common', 'binop_override.h'),
- join('src', 'common', 'cblasfuncs.h'),
- join('src', 'common', 'lowlevel_strided_loops.h'),
- join('src', 'common', 'mem_overlap.h'),
- join('src', 'common', 'npy_argparse.h'),
- join('src', 'common', 'npy_cblas.h'),
- join('src', 'common', 'npy_config.h'),
- join('src', 'common', 'npy_ctypes.h'),
- join('src', 'common', 'npy_dlpack.h'),
- join('src', 'common', 'npy_extint128.h'),
- join('src', 'common', 'npy_import.h'),
- join('src', 'common', 'npy_hashtable.h'),
- join('src', 'common', 'npy_longdouble.h'),
- join('src', 'common', 'npy_svml.h'),
- join('src', 'common', 'templ_common.h.src'),
- join('src', 'common', 'ucsnarrow.h'),
- join('src', 'common', 'ufunc_override.h'),
- join('src', 'common', 'umathmodule.h'),
- join('src', 'common', 'numpyos.h'),
- join('src', 'common', 'npy_cpu_dispatch.h'),
- join('src', 'common', 'simd', 'simd.h'),
- join('src', 'common', 'common.hpp'),
- ]
-
- common_src = [
- join('src', 'common', 'array_assign.c'),
- join('src', 'common', 'mem_overlap.c'),
- join('src', 'common', 'npy_argparse.c'),
- join('src', 'common', 'npy_hashtable.c'),
- join('src', 'common', 'npy_longdouble.c'),
- join('src', 'common', 'templ_common.h.src'),
- join('src', 'common', 'ucsnarrow.c'),
- join('src', 'common', 'ufunc_override.c'),
- join('src', 'common', 'numpyos.c'),
- join('src', 'common', 'npy_cpu_features.c'),
- ]
-
- if os.environ.get('NPY_USE_BLAS_ILP64', "0") != "0":
- blas_info = get_info('blas_ilp64_opt', 2)
- else:
- blas_info = get_info('blas_opt', 0)
-
- have_blas = blas_info and ('HAVE_CBLAS', None) in blas_info.get('define_macros', [])
-
- if have_blas:
- extra_info = blas_info
- # These files are also in MANIFEST.in so that they are always in
- # the source distribution independently of HAVE_CBLAS.
- common_src.extend([join('src', 'common', 'cblasfuncs.c'),
- join('src', 'common', 'python_xerbla.c'),
- ])
- else:
- extra_info = {}
-
- #######################################################################
- # _multiarray_umath module - multiarray part #
- #######################################################################
-
- multiarray_deps = [
- join('src', 'multiarray', 'abstractdtypes.h'),
- join('src', 'multiarray', 'arrayobject.h'),
- join('src', 'multiarray', 'arraytypes.h.src'),
- join('src', 'multiarray', 'arrayfunction_override.h'),
- join('src', 'multiarray', 'array_coercion.h'),
- join('src', 'multiarray', 'array_method.h'),
- join('src', 'multiarray', 'npy_buffer.h'),
- join('src', 'multiarray', 'calculation.h'),
- join('src', 'multiarray', 'common.h'),
- join('src', 'multiarray', 'common_dtype.h'),
- join('src', 'multiarray', 'convert_datatype.h'),
- join('src', 'multiarray', 'convert.h'),
- join('src', 'multiarray', 'conversion_utils.h'),
- join('src', 'multiarray', 'ctors.h'),
- join('src', 'multiarray', 'descriptor.h'),
- join('src', 'multiarray', 'dtypemeta.h'),
- join('src', 'multiarray', 'dtype_transfer.h'),
- join('src', 'multiarray', 'dtype_traversal.h'),
- join('src', 'multiarray', 'dragon4.h'),
- join('src', 'multiarray', 'einsum_debug.h'),
- join('src', 'multiarray', 'einsum_sumprod.h'),
- join('src', 'multiarray', 'experimental_public_dtype_api.h'),
- join('src', 'multiarray', 'getset.h'),
- join('src', 'multiarray', 'hashdescr.h'),
- join('src', 'multiarray', 'iterators.h'),
- join('src', 'multiarray', 'legacy_dtype_implementation.h'),
- join('src', 'multiarray', 'mapping.h'),
- join('src', 'multiarray', 'methods.h'),
- join('src', 'multiarray', 'multiarraymodule.h'),
- join('src', 'multiarray', 'nditer_impl.h'),
- join('src', 'multiarray', 'number.h'),
- join('src', 'multiarray', 'refcount.h'),
- join('src', 'multiarray', 'scalartypes.h'),
- join('src', 'multiarray', 'sequence.h'),
- join('src', 'multiarray', 'shape.h'),
- join('src', 'multiarray', 'strfuncs.h'),
- join('src', 'multiarray', 'typeinfo.h'),
- join('src', 'multiarray', 'usertypes.h'),
- join('src', 'multiarray', 'vdot.h'),
- join('src', 'multiarray', 'textreading', 'readtext.h'),
- join('include', 'numpy', 'arrayobject.h'),
- join('include', 'numpy', '_neighborhood_iterator_imp.h'),
- join('include', 'numpy', 'npy_endian.h'),
- join('include', 'numpy', 'arrayscalars.h'),
- join('include', 'numpy', 'noprefix.h'),
- join('include', 'numpy', 'npy_interrupt.h'),
- join('include', 'numpy', 'npy_3kcompat.h'),
- join('include', 'numpy', 'npy_math.h'),
- join('include', 'numpy', 'halffloat.h'),
- join('include', 'numpy', 'npy_common.h'),
- join('include', 'numpy', 'npy_os.h'),
- join('include', 'numpy', 'utils.h'),
- join('include', 'numpy', 'ndarrayobject.h'),
- join('include', 'numpy', 'npy_cpu.h'),
- join('include', 'numpy', 'numpyconfig.h'),
- join('include', 'numpy', 'ndarraytypes.h'),
- join('include', 'numpy', 'npy_1_7_deprecated_api.h'),
- # add library sources as distuils does not consider libraries
- # dependencies
- ] + npymath_sources
-
- multiarray_src = [
- join('src', 'multiarray', 'abstractdtypes.c'),
- join('src', 'multiarray', 'alloc.c'),
- join('src', 'multiarray', 'arrayobject.c'),
- join('src', 'multiarray', 'arraytypes.h.src'),
- join('src', 'multiarray', 'arraytypes.c.src'),
- join('src', 'multiarray', 'argfunc.dispatch.c.src'),
- join('src', 'multiarray', 'array_coercion.c'),
- join('src', 'multiarray', 'array_method.c'),
- join('src', 'multiarray', 'array_assign_scalar.c'),
- join('src', 'multiarray', 'array_assign_array.c'),
- join('src', 'multiarray', 'arrayfunction_override.c'),
- join('src', 'multiarray', 'buffer.c'),
- join('src', 'multiarray', 'calculation.c'),
- join('src', 'multiarray', 'compiled_base.c'),
- join('src', 'multiarray', 'common.c'),
- join('src', 'multiarray', 'common_dtype.c'),
- join('src', 'multiarray', 'convert.c'),
- join('src', 'multiarray', 'convert_datatype.c'),
- join('src', 'multiarray', 'conversion_utils.c'),
- join('src', 'multiarray', 'ctors.c'),
- join('src', 'multiarray', 'datetime.c'),
- join('src', 'multiarray', 'datetime_strings.c'),
- join('src', 'multiarray', 'datetime_busday.c'),
- join('src', 'multiarray', 'datetime_busdaycal.c'),
- join('src', 'multiarray', 'descriptor.c'),
- join('src', 'multiarray', 'dlpack.c'),
- join('src', 'multiarray', 'dtypemeta.c'),
- join('src', 'multiarray', 'dragon4.c'),
- join('src', 'multiarray', 'dtype_transfer.c'),
- join('src', 'multiarray', 'dtype_traversal.c'),
- join('src', 'multiarray', 'einsum.c.src'),
- join('src', 'multiarray', 'einsum_sumprod.c.src'),
- join('src', 'multiarray', 'experimental_public_dtype_api.c'),
- join('src', 'multiarray', 'flagsobject.c'),
- join('src', 'multiarray', 'getset.c'),
- join('src', 'multiarray', 'hashdescr.c'),
- join('src', 'multiarray', 'item_selection.c'),
- join('src', 'multiarray', 'iterators.c'),
- join('src', 'multiarray', 'legacy_dtype_implementation.c'),
- join('src', 'multiarray', 'lowlevel_strided_loops.c.src'),
- join('src', 'multiarray', 'mapping.c'),
- join('src', 'multiarray', 'methods.c'),
- join('src', 'multiarray', 'multiarraymodule.c'),
- join('src', 'multiarray', 'nditer_templ.c.src'),
- join('src', 'multiarray', 'nditer_api.c'),
- join('src', 'multiarray', 'nditer_constr.c'),
- join('src', 'multiarray', 'nditer_pywrap.c'),
- join('src', 'multiarray', 'number.c'),
- join('src', 'multiarray', 'refcount.c'),
- join('src', 'multiarray', 'sequence.c'),
- join('src', 'multiarray', 'shape.c'),
- join('src', 'multiarray', 'scalarapi.c'),
- join('src', 'multiarray', 'scalartypes.c.src'),
- join('src', 'multiarray', 'strfuncs.c'),
- join('src', 'multiarray', 'temp_elide.c'),
- join('src', 'multiarray', 'typeinfo.c'),
- join('src', 'multiarray', 'usertypes.c'),
- join('src', 'multiarray', 'vdot.c'),
- join('src', 'common', 'npy_sort.h.src'),
- join('src', 'npysort', 'quicksort.cpp'),
- join('src', 'npysort', 'mergesort.cpp'),
- join('src', 'npysort', 'timsort.cpp'),
- join('src', 'npysort', 'heapsort.cpp'),
- join('src', 'npysort', 'radixsort.cpp'),
- join('src', 'common', 'npy_partition.h'),
- join('src', 'npysort', 'selection.cpp'),
- join('src', 'common', 'npy_binsearch.h'),
- join('src', 'npysort', 'binsearch.cpp'),
- join('src', 'multiarray', 'textreading', 'conversions.c'),
- join('src', 'multiarray', 'textreading', 'field_types.c'),
- join('src', 'multiarray', 'textreading', 'growth.c'),
- join('src', 'multiarray', 'textreading', 'readtext.c'),
- join('src', 'multiarray', 'textreading', 'rows.c'),
- join('src', 'multiarray', 'textreading', 'stream_pyobject.c'),
- join('src', 'multiarray', 'textreading', 'str_to_int.c'),
- join('src', 'multiarray', 'textreading', 'tokenize.cpp'),
- # Remove this once scipy macos arm64 build correctly
- # links to the arm64 npymath library,
- # see gh-22673
- join('src', 'npymath', 'arm64_exports.c'),
- join('src', 'npysort', 'simd_qsort.dispatch.cpp'),
- join('src', 'npysort', 'simd_qsort_16bit.dispatch.cpp'),
- ]
-
- #######################################################################
- # _multiarray_umath module - umath part #
- #######################################################################
-
- def generate_umath_c(ext, build_dir):
- target = join(build_dir, header_dir, '__umath_generated.c')
- dir = os.path.dirname(target)
- if not os.path.exists(dir):
- os.makedirs(dir)
- script = generate_umath_py
- if newer(script, target):
- with open(target, 'w') as f:
- f.write(generate_umath.make_code(generate_umath.defdict,
- generate_umath.__file__))
- return []
-
- def generate_umath_doc_header(ext, build_dir):
- from numpy.distutils.misc_util import exec_mod_from_location
-
- target = join(build_dir, header_dir, '_umath_doc_generated.h')
- dir = os.path.dirname(target)
- if not os.path.exists(dir):
- os.makedirs(dir)
-
- generate_umath_doc_py = join(codegen_dir, 'generate_umath_doc.py')
- if newer(generate_umath_doc_py, target):
- n = dot_join(config.name, 'generate_umath_doc')
- generate_umath_doc = exec_mod_from_location(
- '_'.join(n.split('.')), generate_umath_doc_py)
- generate_umath_doc.write_code(target)
-
- umath_src = [
- join('src', 'umath', 'umathmodule.c'),
- join('src', 'umath', 'reduction.c'),
- join('src', 'umath', 'funcs.inc.src'),
- join('src', 'umath', 'loops.h.src'),
- join('src', 'umath', 'loops_utils.h.src'),
- join('src', 'umath', 'loops.c.src'),
- join('src', 'umath', 'loops_unary.dispatch.c.src'),
- join('src', 'umath', 'loops_unary_fp.dispatch.c.src'),
- join('src', 'umath', 'loops_unary_fp_le.dispatch.c.src'),
- join('src', 'umath', 'loops_arithm_fp.dispatch.c.src'),
- join('src', 'umath', 'loops_arithmetic.dispatch.c.src'),
- join('src', 'umath', 'loops_logical.dispatch.c.src'),
- join('src', 'umath', 'loops_minmax.dispatch.c.src'),
- join('src', 'umath', 'loops_trigonometric.dispatch.c.src'),
- join('src', 'umath', 'loops_umath_fp.dispatch.c.src'),
- join('src', 'umath', 'loops_exponent_log.dispatch.c.src'),
- join('src', 'umath', 'loops_hyperbolic.dispatch.c.src'),
- join('src', 'umath', 'loops_modulo.dispatch.c.src'),
- join('src', 'umath', 'loops_comparison.dispatch.c.src'),
- join('src', 'umath', 'loops_unary_complex.dispatch.c.src'),
- join('src', 'umath', 'loops_autovec.dispatch.c.src'),
- join('src', 'umath', 'matmul.h.src'),
- join('src', 'umath', 'matmul.c.src'),
- join('src', 'umath', 'clip.h'),
- join('src', 'umath', 'clip.cpp'),
- join('src', 'umath', 'dispatching.c'),
- join('src', 'umath', 'legacy_array_method.c'),
- join('src', 'umath', 'wrapping_array_method.c'),
- join('src', 'umath', 'ufunc_object.c'),
- join('src', 'umath', 'extobj.c'),
- join('src', 'umath', 'scalarmath.c.src'),
- join('src', 'umath', 'ufunc_type_resolution.c'),
- join('src', 'umath', 'override.c'),
- join('src', 'umath', 'string_ufuncs.cpp'),
- # For testing. Eventually, should use public API and be separate:
- join('src', 'umath', '_scaled_float_dtype.c'),
- ]
-
- umath_deps = [
- generate_umath_py,
- join('include', 'numpy', 'npy_math.h'),
- join('include', 'numpy', 'halffloat.h'),
- join('src', 'multiarray', 'common.h'),
- join('src', 'multiarray', 'number.h'),
- join('src', 'common', 'templ_common.h.src'),
- join('src', 'umath', 'override.h'),
- join(codegen_dir, 'generate_ufunc_api.py'),
- join(codegen_dir, 'ufunc_docstrings.py'),
- ]
-
- svml_path = join('numpy', 'core', 'src', 'umath', 'svml')
- svml_objs = []
- # we have converted the following into universal intrinsics
- # so we can bring the benefits of performance for all platforms
- # not just for avx512 on linux without performance/accuracy regression,
- # actually the other way around, better performance and
- # after all maintainable code.
- svml_filter = (
- )
- if can_link_svml():
- svml_objs = glob.glob(svml_path + '/**/*.s', recursive=True)
- svml_objs = [o for o in svml_objs if not o.endswith(svml_filter)]
-
- # The ordering of names returned by glob is undefined, so we sort
- # to make builds reproducible.
- svml_objs.sort()
- if not can_link_svml_fp16():
- svml_objs = [o for o in svml_objs if not o.endswith('_h_la.s')]
-
- config.add_extension('_multiarray_umath',
- sources=multiarray_src + umath_src +
- common_src +
- [generate_config_h,
- generate_numpyconfig_h,
- generate_numpy_api,
- join(codegen_dir, 'generate_numpy_api.py'),
- join('*.py'),
- generate_umath_c,
- generate_umath_doc_header,
- generate_ufunc_api,
- ],
- depends=deps + multiarray_deps + umath_deps +
- common_deps,
- libraries=['npymath'],
- extra_objects=svml_objs,
- extra_info=extra_info)
-
- #######################################################################
- # umath_tests module #
- #######################################################################
-
- config.add_extension('_umath_tests', sources=[
- join('src', 'umath', '_umath_tests.c.src'),
- join('src', 'umath', '_umath_tests.dispatch.c'),
- join('src', 'common', 'npy_cpu_features.c'),
- ])
-
- #######################################################################
- # custom rational dtype module #
- #######################################################################
-
- config.add_extension('_rational_tests',
- sources=[join('src', 'umath', '_rational_tests.c')])
-
- #######################################################################
- # struct_ufunc_test module #
- #######################################################################
-
- config.add_extension('_struct_ufunc_tests',
- sources=[join('src', 'umath', '_struct_ufunc_tests.c')])
-
-
- #######################################################################
- # operand_flag_tests module #
- #######################################################################
-
- config.add_extension('_operand_flag_tests',
- sources=[join('src', 'umath', '_operand_flag_tests.c')])
-
- #######################################################################
- # SIMD module #
- #######################################################################
-
- config.add_extension('_simd',
- sources=[
- join('src', 'common', 'npy_cpu_features.c'),
- join('src', '_simd', '_simd.c'),
- join('src', '_simd', '_simd_inc.h.src'),
- join('src', '_simd', '_simd_data.inc.src'),
- join('src', '_simd', '_simd.dispatch.c.src'),
- ], depends=[
- join('src', 'common', 'npy_cpu_dispatch.h'),
- join('src', 'common', 'simd', 'simd.h'),
- join('src', '_simd', '_simd.h'),
- join('src', '_simd', '_simd_inc.h.src'),
- join('src', '_simd', '_simd_data.inc.src'),
- join('src', '_simd', '_simd_arg.inc'),
- join('src', '_simd', '_simd_convert.inc'),
- join('src', '_simd', '_simd_easyintrin.inc'),
- join('src', '_simd', '_simd_vector.inc'),
- ],
- libraries=['npymath']
- )
-
- config.add_subpackage('tests')
- config.add_data_dir('tests/data')
- config.add_data_dir('tests/examples')
- config.add_data_files('*.pyi')
-
- config.make_svn_version_py()
-
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/core/setup_common.py b/contrib/python/numpy/py3/numpy/core/setup_common.py
deleted file mode 100644
index b5bc0dec1f8..00000000000
--- a/contrib/python/numpy/py3/numpy/core/setup_common.py
+++ /dev/null
@@ -1,430 +0,0 @@
-# Code common to build tools
-import copy
-import pathlib
-import sys
-import textwrap
-
-from numpy.distutils.misc_util import mingw32
-
-
-#-------------------
-# Versioning support
-#-------------------
-# How to change C_API_VERSION ?
-# - increase C_API_VERSION value
-# - record the hash for the new C API with the cversions.py script
-# and add the hash to cversions.txt
-# The hash values are used to remind developers when the C API number was not
-# updated - generates a MismatchCAPIWarning warning which is turned into an
-# exception for released version.
-
-# Binary compatibility version number. This number is increased whenever the
-# C-API is changed such that binary compatibility is broken, i.e. whenever a
-# recompile of extension modules is needed.
-C_ABI_VERSION = 0x01000009
-
-# Minor API version. This number is increased whenever a change is made to the
-# C-API -- whether it breaks binary compatibility or not. Some changes, such
-# as adding a function pointer to the end of the function table, can be made
-# without breaking binary compatibility. In this case, only the C_API_VERSION
-# (*not* C_ABI_VERSION) would be increased. Whenever binary compatibility is
-# broken, both C_API_VERSION and C_ABI_VERSION should be increased.
-#
-# The version needs to be kept in sync with that in cversions.txt.
-#
-# 0x00000008 - 1.7.x
-# 0x00000009 - 1.8.x
-# 0x00000009 - 1.9.x
-# 0x0000000a - 1.10.x
-# 0x0000000a - 1.11.x
-# 0x0000000a - 1.12.x
-# 0x0000000b - 1.13.x
-# 0x0000000c - 1.14.x
-# 0x0000000c - 1.15.x
-# 0x0000000d - 1.16.x
-# 0x0000000d - 1.19.x
-# 0x0000000e - 1.20.x
-# 0x0000000e - 1.21.x
-# 0x0000000f - 1.22.x
-# 0x00000010 - 1.23.x
-# 0x00000010 - 1.24.x
-# 0x00000011 - 1.25.x
-C_API_VERSION = 0x00000011
-
-# By default, when compiling downstream libraries against NumPy,```
-# pick an older feature version. For example, for 1.25.x we default to the
-# 1.19 API and support going back all the way to 1.15.x (if so desired).
-# This is set up in `numpyconfig.h`.
-
-class MismatchCAPIError(ValueError):
- pass
-
-
-def get_api_versions(apiversion, codegen_dir):
- """
- Return current C API checksum and the recorded checksum.
-
- Return current C API checksum and the recorded checksum for the given
- version of the C API version.
-
- """
- # Compute the hash of the current API as defined in the .txt files in
- # code_generators
- sys.path.insert(0, codegen_dir)
- try:
- m = __import__('genapi')
- numpy_api = __import__('numpy_api')
- curapi_hash = m.fullapi_hash(numpy_api.full_api)
- apis_hash = m.get_versions_hash()
- finally:
- del sys.path[0]
-
- return curapi_hash, apis_hash[apiversion]
-
-def check_api_version(apiversion, codegen_dir):
- """Emits a MismatchCAPIWarning if the C API version needs updating."""
- curapi_hash, api_hash = get_api_versions(apiversion, codegen_dir)
-
- # If different hash, it means that the api .txt files in
- # codegen_dir have been updated without the API version being
- # updated. Any modification in those .txt files should be reflected
- # in the api and eventually abi versions.
- # To compute the checksum of the current API, use numpy/core/cversions.py
- if not curapi_hash == api_hash:
- msg = ("API mismatch detected, the C API version "
- "numbers have to be updated. Current C api version is "
- f"{apiversion}, with checksum {curapi_hash}, but recorded "
- f"checksum in core/codegen_dir/cversions.txt is {api_hash}. If "
- "functions were added in the C API, you have to update "
- f"C_API_VERSION in {__file__}."
- "\n"
- "Please make sure that new additions are guarded with "
- "MinVersion() to make them unavailable when wishing support "
- "for older NumPy versions."
- )
- raise MismatchCAPIError(msg)
-
-
-FUNC_CALL_ARGS = {}
-
-def set_sig(sig):
- prefix, _, args = sig.partition("(")
- args = args.rpartition(")")[0]
- funcname = prefix.rpartition(" ")[-1]
- args = [arg.strip() for arg in args.split(",")]
- # We use {0} because 0 alone cannot be cast to complex on MSVC in C:
- FUNC_CALL_ARGS[funcname] = ", ".join("(%s){0}" % arg for arg in args)
-
-
-for file in [
- "feature_detection_locale.h",
- "feature_detection_math.h",
- "feature_detection_cmath.h",
- "feature_detection_misc.h",
- "feature_detection_stdio.h",
-]:
- with open(pathlib.Path(__file__).parent / file) as f:
- for line in f:
- if line.startswith("#"):
- continue
- if not line.strip():
- continue
- set_sig(line)
-
-# Mandatory functions: if not found, fail the build
-# Some of these can still be blocklisted if the C99 implementation
-# is buggy, see numpy/core/src/common/npy_config.h
-MANDATORY_FUNCS = [
- "sin", "cos", "tan", "sinh", "cosh", "tanh", "fabs",
- "floor", "ceil", "sqrt", "log10", "log", "exp", "asin",
- "acos", "atan", "fmod", 'modf', 'frexp', 'ldexp',
- "expm1", "log1p", "acosh", "asinh", "atanh",
- "rint", "trunc", "exp2",
- "copysign", "nextafter", "strtoll", "strtoull", "cbrt",
- "log2", "pow", "hypot", "atan2",
- "creal", "cimag", "conj"
-]
-
-OPTIONAL_LOCALE_FUNCS = ["strtold_l"]
-OPTIONAL_FILE_FUNCS = ["ftello", "fseeko", "fallocate"]
-OPTIONAL_MISC_FUNCS = ["backtrace", "madvise"]
-
-# variable attributes tested via "int %s a" % attribute
-OPTIONAL_VARIABLE_ATTRIBUTES = ["__thread", "__declspec(thread)"]
-
-# Subset of OPTIONAL_*_FUNCS which may already have HAVE_* defined by Python.h
-OPTIONAL_FUNCS_MAYBE = [
- "ftello", "fseeko"
- ]
-
-C99_COMPLEX_TYPES = [
- 'complex double', 'complex float', 'complex long double'
- ]
-C99_COMPLEX_FUNCS = [
- "cabs", "cacos", "cacosh", "carg", "casin", "casinh", "catan",
- "catanh", "cexp", "clog", "cpow", "csqrt",
- # The long double variants (like csinl) should be mandatory on C11,
- # but are missing in FreeBSD. Issue gh-22850
- "csin", "csinh", "ccos", "ccosh", "ctan", "ctanh",
- ]
-
-OPTIONAL_HEADERS = [
-# sse headers only enabled automatically on amd64/x32 builds
- "xmmintrin.h", # SSE
- "emmintrin.h", # SSE2
- "immintrin.h", # AVX
- "features.h", # for glibc version linux
- "xlocale.h", # see GH#8367
- "dlfcn.h", # dladdr
- "execinfo.h", # backtrace
- "libunwind.h", # backtrace for LLVM/Clang using libunwind
- "sys/mman.h", #madvise
-]
-
-# optional gcc compiler builtins and their call arguments and optional a
-# required header and definition name (HAVE_ prepended)
-# call arguments are required as the compiler will do strict signature checking
-OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'),
- ("__builtin_isinf", '5.'),
- ("__builtin_isfinite", '5.'),
- ("__builtin_bswap32", '5u'),
- ("__builtin_bswap64", '5u'),
- ("__builtin_expect", '5, 0'),
- # Test `long long` for arm+clang 13 (gh-22811,
- # but we use all versions of __builtin_mul_overflow):
- ("__builtin_mul_overflow", '(long long)5, 5, (int*)5'),
- ("__builtin_prefetch", "(float*)0, 0, 3"),
- ]
-
-# function attributes
-# tested via "int %s %s(void *);" % (attribute, name)
-# function name will be converted to HAVE_<upper-case-name> preprocessor macro
-OPTIONAL_FUNCTION_ATTRIBUTES = [('__attribute__((optimize("unroll-loops")))',
- 'attribute_optimize_unroll_loops'),
- ('__attribute__((optimize("O3")))',
- 'attribute_optimize_opt_3'),
- ('__attribute__((optimize("O2")))',
- 'attribute_optimize_opt_2'),
- ('__attribute__((nonnull (1)))',
- 'attribute_nonnull'),
- ]
-def fname2def(name):
- return "HAVE_%s" % name.upper()
-
-def sym2def(symbol):
- define = symbol.replace(' ', '')
- return define.upper()
-
-def type2def(symbol):
- define = symbol.replace(' ', '_')
- return define.upper()
-
-# Code to detect long double representation taken from MPFR m4 macro
-def check_long_double_representation(cmd):
- cmd._check_compiler()
- body = LONG_DOUBLE_REPRESENTATION_SRC % {'type': 'long double'}
-
- # Disable whole program optimization (the default on vs2015, with python 3.5+)
- # which generates intermediary object files and prevents checking the
- # float representation.
- if sys.platform == "win32" and not mingw32():
- try:
- cmd.compiler.compile_options.remove("/GL")
- except (AttributeError, ValueError):
- pass
-
- # Disable multi-file interprocedural optimization in the Intel compiler on Linux
- # which generates intermediary object files and prevents checking the
- # float representation.
- elif (sys.platform != "win32"
- and cmd.compiler.compiler_type.startswith('intel')
- and '-ipo' in cmd.compiler.cc_exe):
- newcompiler = cmd.compiler.cc_exe.replace(' -ipo', '')
- cmd.compiler.set_executables(
- compiler=newcompiler,
- compiler_so=newcompiler,
- compiler_cxx=newcompiler,
- linker_exe=newcompiler,
- linker_so=newcompiler + ' -shared'
- )
-
- # We need to use _compile because we need the object filename
- src, obj = cmd._compile(body, None, None, 'c')
- try:
- ltype = long_double_representation(pyod(obj))
- return ltype
- except ValueError:
- # try linking to support CC="gcc -flto" or icc -ipo
- # struct needs to be volatile so it isn't optimized away
- # additionally "clang -flto" requires the foo struct to be used
- body = body.replace('struct', 'volatile struct')
- body += "int main(void) { return foo.before[0]; }\n"
- src, obj = cmd._compile(body, None, None, 'c')
- cmd.temp_files.append("_configtest")
- cmd.compiler.link_executable([obj], "_configtest")
- ltype = long_double_representation(pyod("_configtest"))
- return ltype
- finally:
- cmd._clean()
-
-LONG_DOUBLE_REPRESENTATION_SRC = r"""
-/* "before" is 16 bytes to ensure there's no padding between it and "x".
- * We're not expecting any "long double" bigger than 16 bytes or with
- * alignment requirements stricter than 16 bytes. */
-typedef %(type)s test_type;
-
-struct {
- char before[16];
- test_type x;
- char after[8];
-} foo = {
- { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
- '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
- -123456789.0,
- { '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' }
-};
-"""
-
-def pyod(filename):
- """Python implementation of the od UNIX utility (od -b, more exactly).
-
- Parameters
- ----------
- filename : str
- name of the file to get the dump from.
-
- Returns
- -------
- out : seq
- list of lines of od output
-
- Notes
- -----
- We only implement enough to get the necessary information for long double
- representation, this is not intended as a compatible replacement for od.
- """
- out = []
- with open(filename, 'rb') as fid:
- yo2 = [oct(o)[2:] for o in fid.read()]
- for i in range(0, len(yo2), 16):
- line = ['%07d' % int(oct(i)[2:])]
- line.extend(['%03d' % int(c) for c in yo2[i:i+16]])
- out.append(" ".join(line))
- return out
-
-
-_BEFORE_SEQ = ['000', '000', '000', '000', '000', '000', '000', '000',
- '001', '043', '105', '147', '211', '253', '315', '357']
-_AFTER_SEQ = ['376', '334', '272', '230', '166', '124', '062', '020']
-
-_IEEE_DOUBLE_BE = ['301', '235', '157', '064', '124', '000', '000', '000']
-_IEEE_DOUBLE_LE = _IEEE_DOUBLE_BE[::-1]
-_INTEL_EXTENDED_12B = ['000', '000', '000', '000', '240', '242', '171', '353',
- '031', '300', '000', '000']
-_INTEL_EXTENDED_16B = ['000', '000', '000', '000', '240', '242', '171', '353',
- '031', '300', '000', '000', '000', '000', '000', '000']
-_MOTOROLA_EXTENDED_12B = ['300', '031', '000', '000', '353', '171',
- '242', '240', '000', '000', '000', '000']
-_IEEE_QUAD_PREC_BE = ['300', '031', '326', '363', '105', '100', '000', '000',
- '000', '000', '000', '000', '000', '000', '000', '000']
-_IEEE_QUAD_PREC_LE = _IEEE_QUAD_PREC_BE[::-1]
-_IBM_DOUBLE_DOUBLE_BE = (['301', '235', '157', '064', '124', '000', '000', '000'] +
- ['000'] * 8)
-_IBM_DOUBLE_DOUBLE_LE = (['000', '000', '000', '124', '064', '157', '235', '301'] +
- ['000'] * 8)
-
-def long_double_representation(lines):
- """Given a binary dump as given by GNU od -b, look for long double
- representation."""
-
- # Read contains a list of 32 items, each item is a byte (in octal
- # representation, as a string). We 'slide' over the output until read is of
- # the form before_seq + content + after_sequence, where content is the long double
- # representation:
- # - content is 12 bytes: 80 bits Intel representation
- # - content is 16 bytes: 80 bits Intel representation (64 bits) or quad precision
- # - content is 8 bytes: same as double (not implemented yet)
- read = [''] * 32
- saw = None
- for line in lines:
- # we skip the first word, as od -b output an index at the beginning of
- # each line
- for w in line.split()[1:]:
- read.pop(0)
- read.append(w)
-
- # If the end of read is equal to the after_sequence, read contains
- # the long double
- if read[-8:] == _AFTER_SEQ:
- saw = copy.copy(read)
- # if the content was 12 bytes, we only have 32 - 8 - 12 = 12
- # "before" bytes. In other words the first 4 "before" bytes went
- # past the sliding window.
- if read[:12] == _BEFORE_SEQ[4:]:
- if read[12:-8] == _INTEL_EXTENDED_12B:
- return 'INTEL_EXTENDED_12_BYTES_LE'
- if read[12:-8] == _MOTOROLA_EXTENDED_12B:
- return 'MOTOROLA_EXTENDED_12_BYTES_BE'
- # if the content was 16 bytes, we are left with 32-8-16 = 16
- # "before" bytes, so 8 went past the sliding window.
- elif read[:8] == _BEFORE_SEQ[8:]:
- if read[8:-8] == _INTEL_EXTENDED_16B:
- return 'INTEL_EXTENDED_16_BYTES_LE'
- elif read[8:-8] == _IEEE_QUAD_PREC_BE:
- return 'IEEE_QUAD_BE'
- elif read[8:-8] == _IEEE_QUAD_PREC_LE:
- return 'IEEE_QUAD_LE'
- elif read[8:-8] == _IBM_DOUBLE_DOUBLE_LE:
- return 'IBM_DOUBLE_DOUBLE_LE'
- elif read[8:-8] == _IBM_DOUBLE_DOUBLE_BE:
- return 'IBM_DOUBLE_DOUBLE_BE'
- # if the content was 8 bytes, left with 32-8-8 = 16 bytes
- elif read[:16] == _BEFORE_SEQ:
- if read[16:-8] == _IEEE_DOUBLE_LE:
- return 'IEEE_DOUBLE_LE'
- elif read[16:-8] == _IEEE_DOUBLE_BE:
- return 'IEEE_DOUBLE_BE'
-
- if saw is not None:
- raise ValueError("Unrecognized format (%s)" % saw)
- else:
- # We never detected the after_sequence
- raise ValueError("Could not lock sequences (%s)" % saw)
-
-
-def check_for_right_shift_internal_compiler_error(cmd):
- """
- On our arm CI, this fails with an internal compilation error
-
- The failure looks like the following, and can be reproduced on ARM64 GCC 5.4:
-
- <source>: In function 'right_shift':
- <source>:4:20: internal compiler error: in expand_shift_1, at expmed.c:2349
- ip1[i] = ip1[i] >> in2;
- ^
- Please submit a full bug report,
- with preprocessed source if appropriate.
- See <http://gcc.gnu.org/bugs.html> for instructions.
- Compiler returned: 1
-
- This function returns True if this compiler bug is present, and we need to
- turn off optimization for the function
- """
- cmd._check_compiler()
- has_optimize = cmd.try_compile(textwrap.dedent("""\
- __attribute__((optimize("O3"))) void right_shift() {}
- """), None, None)
- if not has_optimize:
- return False
-
- no_err = cmd.try_compile(textwrap.dedent("""\
- typedef long the_type; /* fails also for unsigned and long long */
- __attribute__((optimize("O3"))) void right_shift(the_type in2, the_type *ip1, int n) {
- for (int i = 0; i < n; i++) {
- if (in2 < (the_type)sizeof(the_type) * 8) {
- ip1[i] = ip1[i] >> in2;
- }
- }
- }
- """), None, None)
- return not no_err
diff --git a/contrib/python/numpy/py3/numpy/core/tests/examples/cython/setup.py b/contrib/python/numpy/py3/numpy/core/tests/examples/cython/setup.py
deleted file mode 100644
index 6e34aa7787a..00000000000
--- a/contrib/python/numpy/py3/numpy/core/tests/examples/cython/setup.py
+++ /dev/null
@@ -1,25 +0,0 @@
-"""
-Provide python-space access to the functions exposed in numpy/__init__.pxd
-for testing.
-"""
-
-import numpy as np
-from distutils.core import setup
-from Cython.Build import cythonize
-from setuptools.extension import Extension
-import os
-
-macros = [("NPY_NO_DEPRECATED_API", 0)]
-
-checks = Extension(
- "checks",
- sources=[os.path.join('.', "checks.pyx")],
- include_dirs=[np.get_include()],
- define_macros=macros,
-)
-
-extensions = [checks]
-
-setup(
- ext_modules=cythonize(extensions)
-)
diff --git a/contrib/python/numpy/py3/numpy/core/tests/examples/limited_api/setup.py b/contrib/python/numpy/py3/numpy/core/tests/examples/limited_api/setup.py
deleted file mode 100644
index 18747dc8089..00000000000
--- a/contrib/python/numpy/py3/numpy/core/tests/examples/limited_api/setup.py
+++ /dev/null
@@ -1,22 +0,0 @@
-"""
-Build an example package using the limited Python C API.
-"""
-
-import numpy as np
-from setuptools import setup, Extension
-import os
-
-macros = [("NPY_NO_DEPRECATED_API", 0), ("Py_LIMITED_API", "0x03060000")]
-
-limited_api = Extension(
- "limited_api",
- sources=[os.path.join('.', "limited_api.c")],
- include_dirs=[np.get_include()],
- define_macros=macros,
-)
-
-extensions = [limited_api]
-
-setup(
- ext_modules=extensions
-)
diff --git a/contrib/python/numpy/py3/numpy/distutils/setup.py b/contrib/python/numpy/py3/numpy/distutils/setup.py
deleted file mode 100644
index 522756fc9db..00000000000
--- a/contrib/python/numpy/py3/numpy/distutils/setup.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python3
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('distutils', parent_package, top_path)
- config.add_subpackage('command')
- config.add_subpackage('fcompiler')
- config.add_subpackage('tests')
- config.add_data_files('site.cfg')
- config.add_data_files('mingw/gfortran_vs2003_hack.c')
- config.add_data_dir('checks')
- config.add_data_files('*.pyi')
- config.make_config_py()
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/f2py/setup.py b/contrib/python/numpy/py3/numpy/f2py/setup.py
deleted file mode 100644
index 05bef300014..00000000000
--- a/contrib/python/numpy/py3/numpy/f2py/setup.py
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python3
-"""
-setup.py for installing F2PY
-
-Usage:
- pip install .
-
-Copyright 2001-2005 Pearu Peterson all rights reserved,
-Pearu Peterson <[email protected]>
-Permission to use, modify, and distribute this software is given under the
-terms of the NumPy License.
-
-NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
-$Revision: 1.32 $
-$Date: 2005/01/30 17:22:14 $
-Pearu Peterson
-
-"""
-from numpy.distutils.core import setup
-from numpy.distutils.misc_util import Configuration
-
-
-from __version__ import version
-
-
-def configuration(parent_package='', top_path=None):
- config = Configuration('f2py', parent_package, top_path)
- config.add_subpackage('tests')
- config.add_subpackage('_backends')
- config.add_data_dir('tests/src')
- config.add_data_files(
- 'src/fortranobject.c',
- 'src/fortranobject.h',
- '_backends/meson.build.template',
- )
- config.add_data_files('*.pyi')
- return config
-
-
-if __name__ == "__main__":
-
- config = configuration(top_path='')
- config = config.todict()
-
- config['classifiers'] = [
- 'Development Status :: 5 - Production/Stable',
- 'Intended Audience :: Developers',
- 'Intended Audience :: Science/Research',
- 'License :: OSI Approved :: NumPy License',
- 'Natural Language :: English',
- 'Operating System :: OS Independent',
- 'Programming Language :: C',
- 'Programming Language :: Fortran',
- 'Programming Language :: Python',
- 'Topic :: Scientific/Engineering',
- 'Topic :: Software Development :: Code Generators',
- ]
- setup(version=version,
- description="F2PY - Fortran to Python Interface Generator",
- author="Pearu Peterson",
- author_email="[email protected]",
- maintainer="Pearu Peterson",
- maintainer_email="[email protected]",
- license="BSD",
- platforms="Unix, Windows (mingw|cygwin), Mac OSX",
- long_description="""\
-The Fortran to Python Interface Generator, or F2PY for short, is a
-command line tool (f2py) for generating Python C/API modules for
-wrapping Fortran 77/90/95 subroutines, accessing common blocks from
-Python, and calling Python functions from Fortran (call-backs).
-Interfacing subroutines/data from Fortran 90/95 modules is supported.""",
- url="https://numpy.org/doc/stable/f2py/",
- keywords=['Fortran', 'f2py'],
- **config)
diff --git a/contrib/python/numpy/py3/numpy/fft/setup.py b/contrib/python/numpy/py3/numpy/fft/setup.py
deleted file mode 100644
index 477948a0986..00000000000
--- a/contrib/python/numpy/py3/numpy/fft/setup.py
+++ /dev/null
@@ -1,22 +0,0 @@
-import sys
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('fft', parent_package, top_path)
-
- config.add_subpackage('tests')
-
- # AIX needs to be told to use large file support - at all times
- defs = [('_LARGE_FILES', None)] if sys.platform[:3] == "aix" else []
- # Configure pocketfft_internal
- config.add_extension('_pocketfft_internal',
- sources=['_pocketfft.c'],
- define_macros=defs,
- )
-
- config.add_data_files('*.pyi')
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/lib/setup.py b/contrib/python/numpy/py3/numpy/lib/setup.py
deleted file mode 100644
index 7520b72d7ac..00000000000
--- a/contrib/python/numpy/py3/numpy/lib/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
-
- config = Configuration('lib', parent_package, top_path)
- config.add_subpackage('tests')
- config.add_data_dir('tests/data')
- config.add_data_files('*.pyi')
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/linalg/setup.py b/contrib/python/numpy/py3/numpy/linalg/setup.py
deleted file mode 100644
index e357e294f79..00000000000
--- a/contrib/python/numpy/py3/numpy/linalg/setup.py
+++ /dev/null
@@ -1,91 +0,0 @@
-import os
-import sys
-import sysconfig
-
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
- from numpy.distutils.system_info import get_info, system_info
- config = Configuration('linalg', parent_package, top_path)
-
- config.add_subpackage('tests')
-
- # Configure lapack_lite
-
- src_dir = 'lapack_lite'
- lapack_lite_src = [
- os.path.join(src_dir, 'python_xerbla.c'),
- os.path.join(src_dir, 'f2c_z_lapack.c'),
- os.path.join(src_dir, 'f2c_c_lapack.c'),
- os.path.join(src_dir, 'f2c_d_lapack.c'),
- os.path.join(src_dir, 'f2c_s_lapack.c'),
- os.path.join(src_dir, 'f2c_lapack.c'),
- os.path.join(src_dir, 'f2c_blas.c'),
- os.path.join(src_dir, 'f2c_config.c'),
- os.path.join(src_dir, 'f2c.c'),
- ]
- all_sources = config.paths(lapack_lite_src)
-
- if os.environ.get('NPY_USE_BLAS_ILP64', "0") != "0":
- lapack_info = get_info('lapack_ilp64_opt', 2)
- else:
- lapack_info = get_info('lapack_opt', 0) # and {}
-
- use_lapack_lite = not lapack_info
-
- if use_lapack_lite:
- # This makes numpy.distutils write the fact that lapack_lite
- # is being used to numpy.__config__
- class numpy_linalg_lapack_lite(system_info):
- def calc_info(self):
- info = {'language': 'c'}
- size_t_size = sysconfig.get_config_var("SIZEOF_SIZE_T")
- if size_t_size:
- maxsize = 2**(size_t_size - 1) - 1
- else:
- # We prefer using sysconfig as it allows cross-compilation
- # but the information may be missing (e.g. on windows).
- maxsize = sys.maxsize
- if maxsize > 2**32:
- # Build lapack-lite in 64-bit integer mode.
- # The suffix is arbitrary (lapack_lite symbols follow it),
- # but use the "64_" convention here.
- info['define_macros'] = [
- ('HAVE_BLAS_ILP64', None),
- ('BLAS_SYMBOL_SUFFIX', '64_'),
- ('OPENBLAS_ILP64_NAMING_SCHEME', None),
- ]
- self.set_info(**info)
-
- lapack_info = numpy_linalg_lapack_lite().get_info(2)
-
- def get_lapack_lite_sources(ext, build_dir):
- if use_lapack_lite:
- print("### Warning: Using unoptimized lapack ###")
- return all_sources
- else:
- if sys.platform == 'win32':
- print("### Warning: python_xerbla.c is disabled ###")
- return []
- return [all_sources[0]]
-
- config.add_extension(
- 'lapack_lite',
- sources=['lapack_litemodule.c', get_lapack_lite_sources],
- depends=['lapack_lite/f2c.h'],
- extra_info=lapack_info,
- )
-
- # umath_linalg module
- config.add_extension(
- '_umath_linalg',
- sources=['umath_linalg.cpp', get_lapack_lite_sources],
- depends=['lapack_lite/f2c.h'],
- extra_info=lapack_info,
- libraries=['npymath'],
- )
- config.add_data_files('*.pyi')
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/ma/setup.py b/contrib/python/numpy/py3/numpy/ma/setup.py
deleted file mode 100644
index 018d38cdd50..00000000000
--- a/contrib/python/numpy/py3/numpy/ma/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env python3
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('ma', parent_package, top_path)
- config.add_subpackage('tests')
- config.add_data_files('*.pyi')
- return config
-
-if __name__ == "__main__":
- from numpy.distutils.core import setup
- config = configuration(top_path='').todict()
- setup(**config)
diff --git a/contrib/python/numpy/py3/numpy/matrixlib/setup.py b/contrib/python/numpy/py3/numpy/matrixlib/setup.py
deleted file mode 100644
index 4fed75de1cb..00000000000
--- a/contrib/python/numpy/py3/numpy/matrixlib/setup.py
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env python3
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('matrixlib', parent_package, top_path)
- config.add_subpackage('tests')
- config.add_data_files('*.pyi')
- return config
-
-if __name__ == "__main__":
- from numpy.distutils.core import setup
- config = configuration(top_path='').todict()
- setup(**config)
diff --git a/contrib/python/numpy/py3/numpy/polynomial/setup.py b/contrib/python/numpy/py3/numpy/polynomial/setup.py
deleted file mode 100644
index b58e867a133..00000000000
--- a/contrib/python/numpy/py3/numpy/polynomial/setup.py
+++ /dev/null
@@ -1,10 +0,0 @@
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('polynomial', parent_package, top_path)
- config.add_subpackage('tests')
- config.add_data_files('*.pyi')
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/random/_bounded_integers.pxd.in b/contrib/python/numpy/py3/numpy/random/_bounded_integers.pxd.in
deleted file mode 100644
index 5ae5a806715..00000000000
--- a/contrib/python/numpy/py3/numpy/random/_bounded_integers.pxd.in
+++ /dev/null
@@ -1,26 +0,0 @@
-from libc.stdint cimport (uint8_t, uint16_t, uint32_t, uint64_t,
- int8_t, int16_t, int32_t, int64_t, intptr_t)
-import numpy as np
-cimport numpy as np
-ctypedef np.npy_bool bool_t
-
-from numpy.random cimport bitgen_t
-
-cdef inline uint64_t _gen_mask(uint64_t max_val) nogil:
- """Mask generator for use in bounded random numbers"""
- # Smallest bit mask >= max
- cdef uint64_t mask = max_val
- mask |= mask >> 1
- mask |= mask >> 2
- mask |= mask >> 4
- mask |= mask >> 8
- mask |= mask >> 16
- mask |= mask >> 32
- return mask
-{{
-py:
-inttypes = ('uint64','uint32','uint16','uint8','bool','int64','int32','int16','int8')
-}}
-{{for inttype in inttypes}}
-cdef object _rand_{{inttype}}(object low, object high, object size, bint use_masked, bint closed, bitgen_t *state, object lock)
-{{endfor}}
diff --git a/contrib/python/numpy/py3/numpy/random/_bounded_integers.pyx.in b/contrib/python/numpy/py3/numpy/random/_bounded_integers.pyx.in
deleted file mode 100644
index 6743001d6d5..00000000000
--- a/contrib/python/numpy/py3/numpy/random/_bounded_integers.pyx.in
+++ /dev/null
@@ -1,369 +0,0 @@
-#!python
-#cython: wraparound=False, nonecheck=False, boundscheck=False, cdivision=True
-
-import numpy as np
-cimport numpy as np
-
-__all__ = []
-
-np.import_array()
-
-
-cdef extern from "numpy/random/distributions.h":
- # Generate random numbers in closed interval [off, off + rng].
- uint64_t random_bounded_uint64(bitgen_t *bitgen_state,
- uint64_t off, uint64_t rng,
- uint64_t mask, bint use_masked) nogil
- uint32_t random_buffered_bounded_uint32(bitgen_t *bitgen_state,
- uint32_t off, uint32_t rng,
- uint32_t mask, bint use_masked,
- int *bcnt, uint32_t *buf) nogil
- uint16_t random_buffered_bounded_uint16(bitgen_t *bitgen_state,
- uint16_t off, uint16_t rng,
- uint16_t mask, bint use_masked,
- int *bcnt, uint32_t *buf) nogil
- uint8_t random_buffered_bounded_uint8(bitgen_t *bitgen_state,
- uint8_t off, uint8_t rng,
- uint8_t mask, bint use_masked,
- int *bcnt, uint32_t *buf) nogil
- np.npy_bool random_buffered_bounded_bool(bitgen_t *bitgen_state,
- np.npy_bool off, np.npy_bool rng,
- np.npy_bool mask, bint use_masked,
- int *bcnt, uint32_t *buf) nogil
- void random_bounded_uint64_fill(bitgen_t *bitgen_state,
- uint64_t off, uint64_t rng, np.npy_intp cnt,
- bint use_masked,
- uint64_t *out) nogil
- void random_bounded_uint32_fill(bitgen_t *bitgen_state,
- uint32_t off, uint32_t rng, np.npy_intp cnt,
- bint use_masked,
- uint32_t *out) nogil
- void random_bounded_uint16_fill(bitgen_t *bitgen_state,
- uint16_t off, uint16_t rng, np.npy_intp cnt,
- bint use_masked,
- uint16_t *out) nogil
- void random_bounded_uint8_fill(bitgen_t *bitgen_state,
- uint8_t off, uint8_t rng, np.npy_intp cnt,
- bint use_masked,
- uint8_t *out) nogil
- void random_bounded_bool_fill(bitgen_t *bitgen_state,
- np.npy_bool off, np.npy_bool rng, np.npy_intp cnt,
- bint use_masked,
- np.npy_bool *out) nogil
-
-
-cdef object format_bounds_error(bint closed, object low):
- # Special case low == 0 to provide a better exception for users
- # since low = 0 is the default single-argument case.
- if not np.any(low):
- comp = '<' if closed else '<='
- return f'high {comp} 0'
- else:
- comp = '>' if closed else '>='
- return f'low {comp} high'
-
-
-{{
-py:
-type_info = (('uint32', 'uint32', 'uint64', 'NPY_UINT64', 0, 0, 0, '0X100000000ULL'),
- ('uint16', 'uint16', 'uint32', 'NPY_UINT32', 1, 16, 0, '0X10000UL'),
- ('uint8', 'uint8', 'uint16', 'NPY_UINT16', 3, 8, 0, '0X100UL'),
- ('bool','bool', 'uint8', 'NPY_UINT8', 31, 1, 0, '0x2UL'),
- ('int32', 'uint32', 'uint64', 'NPY_INT64', 0, 0, '-0x80000000LL', '0x80000000LL'),
- ('int16', 'uint16', 'uint32', 'NPY_INT32', 1, 16, '-0x8000LL', '0x8000LL' ),
- ('int8', 'uint8', 'uint16', 'NPY_INT16', 3, 8, '-0x80LL', '0x80LL' ),
-)}}
-{{for nptype, utype, nptype_up, npctype, remaining, bitshift, lb, ub in type_info}}
-{{ py: otype = nptype + '_' if nptype == 'bool' else nptype }}
-cdef object _rand_{{nptype}}_broadcast(np.ndarray low, np.ndarray high, object size,
- bint use_masked, bint closed,
- bitgen_t *state, object lock):
- """
- Array path for smaller integer types
-
- This path is simpler since the high value in the open interval [low, high)
- must be in-range for the next larger type, {{nptype_up}}. Here we case to
- this type for checking and the recast to {{nptype}} when producing the
- random integers.
- """
- cdef {{utype}}_t rng, last_rng, off, val, mask, out_val, is_open
- cdef uint32_t buf
- cdef {{utype}}_t *out_data
- cdef {{nptype_up}}_t low_v, high_v
- cdef np.ndarray low_arr, high_arr, out_arr
- cdef np.npy_intp i, cnt
- cdef np.broadcast it
- cdef int buf_rem = 0
-
- # Array path
- is_open = not closed
- low_arr = <np.ndarray>low
- high_arr = <np.ndarray>high
-
- if np.can_cast(low_arr, np.{{otype}}):
- pass # cannot be out-of-bounds
- elif np.any(np.less(low_arr, np.{{otype}}({{lb}}))):
- raise ValueError('low is out of bounds for {{nptype}}')
-
- if closed:
- high_comp = np.greater_equal
- low_high_comp = np.greater
- else:
- high_comp = np.greater
- low_high_comp = np.greater_equal
-
- if np.can_cast(high_arr, np.{{otype}}):
- pass # cannot be out-of-bounds
- elif np.any(high_comp(high_arr, np.{{nptype_up}}({{ub}}))):
- raise ValueError('high is out of bounds for {{nptype}}')
-
- if np.any(low_high_comp(low_arr, high_arr)):
- raise ValueError(format_bounds_error(closed, low_arr))
-
- low_arr = <np.ndarray>np.PyArray_FROM_OTF(low, np.{{npctype}}, np.NPY_ALIGNED | np.NPY_FORCECAST)
- high_arr = <np.ndarray>np.PyArray_FROM_OTF(high, np.{{npctype}}, np.NPY_ALIGNED | np.NPY_FORCECAST)
-
- if size is not None:
- out_arr = <np.ndarray>np.empty(size, np.{{otype}})
- else:
- it = np.PyArray_MultiIterNew2(low_arr, high_arr)
- out_arr = <np.ndarray>np.empty(it.shape, np.{{otype}})
-
- it = np.PyArray_MultiIterNew3(low_arr, high_arr, out_arr)
- out_data = <{{utype}}_t *>np.PyArray_DATA(out_arr)
- cnt = np.PyArray_SIZE(out_arr)
- mask = last_rng = 0
- with lock, nogil:
- for i in range(cnt):
- low_v = (<{{nptype_up}}_t*>np.PyArray_MultiIter_DATA(it, 0))[0]
- high_v = (<{{nptype_up}}_t*>np.PyArray_MultiIter_DATA(it, 1))[0]
- # Subtract 1 since generator produces values on the closed int [off, off+rng]
- rng = <{{utype}}_t>((high_v - is_open) - low_v)
- off = <{{utype}}_t>(<{{nptype_up}}_t>low_v)
-
- if rng != last_rng:
- # Smallest bit mask >= max
- mask = <{{utype}}_t>_gen_mask(rng)
-
- out_data[i] = random_buffered_bounded_{{utype}}(state, off, rng, mask, use_masked, &buf_rem, &buf)
-
- np.PyArray_MultiIter_NEXT(it)
- return out_arr
-{{endfor}}
-{{
-py:
-big_type_info = (('uint64', 'uint64', 'NPY_UINT64', '0x0ULL', '0xFFFFFFFFFFFFFFFFULL'),
- ('int64', 'uint64', 'NPY_INT64', '-0x8000000000000000LL', '0x7FFFFFFFFFFFFFFFLL' )
-)}}
-{{for nptype, utype, npctype, lb, ub in big_type_info}}
-{{ py: otype = nptype}}
-cdef object _rand_{{nptype}}_broadcast(object low, object high, object size,
- bint use_masked, bint closed,
- bitgen_t *state, object lock):
- """
- Array path for 64-bit integer types
-
- Requires special treatment since the high value can be out-of-range for
- the largest (64 bit) integer type since the generator is specified on the
- interval [low,high).
-
- The internal generator does not have this issue since it generates from
- the closes interval [low, high-1] and high-1 is always in range for the
- 64 bit integer type.
- """
-
- cdef np.ndarray low_arr, low_arr_orig, high_arr, high_arr_orig, out_arr
- cdef np.npy_intp i, cnt, n
- cdef np.broadcast it
- cdef object closed_upper
- cdef uint64_t *out_data
- cdef {{nptype}}_t *highm1_data
- cdef {{nptype}}_t low_v, high_v
- cdef uint64_t rng, last_rng, val, mask, off, out_val, is_open
-
- low_arr_orig = <np.ndarray>low
- high_arr_orig = <np.ndarray>high
-
- is_open = not closed
-
- # The following code tries to cast safely, but failing that goes via
- # Python `int()` because it is very difficult to cast integers in a
- # truly safe way (i.e. so it raises on out-of-bound).
- # We correct if the interval is not closed in this step if we go the long
- # route. (Not otherwise, since the -1 could overflow in theory.)
- if np.can_cast(low_arr_orig, np.{{otype}}):
- low_arr = <np.ndarray>np.PyArray_FROM_OTF(low_arr_orig, np.{{npctype}}, np.NPY_ALIGNED)
- else:
- low_arr = <np.ndarray>np.empty_like(low_arr_orig, dtype=np.{{otype}})
- flat = low_arr_orig.flat
- low_data = <{{nptype}}_t *>np.PyArray_DATA(low_arr)
- cnt = np.PyArray_SIZE(low_arr)
- for i in range(cnt):
- lower = int(flat[i])
- if lower < {{lb}} or lower > {{ub}}:
- raise ValueError('low is out of bounds for {{nptype}}')
- low_data[i] = lower
-
- del low_arr_orig
-
- if np.can_cast(high_arr_orig, np.{{otype}}):
- high_arr = <np.ndarray>np.PyArray_FROM_OTF(high_arr_orig, np.{{npctype}}, np.NPY_ALIGNED)
- else:
- high_arr = np.empty_like(high_arr_orig, dtype=np.{{otype}})
- flat = high_arr_orig.flat
- high_data = <{{nptype}}_t *>np.PyArray_DATA(high_arr)
- cnt = np.PyArray_SIZE(high_arr)
- for i in range(cnt):
- closed_upper = int(flat[i]) - is_open
- if closed_upper > {{ub}}:
- raise ValueError('high is out of bounds for {{nptype}}')
- if closed_upper < {{lb}}:
- raise ValueError(format_bounds_error(closed, low_arr))
- high_data[i] = closed_upper
-
- is_open = 0 # we applied is_open in this path already
-
- del high_arr_orig
-
- # Since we have the largest supported integer dtypes, they must be within
- # range at this point; otherwise conversion would have failed. Check that
- # it is never true that `high <= low`` if closed and `high < low` if not
- if not is_open:
- low_high_comp = np.greater
- else:
- low_high_comp = np.greater_equal
-
- if np.any(low_high_comp(low_arr, high_arr)):
- raise ValueError(format_bounds_error(closed, low_arr))
-
- if size is not None:
- out_arr = <np.ndarray>np.empty(size, np.{{otype}})
- else:
- it = np.PyArray_MultiIterNew2(low_arr, high_arr)
- out_arr = <np.ndarray>np.empty(it.shape, np.{{otype}})
-
- it = np.PyArray_MultiIterNew3(low_arr, high_arr, out_arr)
- out_data = <uint64_t *>np.PyArray_DATA(out_arr)
- n = np.PyArray_SIZE(out_arr)
- mask = last_rng = 0
- with lock, nogil:
- for i in range(n):
- low_v = (<{{nptype}}_t*>np.PyArray_MultiIter_DATA(it, 0))[0]
- high_v = (<{{nptype}}_t*>np.PyArray_MultiIter_DATA(it, 1))[0]
- # Generator produces values on the closed int [off, off+rng]
- rng = <{{utype}}_t>((high_v - is_open) - low_v)
- off = <{{utype}}_t>(<{{nptype}}_t>low_v)
-
- if rng != last_rng:
- mask = _gen_mask(rng)
- out_data[i] = random_bounded_uint64(state, off, rng, mask, use_masked)
-
- np.PyArray_MultiIter_NEXT(it)
-
- return out_arr
-{{endfor}}
-{{
-py:
-type_info = (('uint64', 'uint64', '0x0ULL', '0xFFFFFFFFFFFFFFFFULL'),
- ('uint32', 'uint32', '0x0UL', '0XFFFFFFFFUL'),
- ('uint16', 'uint16', '0x0UL', '0XFFFFUL'),
- ('uint8', 'uint8', '0x0UL', '0XFFUL'),
- ('bool', 'bool', '0x0UL', '0x1UL'),
- ('int64', 'uint64', '-0x8000000000000000LL', '0x7FFFFFFFFFFFFFFFL'),
- ('int32', 'uint32', '-0x80000000L', '0x7FFFFFFFL'),
- ('int16', 'uint16', '-0x8000L', '0x7FFFL' ),
- ('int8', 'uint8', '-0x80L', '0x7FL' )
-)}}
-{{for nptype, utype, lb, ub in type_info}}
-{{ py: otype = nptype + '_' if nptype == 'bool' else nptype }}
-cdef object _rand_{{nptype}}(object low, object high, object size,
- bint use_masked, bint closed,
- bitgen_t *state, object lock):
- """
- _rand_{{nptype}}(low, high, size, use_masked, *state, lock)
-
- Return random `np.{{otype}}` integers from `low` (inclusive) to `high` (exclusive).
-
- Return random integers from the "discrete uniform" distribution in the
- interval [`low`, `high`). If `high` is None (the default),
- then results are from [0, `low`). On entry the arguments are presumed
- to have been validated for size and order for the `np.{{otype}}` type.
-
- Parameters
- ----------
- low : int or array-like
- Lowest (signed) integer to be drawn from the distribution (unless
- ``high=None``, in which case this parameter is the *highest* such
- integer).
- high : int or array-like
- If provided, one above the largest (signed) integer to be drawn from the
- distribution (see above for behavior if ``high=None``).
- size : int or tuple of ints
- Output shape. If the given shape is, e.g., ``(m, n, k)``, then
- ``m * n * k`` samples are drawn. Default is None, in which case a
- single value is returned.
- use_masked : bool
- If True then rejection sampling with a range mask is used else Lemire's algorithm is used.
- closed : bool
- If True then sample from [low, high]. If False, sample [low, high)
- state : bit generator
- Bit generator state to use in the core random number generators
- lock : threading.Lock
- Lock to prevent multiple using a single generator simultaneously
-
- Returns
- -------
- out : python scalar or ndarray of np.{{otype}}
- `size`-shaped array of random integers from the appropriate
- distribution, or a single such random int if `size` not provided.
-
- Notes
- -----
- The internal integer generator produces values from the closed
- interval [low, high-(not closed)]. This requires some care since
- high can be out-of-range for {{utype}}. The scalar path leaves
- integers as Python integers until the 1 has been subtracted to
- avoid needing to cast to a larger type.
- """
- cdef np.ndarray out_arr, low_arr, high_arr
- cdef {{utype}}_t rng, off, out_val
- cdef {{utype}}_t *out_data
- cdef np.npy_intp i, n, cnt
-
- if size is not None:
- if (np.prod(size) == 0):
- return np.empty(size, dtype=np.{{otype}})
-
- low_arr = <np.ndarray>np.array(low, copy=False)
- high_arr = <np.ndarray>np.array(high, copy=False)
- low_ndim = np.PyArray_NDIM(low_arr)
- high_ndim = np.PyArray_NDIM(high_arr)
- if low_ndim == 0 and high_ndim == 0:
- low = int(low_arr)
- high = int(high_arr)
- # Subtract 1 since internal generator produces on closed interval [low, high]
- if not closed:
- high -= 1
-
- if low < {{lb}}:
- raise ValueError("low is out of bounds for {{nptype}}")
- if high > {{ub}}:
- raise ValueError("high is out of bounds for {{nptype}}")
- if low > high: # -1 already subtracted, closed interval
- raise ValueError(format_bounds_error(closed, low))
-
- rng = <{{utype}}_t>(high - low)
- off = <{{utype}}_t>(<{{nptype}}_t>low)
- if size is None:
- with lock:
- random_bounded_{{utype}}_fill(state, off, rng, 1, use_masked, &out_val)
- return np.{{otype}}(<{{nptype}}_t>out_val)
- else:
- out_arr = <np.ndarray>np.empty(size, np.{{otype}})
- cnt = np.PyArray_SIZE(out_arr)
- out_data = <{{utype}}_t *>np.PyArray_DATA(out_arr)
- with lock, nogil:
- random_bounded_{{utype}}_fill(state, off, rng, cnt, use_masked, out_data)
- return out_arr
- return _rand_{{nptype}}_broadcast(low_arr, high_arr, size, use_masked, closed, state, lock)
-{{endfor}}
diff --git a/contrib/python/numpy/py3/numpy/random/setup.py b/contrib/python/numpy/py3/numpy/random/setup.py
deleted file mode 100644
index cd9ad976c31..00000000000
--- a/contrib/python/numpy/py3/numpy/random/setup.py
+++ /dev/null
@@ -1,159 +0,0 @@
-import os
-import sys
-from os.path import join
-
-from numpy.distutils.system_info import platform_bits
-from numpy.distutils.msvccompiler import lib_opts_if_msvc
-
-
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration, get_mathlibs
- config = Configuration('random', parent_package, top_path)
-
- def generate_libraries(ext, build_dir):
- config_cmd = config.get_config_cmd()
- libs = get_mathlibs()
- if sys.platform == 'win32':
- libs.extend(['Advapi32', 'Kernel32'])
- ext.libraries.extend(libs)
- return None
-
- # enable unix large file support on 32 bit systems
- # (64 bit off_t, lseek -> lseek64 etc.)
- if sys.platform[:3] == 'aix':
- defs = [('_LARGE_FILES', None)]
- else:
- defs = [('_FILE_OFFSET_BITS', '64'),
- ('_LARGEFILE_SOURCE', '1'),
- ('_LARGEFILE64_SOURCE', '1')]
-
- defs.append(('NPY_NO_DEPRECATED_API', 0))
- config.add_subpackage('tests')
- config.add_data_dir('tests/data')
- config.add_data_dir('_examples')
-
- EXTRA_LINK_ARGS = []
- EXTRA_LIBRARIES = ['npyrandom']
- if os.name != 'nt':
- # Math lib
- EXTRA_LIBRARIES.append('m')
- # Some bit generators exclude GCC inlining
- EXTRA_COMPILE_ARGS = ['-U__GNUC_GNU_INLINE__']
-
- if sys.platform == 'cygwin':
- # Export symbols without __declspec(dllexport) for using by cython.
- # Using __declspec(dllexport) does not export other necessary symbols
- # in Cygwin package's Cython environment, making it impossible to
- # import modules.
- EXTRA_LINK_ARGS += ['-Wl,--export-all-symbols']
-
- # Use legacy integer variable sizes
- LEGACY_DEFS = [('NP_RANDOM_LEGACY', '1')]
- PCG64_DEFS = []
- # One can force emulated 128-bit arithmetic if one wants.
- #PCG64_DEFS += [('PCG_FORCE_EMULATED_128BIT_MATH', '1')]
- depends = ['__init__.pxd', 'c_distributions.pxd', 'bit_generator.pxd']
-
- # npyrandom - a library like npymath
- npyrandom_sources = [
- 'src/distributions/logfactorial.c',
- 'src/distributions/distributions.c',
- 'src/distributions/random_mvhg_count.c',
- 'src/distributions/random_mvhg_marginals.c',
- 'src/distributions/random_hypergeometric.c',
- ]
-
- def lib_opts(build_cmd):
- """ Add flags that depend on the compiler.
-
- We can't see which compiler we are using in our scope, because we have
- not initialized the distutils build command, so use this deferred
- calculation to run when we are building the library.
- """
- opts = lib_opts_if_msvc(build_cmd)
- if build_cmd.compiler.compiler_type != 'msvc':
- # Some bit generators require c99
- opts.append('-std=c99')
- return opts
-
- config.add_installed_library('npyrandom',
- sources=npyrandom_sources,
- install_dir='lib',
- build_info={
- 'include_dirs' : [], # empty list required for creating npyrandom.h
- 'extra_compiler_args': [lib_opts],
- })
-
- for gen in ['mt19937']:
- # gen.pyx, src/gen/gen.c, src/gen/gen-jump.c
- config.add_extension(f'_{gen}',
- sources=[f'_{gen}.c',
- f'src/{gen}/{gen}.c',
- f'src/{gen}/{gen}-jump.c'],
- include_dirs=['.', 'src', join('src', gen)],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=depends + [f'_{gen}.pyx'],
- define_macros=defs,
- )
- for gen in ['philox', 'pcg64', 'sfc64']:
- # gen.pyx, src/gen/gen.c
- _defs = defs + PCG64_DEFS if gen == 'pcg64' else defs
- config.add_extension(f'_{gen}',
- sources=[f'_{gen}.c',
- f'src/{gen}/{gen}.c'],
- include_dirs=['.', 'src', join('src', gen)],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=depends + [f'_{gen}.pyx',
- 'bit_generator.pyx', 'bit_generator.pxd'],
- define_macros=_defs,
- )
- for gen in ['_common', 'bit_generator']:
- # gen.pyx
- config.add_extension(gen,
- sources=[f'{gen}.c'],
- libraries=EXTRA_LIBRARIES,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- include_dirs=['.', 'src'],
- depends=depends + [f'{gen}.pyx', f'{gen}.pxd',],
- define_macros=defs,
- )
- config.add_data_files(f'{gen}.pxd')
- for gen in ['_generator', '_bounded_integers']:
- # gen.pyx, src/distributions/distributions.c
- config.add_extension(gen,
- sources=[f'{gen}.c'],
- libraries=EXTRA_LIBRARIES + ['npymath'],
- extra_compile_args=EXTRA_COMPILE_ARGS,
- include_dirs=['.', 'src'],
- extra_link_args=EXTRA_LINK_ARGS,
- depends=depends + [f'{gen}.pyx'],
- define_macros=defs,
- )
- config.add_data_files('_bounded_integers.pxd')
- mtrand_libs = ['m', 'npymath'] if os.name != 'nt' else ['npymath']
- config.add_extension('mtrand',
- sources=['mtrand.c',
- 'src/legacy/legacy-distributions.c',
- 'src/distributions/distributions.c',
- ],
- include_dirs=['.', 'src', 'src/legacy'],
- libraries=mtrand_libs,
- extra_compile_args=EXTRA_COMPILE_ARGS,
- extra_link_args=EXTRA_LINK_ARGS,
- depends=depends + ['mtrand.pyx'],
- define_macros=defs + LEGACY_DEFS,
- )
- config.add_data_files(*depends)
- config.add_data_files('*.pyi')
- return config
-
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
-
- setup(configuration=configuration)
diff --git a/contrib/python/numpy/py3/numpy/setup.py b/contrib/python/numpy/py3/numpy/setup.py
deleted file mode 100644
index 536224a8119..00000000000
--- a/contrib/python/numpy/py3/numpy/setup.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env python3
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('numpy', parent_package, top_path)
-
- config.add_subpackage('array_api')
- config.add_subpackage('compat')
- config.add_subpackage('core')
- config.add_subpackage('_core')
- config.add_subpackage('distutils')
- config.add_subpackage('doc')
- config.add_subpackage('f2py')
- config.add_subpackage('fft')
- config.add_subpackage('lib')
- config.add_subpackage('linalg')
- config.add_subpackage('ma')
- config.add_subpackage('matrixlib')
- config.add_subpackage('polynomial')
- config.add_subpackage('random')
- config.add_subpackage('testing')
- config.add_subpackage('typing')
- config.add_subpackage('_typing')
- config.add_subpackage('_utils')
- config.add_data_dir('doc')
- config.add_data_files('py.typed')
- config.add_data_files('*.pyi')
- config.add_subpackage('tests')
- config.add_subpackage('_pyinstaller')
- config.make_config_py() # installs __config__.py
- return config
-
-if __name__ == '__main__':
- print('This is the wrong setup.py file to run')
diff --git a/contrib/python/numpy/py3/numpy/testing/setup.py b/contrib/python/numpy/py3/numpy/testing/setup.py
deleted file mode 100644
index 6f203e87271..00000000000
--- a/contrib/python/numpy/py3/numpy/testing/setup.py
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python3
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('testing', parent_package, top_path)
-
- config.add_subpackage('_private')
- config.add_subpackage('tests')
- config.add_data_files('*.pyi')
- config.add_data_files('_private/*.pyi')
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(maintainer="NumPy Developers",
- maintainer_email="[email protected]",
- description="NumPy test module",
- url="https://www.numpy.org",
- license="NumPy License (BSD Style)",
- configuration=configuration,
- )
diff --git a/contrib/python/numpy/py3/numpy/typing/setup.py b/contrib/python/numpy/py3/numpy/typing/setup.py
deleted file mode 100644
index c444e769fb6..00000000000
--- a/contrib/python/numpy/py3/numpy/typing/setup.py
+++ /dev/null
@@ -1,11 +0,0 @@
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('typing', parent_package, top_path)
- config.add_subpackage('tests')
- config.add_data_dir('tests/data')
- return config
-
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)