summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/compat/setupscons.py11
-rw-r--r--numpy/core/SConscript531
-rw-r--r--numpy/core/SConstruct2
-rw-r--r--numpy/core/bscript20
-rw-r--r--numpy/core/code_generators/ufunc_docstrings.py2
-rw-r--r--numpy/core/include/numpy/npy_cpu.h2
-rw-r--r--numpy/core/include/numpy/npy_endian.h1
-rw-r--r--numpy/core/numeric.py4
-rw-r--r--numpy/core/scons_support.py272
-rw-r--r--numpy/core/setup_common.py2
-rw-r--r--numpy/core/setupscons.py111
-rw-r--r--numpy/core/src/multiarray/common.c6
-rw-r--r--numpy/core/src/multiarray/ctors.c5
-rw-r--r--numpy/core/src/multiarray/iterators.c3
-rw-r--r--numpy/core/src/multiarray/mapping.c14
-rw-r--r--numpy/core/src/multiarray/multiarraymodule.c2
-rw-r--r--numpy/core/src/multiarray/scalartypes.c.src2
-rw-r--r--numpy/core/src/private/npy_config.h2
-rw-r--r--numpy/core/tests/test_multiarray.py7
-rw-r--r--numpy/core/tests/test_numeric.py1
-rw-r--r--numpy/core/tests/test_regression.py13
-rw-r--r--numpy/core/tests/test_scalarprint.py29
-rw-r--r--numpy/core/tests/test_umath.py13
-rw-r--r--numpy/distutils/command/build_ext.py5
-rw-r--r--numpy/distutils/command/scons.py589
-rw-r--r--numpy/distutils/core.py4
-rw-r--r--numpy/distutils/misc_util.py152
-rw-r--r--numpy/distutils/setupscons.py17
-rwxr-xr-xnumpy/f2py/setupscons.py124
-rw-r--r--numpy/fft/SConscript8
-rw-r--r--numpy/fft/SConstruct2
-rw-r--r--numpy/fft/setupscons.py15
-rw-r--r--numpy/lib/SConscript7
-rw-r--r--numpy/lib/SConstruct2
-rw-r--r--numpy/lib/index_tricks.py26
-rw-r--r--numpy/lib/setupscons.py16
-rw-r--r--numpy/lib/tests/test_index_tricks.py10
-rw-r--r--numpy/linalg/SConscript23
-rw-r--r--numpy/linalg/SConstruct2
-rw-r--r--numpy/linalg/linalg.py2
-rw-r--r--numpy/linalg/setupscons.py19
-rw-r--r--numpy/ma/setupscons.py18
-rw-r--r--numpy/matrixlib/setupscons.py13
-rw-r--r--numpy/numarray/SConscript7
-rw-r--r--numpy/numarray/SConstruct2
-rw-r--r--numpy/numarray/setupscons.py14
-rw-r--r--numpy/oldnumeric/setupscons.py8
-rw-r--r--numpy/random/SConscript50
-rw-r--r--numpy/random/SConstruct2
-rw-r--r--numpy/random/setupscons.py40
-rw-r--r--numpy/setupscons.py42
-rw-r--r--numpy/testing/noseclasses.py2
-rwxr-xr-xnumpy/testing/setupscons.py16
53 files changed, 142 insertions, 2150 deletions
diff --git a/numpy/compat/setupscons.py b/numpy/compat/setupscons.py
deleted file mode 100644
index e518245b2..000000000
--- a/numpy/compat/setupscons.py
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env python
-import os.path
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('compat',parent_package,top_path)
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/core/SConscript b/numpy/core/SConscript
deleted file mode 100644
index 952544a25..000000000
--- a/numpy/core/SConscript
+++ /dev/null
@@ -1,531 +0,0 @@
-# Last Change: Sun Apr 26 05:00 PM 2009 J
-# vim:syntax=python
-import os
-import sys
-from os.path import join as pjoin, basename as pbasename, dirname as pdirname
-from copy import deepcopy
-
-from numscons import get_pythonlib_dir
-from numscons import GetNumpyEnvironment
-from numscons import CheckCBLAS
-from numscons import write_info
-
-from code_generators.numpy_api import \
- multiarray_api as multiarray_api_dict, \
- ufunc_api as ufunc_api_dict
-
-from setup_common import *
-from scons_support import CheckBrokenMathlib, define_no_smp, \
- check_mlib, check_mlibs, is_npy_no_signal, CheckInline
-from scons_support import array_api_gen_bld, ufunc_api_gen_bld, template_bld, \
- umath_bld, CheckGCC4, check_api_version, \
- CheckLongDoubleRepresentation
-
-import SCons
-
-# Set to True to enable multiple file compilations (experimental)
-try:
- os.environ['NPY_SEPARATE_COMPILATION']
- ENABLE_SEPARATE_COMPILATION = True
-except KeyError:
- ENABLE_SEPARATE_COMPILATION = False
-try:
- os.environ['NPY_BYPASS_SINGLE_EXTENDED']
- BYPASS_SINGLE_EXTENDED = True
-except KeyError:
- BYPASS_SINGLE_EXTENDED = False
-
-env = GetNumpyEnvironment(ARGUMENTS)
-env.Append(CPPPATH = env["PYEXTCPPPATH"])
-if os.name == 'nt':
- # NT needs the pythonlib to run any code importing Python.h, including
- # simple code using only typedef and so on, so we need it for configuration
- # checks
- env.AppendUnique(LIBPATH = [get_pythonlib_dir()])
-
-# Check whether we have a mismatch between the set C API VERSION and the
-# actual C API VERSION
-check_api_version(C_API_VERSION)
-
-#=======================
-# Starting Configuration
-#=======================
-config = env.NumpyConfigure(custom_tests = {'CheckBrokenMathlib' : CheckBrokenMathlib,
- 'CheckCBLAS' : CheckCBLAS, 'CheckInline': CheckInline, 'CheckGCC4' : CheckGCC4,
- 'CheckLongDoubleRepresentation': CheckLongDoubleRepresentation},
- config_h = pjoin('config.h'))
-
-# numpyconfig_sym will keep the values of some configuration variables, the one
-# needed for the public numpy API.
-
-# Convention: list of tuples (definition, value). value:
-# - 0: #undef definition
-# - 1: #define definition
-# - string: #define definition value
-numpyconfig_sym = []
-
-#---------------
-# Checking Types
-#---------------
-if not config.CheckHeader("Python.h"):
- errmsg = []
- for line in config.GetLastError():
- errmsg.append("%s " % line)
- print """
-Error: Python.h header cannot be compiled (or cannot be found).
-On linux, check that you have python-dev/python-devel packages. On windows,
-check that you have he platform SDK. You may also use unsupported cflags.
-Configuration error log says: \n\n%s""" % ''.join(errmsg)
- Exit(-1)
-
-st = config.CheckHeader("endian.h")
-if st:
- numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', '#define NPY_HAVE_ENDIAN_H 1'))
-else:
- numpyconfig_sym.append(('DEFINE_NPY_HAVE_ENDIAN_H', ''))
-
-def check_type(type, include = None):
- st = config.CheckTypeSize(type, includes = include)
- type = type.replace(' ', '_')
- if st:
- numpyconfig_sym.append(('SIZEOF_%s' % type.upper(), '%d' % st))
- else:
- numpyconfig_sym.append(('SIZEOF_%s' % type.upper(), 0))
-
-for type in ('short', 'int', 'long'):
- # SIZEOF_LONG defined on darwin
- if type == "long":
- if not config.CheckDeclaration("SIZEOF_LONG", includes="#include <Python.h>"):
- check_type(type)
- else:
- numpyconfig_sym.append(('SIZEOF_LONG', 'SIZEOF_LONG'))
- else:
- check_type(type)
-
-for type in ('float', 'double', 'long double'):
- sz = config.CheckTypeSize(type)
- numpyconfig_sym.append(('SIZEOF_%s' % type2def(type), str(sz)))
-
- # 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)
- sz = config.CheckTypeSize(complex_def)
- numpyconfig_sym.append(('SIZEOF_COMPLEX_%s' % type2def(type), str(sz)))
-
-if sys.platform != 'darwin':
- tp = config.CheckLongDoubleRepresentation()
- config.Define("HAVE_LDOUBLE_%s" % tp, 1,
- "Define for arch-specific long double representation")
-
-for type in ('Py_intptr_t',):
- check_type(type, include = "#include <Python.h>\n")
-
-# We check declaration AND type because that's how distutils does it.
-if config.CheckDeclaration('PY_LONG_LONG', includes = '#include <Python.h>\n'):
- st = config.CheckTypeSize('PY_LONG_LONG',
- includes = '#include <Python.h>\n')
- assert not st == 0
- numpyconfig_sym.append(('DEFINE_NPY_SIZEOF_LONGLONG',
- '#define NPY_SIZEOF_LONGLONG %d' % st))
- numpyconfig_sym.append(('DEFINE_NPY_SIZEOF_PY_LONG_LONG',
- '#define NPY_SIZEOF_PY_LONG_LONG %d' % st))
-else:
- numpyconfig_sym.append(('DEFINE_NPY_SIZEOF_LONGLONG', ''))
- numpyconfig_sym.append(('DEFINE_NPY_SIZEOF_PY_LONG_LONG', ''))
-
-if not config.CheckDeclaration('CHAR_BIT', includes= '#include <Python.h>\n'):
- raise RuntimeError(\
-"""Config wo CHAR_BIT is not supported with scons: please contact the
-maintainer (cdavid)""")
-
-#----------------------
-# Checking signal stuff
-#----------------------
-if is_npy_no_signal():
- numpyconfig_sym.append(('DEFINE_NPY_NO_SIGNAL', '#define NPY_NO_SIGNAL\n'))
- config.Define('__NPY_PRIVATE_NO_SIGNAL',
- comment = "define to 1 to disable SMP support ")
-else:
- numpyconfig_sym.append(('DEFINE_NPY_NO_SIGNAL', ''))
-
-#---------------------
-# Checking SMP option
-#---------------------
-if define_no_smp():
- nosmp = 1
-else:
- nosmp = 0
-numpyconfig_sym.append(('NPY_NO_SMP', nosmp))
-
-#----------------------------------------------
-# Check whether we can use C99 printing formats
-#----------------------------------------------
-if config.CheckDeclaration(('PRIdPTR'), includes = '#include <inttypes.h>'):
- numpyconfig_sym.append(('DEFINE_NPY_USE_C99_FORMATS', '#define NPY_USE_C99_FORMATS 1'))
-else:
- numpyconfig_sym.append(('DEFINE_NPY_USE_C99_FORMATS', ''))
-
-#----------------------
-# Checking the mathlib
-#----------------------
-mlibs = [[], ['m'], ['cpml']]
-mathlib = os.environ.get('MATHLIB')
-if mathlib:
- mlibs.insert(0, mathlib)
-
-mlib = check_mlibs(config, mlibs)
-
-# XXX: this is ugly: mathlib has nothing to do in a public header file
-numpyconfig_sym.append(('MATHLIB', ','.join(mlib)))
-
-#----------------------------------
-# Checking the math funcs available
-#----------------------------------
-# Function to check:
-mfuncs = ('expl', 'expf', 'log1p', 'expm1', 'asinh', 'atanhf', 'atanhl',
- 'rint', 'trunc')
-
-# Set value to 1 for each defined function (in math lib)
-mfuncs_defined = dict([(f, 0) for f in mfuncs])
-
-# Check for mandatory funcs: we barf if a single one of those is not there
-if not config.CheckFuncsAtOnce(MANDATORY_FUNCS):
- 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
-#
-def check_funcs(funcs):
- # Use check_funcs_once first, and if it does not work, test func per
- # func. Return success only if all the functions are available
- st = config.CheckFuncsAtOnce(funcs)
- if not st:
- # Global check failed, check func per func
- for f in funcs:
- st = config.CheckFunc(f, language = 'C')
-
-for f in OPTIONAL_STDFUNCS_MAYBE:
- if config.CheckDeclaration(fname2def(f),
- includes="#include <Python.h>\n#include <math.h>"):
- OPTIONAL_STDFUNCS.remove(f)
-check_funcs(OPTIONAL_STDFUNCS)
-
-# C99 functions: float and long double versions
-if not BYPASS_SINGLE_EXTENDED:
- check_funcs(C99_FUNCS_SINGLE)
- check_funcs(C99_FUNCS_EXTENDED)
-
-# Normally, isnan and isinf are macro (C99), but some platforms only have
-# func, or both func and macro version. Check for macro only, and define
-# replacement ones if not found.
-# Note: including Python.h is necessary because it modifies some math.h
-# definitions
-for f in ["isnan", "isinf", "signbit", "isfinite"]:
- includes = """\
-#include <Python.h>
-#include <math.h>
-"""
- st = config.CheckDeclaration(f, includes=includes)
- if st:
- numpyconfig_sym.append(('DEFINE_NPY_HAVE_DECL_%s' % f.upper(),
- '#define NPY_HAVE_DECL_%s' % f.upper()))
- else:
- numpyconfig_sym.append(('DEFINE_NPY_HAVE_DECL_%s' % f.upper(), ''))
-
-inline = config.CheckInline()
-config.Define('inline', inline)
-
-
-if ENABLE_SEPARATE_COMPILATION:
- config.Define("ENABLE_SEPARATE_COMPILATION", 1)
- numpyconfig_sym.append(('DEFINE_NPY_ENABLE_SEPARATE_COMPILATION', '#define NPY_ENABLE_SEPARATE_COMPILATION 1'))
-else:
- numpyconfig_sym.append(('DEFINE_NPY_ENABLE_SEPARATE_COMPILATION', ''))
-
-#-----------------------------
-# Checking for complex support
-#-----------------------------
-if config.CheckHeader('complex.h'):
- numpyconfig_sym.append(('DEFINE_NPY_USE_C99_COMPLEX', '#define NPY_USE_C99_COMPLEX 1'))
-
- for t in C99_COMPLEX_TYPES:
- st = config.CheckType(t, includes='#include <complex.h>')
- if st:
- numpyconfig_sym.append(('DEFINE_NPY_HAVE_%s' % type2def(t),
- '#define NPY_HAVE_%s' % type2def(t)))
- else:
- numpyconfig_sym.append(('DEFINE_NPY_HAVE_%s' % type2def(t), ''))
-
- def check_prec(prec):
- flist = [f + prec for f in C99_COMPLEX_FUNCS]
- st = config.CheckFuncsAtOnce(flist)
- if not st:
- # Global check failed, check func per func
- for f in flist:
- config.CheckFunc(f, language='C')
-
- check_prec('')
- check_prec('f')
- check_prec('l')
-
-else:
- numpyconfig_sym.append(('DEFINE_NPY_USE_C99_COMPLEX', ''))
- for t in C99_COMPLEX_TYPES:
- numpyconfig_sym.append(('DEFINE_NPY_HAVE_%s' % type2def(t), ''))
-
-def visibility_define():
- if config.CheckGCC4():
- return '__attribute__((visibility("hidden")))'
- else:
- return ''
-
-numpyconfig_sym.append(('VISIBILITY_HIDDEN', visibility_define()))
-
-# Add the C API/ABI versions
-numpyconfig_sym.append(('NPY_ABI_VERSION', '0x%.8X' % C_ABI_VERSION))
-numpyconfig_sym.append(('NPY_API_VERSION', '0x%.8X' % C_API_VERSION))
-
-# Check whether we need our own wide character support
-if not config.CheckDeclaration('Py_UNICODE_WIDE', includes='#include <Python.h>'):
- PYTHON_HAS_UNICODE_WIDE = True
-else:
- PYTHON_HAS_UNICODE_WIDE = False
-
-#-------------------------------------------------------
-# Define the function PyOS_ascii_strod if not available
-#-------------------------------------------------------
-if not config.CheckDeclaration('PyOS_ascii_strtod',
- includes = "#include <Python.h>"):
- if config.CheckFunc('strtod'):
- config.Define('PyOS_ascii_strtod', 'strtod',
- "Define to a function to use as a replacement for "\
- "PyOS_ascii_strtod if not available in python header")
-
-#------------------------------------
-# DISTUTILS Hack on AMD64 on windows
-#------------------------------------
-# XXX: this is ugly
-if sys.platform=='win32' or os.name=='nt':
- from distutils.msvccompiler import get_build_architecture
- a = get_build_architecture()
- print 'BUILD_ARCHITECTURE: %r, os.name=%r, sys.platform=%r' % \
- (a, os.name, sys.platform)
- if a == 'AMD64':
- distutils_use_sdk = 1
- config.Define('DISTUTILS_USE_SDK', distutils_use_sdk,
- "define to 1 to disable SMP support ")
-
- if a == "Intel":
- config.Define('FORCE_NO_LONG_DOUBLE_FORMATTING', 1,
- "define to 1 to force long double format string to the" \
- " same as double (Lg -> g)")
-#--------------
-# Checking Blas
-#--------------
-if config.CheckCBLAS():
- build_blasdot = 1
-else:
- build_blasdot = 0
-
-config.config_h_text += """
-#ifndef _NPY_NPY_CONFIG_H_
-#error config.h should never be included directly, include npy_config.h instead
-#endif
-"""
-
-config.Finish()
-write_info(env)
-
-#==========
-# Build
-#==========
-
-# List of headers which need to be "installed " into the build directory for
-# proper in-place build support
-generated_headers = []
-
-#---------------------------------------
-# Generate the public configuration file
-#---------------------------------------
-config_dict = {}
-# XXX: this is ugly, make the API for config.h and numpyconfig.h similar
-for key, value in numpyconfig_sym:
- config_dict['@%s@' % key] = str(value)
-env['SUBST_DICT'] = config_dict
-
-include_dir = 'include/numpy'
-target = env.SubstInFile(pjoin(include_dir, '_numpyconfig.h'),
- pjoin(include_dir, '_numpyconfig.h.in'))
-generated_headers.append(target[0])
-
-env['CONFIG_H_GEN'] = numpyconfig_sym
-
-#---------------------------
-# Builder for generated code
-#---------------------------
-env.Append(BUILDERS = {'GenerateMultiarrayApi' : array_api_gen_bld,
- 'GenerateUfuncApi' : ufunc_api_gen_bld,
- 'GenerateFromTemplate' : template_bld,
- 'GenerateUmath' : umath_bld})
-
-#------------------------
-# Generate generated code
-#------------------------
-scalartypes_src = env.GenerateFromTemplate(
- pjoin('src', 'multiarray', 'scalartypes.c.src'))
-umath_funcs_src = env.GenerateFromTemplate(pjoin('src', 'umath', 'funcs.inc.src'))
-umath_loops_src = env.GenerateFromTemplate(pjoin('src', 'umath', 'loops.c.src'))
-arraytypes_src = env.GenerateFromTemplate(
- pjoin('src', 'multiarray', 'arraytypes.c.src'))
-nditer_src = env.GenerateFromTemplate(
- pjoin('src', 'multiarray', 'nditer_templ.c.src'))
-lowlevel_strided_loops_src = env.GenerateFromTemplate(
- pjoin('src', 'multiarray', 'lowlevel_strided_loops.c.src'))
-einsum_src = env.GenerateFromTemplate(pjoin('src', 'multiarray', 'einsum.c.src'))
-umath_tests_src = env.GenerateFromTemplate(pjoin('src', 'umath',
- 'umath_tests.c.src'))
-multiarray_tests_src = env.GenerateFromTemplate(pjoin('src', 'multiarray',
- 'multiarray_tests.c.src'))
-scalarmathmodule_src = env.GenerateFromTemplate(
- pjoin('src', 'scalarmathmodule.c.src'))
-
-umath = env.GenerateUmath('__umath_generated',
- pjoin('code_generators', 'generate_umath.py'))
-
-multiarray_api = env.GenerateMultiarrayApi('include/numpy/multiarray_api',
- [SCons.Node.Python.Value(d) for d in multiarray_api_dict])
-generated_headers.append(multiarray_api[0])
-
-ufunc_api = env.GenerateUfuncApi('include/numpy/ufunc_api',
- [SCons.Node.Python.Value(d) for d in ufunc_api_dict])
-generated_headers.append(ufunc_api[0])
-
-# include/numpy is added for compatibility reasons with distutils: this is
-# needed for __multiarray_api.c and __ufunc_api.c included from multiarray and
-# ufunc.
-env.Prepend(CPPPATH = ['src/private', 'include', '.', 'include/numpy'])
-
-# npymath core lib
-npymath_src = [env.GenerateFromTemplate(pjoin('src', 'npymath', 'npy_math.c.src')),
- env.GenerateFromTemplate(pjoin('src', 'npymath', 'npy_math_complex.c.src')),
- env.GenerateFromTemplate(pjoin('src', 'npymath', 'ieee754.c.src')),
- pjoin('src', 'npymath', 'halffloat.c')]
-env.DistutilsInstalledStaticExtLibrary("npymath", npymath_src, install_dir='lib')
-env.Prepend(LIBS=["npymath"])
-env.Prepend(LIBPATH=["."])
-
-subst_dict = {'@prefix@': '$distutils_install_prefix',
- '@pkgname@': 'numpy.core', '@sep@': os.path.sep}
-npymath_ini = env.SubstInFile(pjoin('lib', 'npy-pkg-config', 'npymath.ini'),
- 'npymath.ini.in', SUBST_DICT=subst_dict)
-
-subst_dict = {'@posix_mathlib@': " ".join(['-l%s' % l for l in mlib]),
- '@msvc_mathlib@': " ".join(['%s.mlib' % l for l in mlib])}
-mlib_ini = env.SubstInFile(pjoin('lib', 'npy-pkg-config', 'mlib.ini'),
- 'mlib.ini.in', SUBST_DICT=subst_dict)
-env.Install('$distutils_installdir/lib/npy-pkg-config', mlib_ini)
-env.Install('$distutils_installdir/lib/npy-pkg-config', npymath_ini)
-
-# npysort core lib
-npysort_src = [env.GenerateFromTemplate(pjoin('src', 'npysort', 'quicksort.c.src')),
- env.GenerateFromTemplate(pjoin('src', 'npysort', 'mergesort.c.src')),
- env.GenerateFromTemplate(pjoin('src', 'npysort', 'heapsort.c.src'))]
-env.StaticExtLibrary("npysort", npysort_src)
-env.Prepend(LIBS=["npysort"])
-env.Prepend(LIBPATH=["."])
-
-#-----------------
-# Build multiarray
-#-----------------
-if ENABLE_SEPARATE_COMPILATION:
- multiarray_src = [pjoin('src', 'multiarray', 'multiarraymodule.c'),
- pjoin('src', 'multiarray', 'hashdescr.c'),
- pjoin('src', 'multiarray', 'arrayobject.c'),
- pjoin('src', 'multiarray', 'array_assign.c'),
- pjoin('src', 'multiarray', 'array_assign_scalar.c'),
- pjoin('src', 'multiarray', 'array_assign_array.c'),
- pjoin('src', 'multiarray', 'datetime.c'),
- pjoin('src', 'multiarray', 'datetime_strings.c'),
- pjoin('src', 'multiarray', 'datetime_busday.c'),
- pjoin('src', 'multiarray', 'datetime_busdaycal.c'),
- pjoin('src', 'multiarray', 'numpyos.c'),
- pjoin('src', 'multiarray', 'flagsobject.c'),
- pjoin('src', 'multiarray', 'descriptor.c'),
- pjoin('src', 'multiarray', 'iterators.c'),
- pjoin('src', 'multiarray', 'mapping.c'),
- pjoin('src', 'multiarray', 'number.c'),
- pjoin('src', 'multiarray', 'getset.c'),
- pjoin('src', 'multiarray', 'sequence.c'),
- pjoin('src', 'multiarray', 'methods.c'),
- pjoin('src', 'multiarray', 'ctors.c'),
- pjoin('src', 'multiarray', 'convert_datatype.c'),
- pjoin('src', 'multiarray', 'convert.c'),
- pjoin('src', 'multiarray', 'shape.c'),
- pjoin('src', 'multiarray', 'item_selection.c'),
- pjoin('src', 'multiarray', 'calculation.c'),
- pjoin('src', 'multiarray', 'common.c'),
- pjoin('src', 'multiarray', 'refcount.c'),
- pjoin('src', 'multiarray', 'conversion_utils.c'),
- pjoin('src', 'multiarray', 'usertypes.c'),
- pjoin('src', 'multiarray', 'buffer.c'),
- pjoin('src', 'multiarray', 'numpymemoryview.c'),
- pjoin('src', 'multiarray', 'scalarapi.c'),
- pjoin('src', 'multiarray', 'nditer_api.c'),
- pjoin('src', 'multiarray', 'nditer_constr.c'),
- pjoin('src', 'multiarray', 'nditer_pywrap.c'),
- pjoin('src', 'multiarray', 'dtype_transfer.c'),
- pjoin("src", "multiarray", "ucsnarrow.c")]
- multiarray_src.extend(arraytypes_src)
- multiarray_src.extend(scalartypes_src)
- multiarray_src.extend(lowlevel_strided_loops_src)
- multiarray_src.extend(nditer_src)
- multiarray_src.extend(einsum_src)
-else:
- multiarray_src = [pjoin('src', 'multiarray', 'multiarraymodule_onefile.c')]
-multiarray = env.DistutilsPythonExtension('multiarray', source = multiarray_src)
-env.DistutilsPythonExtension('multiarray_tests', source=multiarray_tests_src)
-
-#-------------------
-# Build umath module
-#-------------------
-if ENABLE_SEPARATE_COMPILATION:
- umathmodule_src.extend([pjoin('src', 'umath', 'ufunc_object.c')])
- umathmodule_src.extend([pjoin('src', 'umath', 'ufunc_type_resolution.c')])
- umathmodule_src.extend([pjoin('src', 'multiarray', 'reduction.c')]),
- umathmodule_src.extend(umath_loops_src)
-else:
- umathmodule_src = [pjoin('src', 'umath', 'umathmodule_onefile.c')]
-umathmodule = env.DistutilsPythonExtension('umath', source = umathmodule_src)
-
-#------------------------
-# Build scalarmath module
-#------------------------
-scalarmathmodule = env.DistutilsPythonExtension('scalarmath',
- source = scalarmathmodule_src)
-
-#------------------------
-# Build scalarmath module
-#------------------------
-umath_tests = env.DistutilsPythonExtension('umath_tests',
- source=umath_tests_src)
-
-#----------------------
-# Build _dotblas module
-#----------------------
-if build_blasdot:
- dotblas_src = [pjoin('blasdot', i) for i in ['_dotblas.c']]
- # because _dotblas does #include CBLAS_HEADER instead of #include
- # "cblas.h", scons does not detect the dependency
- # XXX: PythonExtension builder does not take the Depends on extension into
- # account for some reason, so we first build the object, with forced
- # dependency, and then builds the extension. This is more likely a bug in
- # our PythonExtension builder, but I cannot see how to solve it.
- dotblas_o = env.PythonObject('_dotblas', source = dotblas_src)
- env.Depends(dotblas_o, pjoin("blasdot", "cblas.h"))
- dotblas = env.DistutilsPythonExtension('_dotblas', dotblas_o)
-
-# "Install" the header in the build directory, so that in-place build works
-for h in generated_headers:
- env.Install(pjoin('$distutils_installdir', include_dir), h)
diff --git a/numpy/core/SConstruct b/numpy/core/SConstruct
deleted file mode 100644
index a377d8391..000000000
--- a/numpy/core/SConstruct
+++ /dev/null
@@ -1,2 +0,0 @@
-from numscons import GetInitEnvironment
-GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
diff --git a/numpy/core/bscript b/numpy/core/bscript
index d31faa186..5c5c6e4c1 100644
--- a/numpy/core/bscript
+++ b/numpy/core/bscript
@@ -432,6 +432,9 @@ def pre_build(context):
if ENABLE_SEPARATE_COMPILATION:
sources = [pjoin('src', 'multiarray', 'arrayobject.c'),
pjoin('src', 'multiarray', 'arraytypes.c.src'),
+ pjoin('src', 'multiarray', 'array_assign.c'),
+ pjoin('src', 'multiarray', 'array_assign_array.c'),
+ pjoin('src', 'multiarray', 'array_assign_scalar.c'),
pjoin('src', 'multiarray', 'buffer.c'),
pjoin('src', 'multiarray', 'calculation.c'),
pjoin('src', 'multiarray', 'common.c'),
@@ -440,6 +443,9 @@ def pre_build(context):
pjoin('src', 'multiarray', 'convert_datatype.c'),
pjoin('src', 'multiarray', 'ctors.c'),
pjoin('src', 'multiarray', 'datetime.c'),
+ pjoin('src', 'multiarray', 'datetime_busday.c'),
+ pjoin('src', 'multiarray', 'datetime_busdaycal.c'),
+ pjoin('src', 'multiarray', 'datetime_strings.c'),
pjoin('src', 'multiarray', 'descriptor.c'),
pjoin('src', 'multiarray', 'dtype_transfer.c'),
pjoin('src', 'multiarray', 'einsum.c.src'),
@@ -452,8 +458,10 @@ def pre_build(context):
pjoin('src', 'multiarray', 'mapping.c'),
pjoin('src', 'multiarray', 'methods.c'),
pjoin('src', 'multiarray', 'multiarraymodule.c'),
- pjoin('src', 'multiarray', 'nditer_pywrap.c'),
pjoin('src', 'multiarray', 'nditer_templ.c.src'),
+ pjoin('src', 'multiarray', 'nditer_api.c'),
+ pjoin('src', 'multiarray', 'nditer_constr.c'),
+ pjoin('src', 'multiarray', 'nditer_pywrap.c'),
pjoin('src', 'multiarray', 'number.c'),
pjoin('src', 'multiarray', 'numpymemoryview.c'),
pjoin('src', 'multiarray', 'numpyos.c'),
@@ -489,9 +497,13 @@ def pre_build(context):
includes = ["src/umath", "src/private"]
if ENABLE_SEPARATE_COMPILATION:
- sources = [pjoin("src", "umath", "umathmodule.c"),
- pjoin("src", "umath", "ufunc_object.c"),
- pjoin("src", "umath", "loops.c.src")]
+ sources = [
+ pjoin("src", "umath", "loops.c.src"),
+ pjoin('src', 'umath', 'reduction.c'),
+ pjoin('src', 'umath', 'ufunc_object.c'),
+ pjoin('src', 'umath', 'ufunc_type_resolution.c'),
+ pjoin("src", "umath", "umathmodule.c"),
+ ]
else:
sources = extension.sources
return context.default_builder(extension,
diff --git a/numpy/core/code_generators/ufunc_docstrings.py b/numpy/core/code_generators/ufunc_docstrings.py
index 678303a2e..b8f11e543 100644
--- a/numpy/core/code_generators/ufunc_docstrings.py
+++ b/numpy/core/code_generators/ufunc_docstrings.py
@@ -1099,7 +1099,7 @@ add_newdoc('numpy.core.umath', 'exp2',
See Also
--------
- exp : calculate x**p.
+ power
Notes
-----
diff --git a/numpy/core/include/numpy/npy_cpu.h b/numpy/core/include/numpy/npy_cpu.h
index 8a2978806..9707a7adf 100644
--- a/numpy/core/include/numpy/npy_cpu.h
+++ b/numpy/core/include/numpy/npy_cpu.h
@@ -66,6 +66,8 @@
#define NPY_CPU_MIPSEL
#elif defined(__MIPSEB__)
#define NPY_CPU_MIPSEB
+#elif defined(__aarch64__)
+ #define NPY_CPU_AARCH64
#else
#error Unknown CPU, please report this to numpy maintainers with \
information about your platform (OS, CPU and compiler)
diff --git a/numpy/core/include/numpy/npy_endian.h b/numpy/core/include/numpy/npy_endian.h
index aa5ed8b2b..4e3349ffe 100644
--- a/numpy/core/include/numpy/npy_endian.h
+++ b/numpy/core/include/numpy/npy_endian.h
@@ -25,6 +25,7 @@
|| defined(NPY_CPU_IA64) \
|| defined(NPY_CPU_ALPHA) \
|| defined(NPY_CPU_ARMEL) \
+ || defined(NPY_CPU_AARCH64) \
|| defined(NPY_CPU_SH_LE) \
|| defined(NPY_CPU_MIPSEL)
#define NPY_BYTE_ORDER NPY_LITTLE_ENDIAN
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py
index 0d0babbac..521001575 100644
--- a/numpy/core/numeric.py
+++ b/numpy/core/numeric.py
@@ -67,8 +67,6 @@ def zeros_like(a, dtype=None, order='K', subok=True):
"""
Return an array of zeros with the same shape and type as a given array.
- With default parameters, is equivalent to ``a.copy().fill(0)``.
-
Parameters
----------
a : array_like
@@ -155,8 +153,6 @@ def ones_like(a, dtype=None, order='K', subok=True):
"""
Return an array of ones with the same shape and type as a given array.
- With default parameters, is equivalent to ``a.copy().fill(1)``.
-
Parameters
----------
a : array_like
diff --git a/numpy/core/scons_support.py b/numpy/core/scons_support.py
deleted file mode 100644
index 048f85db6..000000000
--- a/numpy/core/scons_support.py
+++ /dev/null
@@ -1,272 +0,0 @@
-#! Last Change: Sun Apr 26 05:00 PM 2009 J
-
-"""Code to support special facilities to scons which are only useful for
-numpy.core, hence not put into numpy.distutils.scons"""
-
-import sys
-import os
-
-from os.path import join as pjoin, dirname as pdirname, basename as pbasename
-from copy import deepcopy
-
-import code_generators
-from code_generators.generate_numpy_api import \
- do_generate_api as nowrap_do_generate_numpy_api
-from code_generators.generate_ufunc_api import \
- do_generate_api as nowrap_do_generate_ufunc_api
-from setup_common import check_api_version as _check_api_version
-from setup_common import \
- LONG_DOUBLE_REPRESENTATION_SRC, pyod, long_double_representation
-
-from numscons.numdist import process_c_str as process_str
-
-import SCons.Node
-import SCons
-from SCons.Builder import Builder
-from SCons.Action import Action
-
-def check_api_version(apiversion):
- return _check_api_version(apiversion, pdirname(code_generators.__file__))
-
-def split_ext(string):
- sp = string.rsplit( '.', 1)
- if len(sp) == 1:
- return (sp[0], '')
- else:
- return sp
-#------------------------------------
-# Ufunc and multiarray API generators
-#------------------------------------
-def do_generate_numpy_api(target, source, env):
- nowrap_do_generate_numpy_api([str(i) for i in target],
- [s.value for s in source])
- return 0
-
-def do_generate_ufunc_api(target, source, env):
- nowrap_do_generate_ufunc_api([str(i) for i in target],
- [s.value for s in source])
- return 0
-
-def generate_api_emitter(target, source, env):
- """Returns the list of targets generated by the code generator for array
- api and ufunc api."""
- base, ext = split_ext(str(target[0]))
- dir = pdirname(base)
- ba = pbasename(base)
- h = pjoin(dir, '__' + ba + '.h')
- c = pjoin(dir, '__' + ba + '.c')
- txt = base + '.txt'
- #print h, c, txt
- t = [h, c, txt]
- return (t, source)
-
-#-------------------------
-# From template generators
-#-------------------------
-# XXX: this is general and can be used outside numpy.core.
-def do_generate_from_template(targetfile, sourcefile, env):
- t = open(targetfile, 'w')
- s = open(sourcefile, 'r')
- allstr = s.read()
- s.close()
- writestr = process_str(allstr)
- t.write(writestr)
- t.close()
- return 0
-
-def generate_from_template(target, source, env):
- for t, s in zip(target, source):
- do_generate_from_template(str(t), str(s), env)
-
-def generate_from_template_emitter(target, source, env):
- base, ext = split_ext(pbasename(str(source[0])))
- t = pjoin(pdirname(str(target[0])), base)
- return ([t], source)
-
-#----------------
-# umath generator
-#----------------
-def do_generate_umath(targetfile, sourcefile, env):
- t = open(targetfile, 'w')
- from code_generators import generate_umath
- code = generate_umath.make_code(generate_umath.defdict, generate_umath.__file__)
- t.write(code)
- t.close()
-
-def generate_umath(target, source, env):
- for t, s in zip(target, source):
- do_generate_umath(str(t), str(s), env)
-
-def generate_umath_emitter(target, source, env):
- t = str(target[0]) + '.c'
- return ([t], source)
-
-#-----------------------------------------
-# Other functions related to configuration
-#-----------------------------------------
-def CheckGCC4(context):
- src = """
-int
-main()
-{
-#if !(defined __GNUC__ && (__GNUC__ >= 4))
-die from an horrible death
-#endif
-}
-"""
-
- context.Message("Checking if compiled with gcc 4.x or above ... ")
- st = context.TryCompile(src, '.c')
-
- if st:
- context.Result(' yes')
- else:
- context.Result(' no')
- return st == 1
-
-def CheckBrokenMathlib(context, mathlib):
- src = """
-/* check whether libm is broken */
-#include <math.h>
-int main(int argc, char *argv[])
-{
- return exp(-720.) > 1.0; /* typically an IEEE denormal */
-}
-"""
-
- try:
- oldLIBS = deepcopy(context.env['LIBS'])
- except:
- oldLIBS = []
-
- try:
- context.Message("Checking if math lib %s is usable for numpy ... " % mathlib)
- context.env.AppendUnique(LIBS = mathlib)
- st = context.TryRun(src, '.c')
- finally:
- context.env['LIBS'] = oldLIBS
-
- if st[0]:
- context.Result(' Yes !')
- else:
- context.Result(' No !')
- return st[0]
-
-def check_mlib(config, mlib):
- """Return 1 if mlib is available and usable by numpy, 0 otherwise.
-
- mlib can be a string (one library), or a list of libraries."""
- # Check the libraries in mlib are linkable
- if len(mlib) > 0:
- # XXX: put an autoadd argument to 0 here and add an autoadd argument to
- # CheckBroekenMathlib (otherwise we may add bogus libraries, the ones
- # which do not path the CheckBrokenMathlib test).
- st = config.CheckLib(mlib)
- if not st:
- return 0
- # Check the mlib is usable by numpy
- return config.CheckBrokenMathlib(mlib)
-
-def check_mlibs(config, mlibs):
- for mlib in mlibs:
- if check_mlib(config, mlib):
- return mlib
-
- # No mlib was found.
- raise SCons.Errors.UserError("No usable mathlib was found: chose another "\
- "one using the MATHLIB env variable, eg "\
- "'MATHLIB=m python setup.py build'")
-
-
-def is_npy_no_signal():
- """Return True if the NPY_NO_SIGNAL symbol must be defined in configuration
- header."""
- return sys.platform == 'win32'
-
-def define_no_smp():
- """Returns True if we should define NPY_NOSMP, False otherwise."""
- #--------------------------------
- # Checking SMP and thread options
- #--------------------------------
- # Python 2.3 causes a segfault when
- # trying to re-acquire the thread-state
- # which is done in error-handling
- # ufunc code. NPY_ALLOW_C_API and friends
- # cause the segfault. So, we disable threading
- # for now.
- if sys.version[:5] < '2.4.2':
- nosmp = 1
- else:
- # 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.
- try:
- nosmp = os.environ['NPY_NOSMP']
- nosmp = 1
- except KeyError:
- nosmp = 0
- return nosmp == 1
-
-# Inline check
-def CheckInline(context):
- context.Message("Checking for inline keyword... ")
- body = """
-#ifndef __cplusplus
-static %(inline)s int static_func (void)
-{
- return 0;
-}
-%(inline)s int nostatic_func (void)
-{
- return 0;
-}
-#endif"""
- inline = None
- for kw in ['inline', '__inline__', '__inline']:
- st = context.TryCompile(body % {'inline': kw}, '.c')
- if st:
- inline = kw
- break
-
- if inline:
- context.Result(inline)
- else:
- context.Result(0)
- return inline
-
-def CheckLongDoubleRepresentation(context):
- msg = {
- 'INTEL_EXTENDED_12_BYTES_LE': "Intel extended, little endian",
- 'INTEL_EXTENDED_16_BYTES_LE': "Intel extended, little endian",
- 'IEEE_QUAD_BE': "IEEE Quad precision, big endian",
- 'IEEE_QUAD_LE': "IEEE Quad precision, little endian",
- 'IEEE_DOUBLE_LE': "IEEE Double precision, little endian",
- 'IEEE_DOUBLE_BE': "IEEE Double precision, big endian"
- }
-
- context.Message("Checking for long double representation... ")
- body = LONG_DOUBLE_REPRESENTATION_SRC % {'type': 'long double'}
- st = context.TryCompile(body, '.c')
- if st:
- obj = str(context.sconf.lastTarget)
- tp = long_double_representation(pyod(obj))
- context.Result(msg[tp])
- return tp
- if not st:
- context.Result(0)
-
-array_api_gen_bld = Builder(action = Action(do_generate_numpy_api, '$ARRAYPIGENCOMSTR'),
- emitter = generate_api_emitter)
-
-
-ufunc_api_gen_bld = Builder(action = Action(do_generate_ufunc_api, '$UFUNCAPIGENCOMSTR'),
- emitter = generate_api_emitter)
-
-template_bld = Builder(action = Action(generate_from_template, '$TEMPLATECOMSTR'),
- emitter = generate_from_template_emitter)
-
-umath_bld = Builder(action = Action(generate_umath, '$UMATHCOMSTR'),
- emitter = generate_umath_emitter)
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
index 83589695d..1674333ca 100644
--- a/numpy/core/setup_common.py
+++ b/numpy/core/setup_common.py
@@ -1,4 +1,4 @@
-# Code shared by distutils and scons builds
+# Code common to build tools
import sys
from os.path import join
import warnings
diff --git a/numpy/core/setupscons.py b/numpy/core/setupscons.py
deleted file mode 100644
index 4d329fded..000000000
--- a/numpy/core/setupscons.py
+++ /dev/null
@@ -1,111 +0,0 @@
-import os
-import sys
-import glob
-from os.path import join, basename
-
-from numpy.distutils import log
-
-from numscons import get_scons_build_dir
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration,dot_join
- from numpy.distutils.command.scons import get_scons_pkg_build_dir
- from numpy.distutils.system_info import get_info, default_lib_dirs
-
- config = Configuration('core',parent_package,top_path)
- local_dir = config.local_path
-
- header_dir = 'include/numpy' # this is relative to config.path_in_package
-
- config.add_subpackage('code_generators')
-
- # List of files to register to numpy.distutils
- dot_blas_src = [join('blasdot', '_dotblas.c'),
- join('blasdot', 'cblas.h')]
- api_definition = [join('code_generators', 'numpy_api_order.txt'),
- join('code_generators', 'ufunc_api_order.txt')]
- core_src = [join('src', basename(i)) for i in glob.glob(join(local_dir,
- 'src',
- '*.c'))]
- core_src += [join('src', basename(i)) for i in glob.glob(join(local_dir,
- 'src',
- '*.src'))]
-
- source_files = dot_blas_src + api_definition + core_src + \
- [join(header_dir, 'numpyconfig.h.in')]
-
- # Add generated files to distutils...
- def add_config_header():
- scons_build_dir = get_scons_build_dir()
- # XXX: I really have to think about how to communicate path info
- # between scons and distutils, and set the options at one single
- # location.
- target = join(get_scons_pkg_build_dir(config.name), 'config.h')
- incl_dir = os.path.dirname(target)
- if incl_dir not in config.numpy_include_dirs:
- config.numpy_include_dirs.append(incl_dir)
-
- def add_numpyconfig_header():
- scons_build_dir = get_scons_build_dir()
- # XXX: I really have to think about how to communicate path info
- # between scons and distutils, and set the options at one single
- # location.
- target = join(get_scons_pkg_build_dir(config.name),
- 'include/numpy/numpyconfig.h')
- incl_dir = os.path.dirname(target)
- if incl_dir not in config.numpy_include_dirs:
- config.numpy_include_dirs.append(incl_dir)
- config.add_data_files((header_dir, target))
-
- def add_array_api():
- scons_build_dir = get_scons_build_dir()
- # XXX: I really have to think about how to communicate path info
- # between scons and distutils, and set the options at one single
- # location.
- h_file = join(get_scons_pkg_build_dir(config.name),
- 'include/numpy/__multiarray_api.h')
- t_file = join(get_scons_pkg_build_dir(config.name),
- 'include/numpy/multiarray_api.txt')
- config.add_data_files((header_dir, h_file),
- (header_dir, t_file))
-
- def add_ufunc_api():
- scons_build_dir = get_scons_build_dir()
- # XXX: I really have to think about how to communicate path info
- # between scons and distutils, and set the options at one single
- # location.
- h_file = join(get_scons_pkg_build_dir(config.name),
- 'include/numpy/__ufunc_api.h')
- t_file = join(get_scons_pkg_build_dir(config.name),
- 'include/numpy/ufunc_api.txt')
- config.add_data_files((header_dir, h_file),
- (header_dir, t_file))
-
- def add_generated_files(*args, **kw):
- add_config_header()
- add_numpyconfig_header()
- add_array_api()
- add_ufunc_api()
-
- config.add_sconscript('SConstruct',
- post_hook = add_generated_files,
- source_files = source_files)
- config.add_scons_installed_library('npymath', 'lib')
-
- config.add_data_files('include/numpy/*.h')
- config.add_include_dirs('src')
-
- config.numpy_include_dirs.extend(config.paths('include'))
-
- # Don't install fenv unless we need them.
- if sys.platform == 'cygwin':
- config.add_data_dir('include/numpy/fenv')
-
- config.add_data_dir('tests')
- config.make_svn_version_py()
-
- return config
-
-if __name__=='__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/core/src/multiarray/common.c b/numpy/core/src/multiarray/common.c
index 64ca352a5..f27de491f 100644
--- a/numpy/core/src/multiarray/common.c
+++ b/numpy/core/src/multiarray/common.c
@@ -485,9 +485,11 @@ promote_types:
/* Set 'out_dtype' if it's NULL */
if (*out_dtype == NULL) {
if (!string_type && dtype->type_num == NPY_STRING) {
+ Py_DECREF(dtype);
return RETRY_WITH_STRING;
}
if (!string_type && dtype->type_num == NPY_UNICODE) {
+ Py_DECREF(dtype);
return RETRY_WITH_UNICODE;
}
*out_dtype = dtype;
@@ -500,17 +502,19 @@ promote_types:
if (res_dtype == NULL) {
return -1;
}
- Py_DECREF(*out_dtype);
if (!string_type &&
res_dtype->type_num == NPY_UNICODE &&
(*out_dtype)->type_num != NPY_UNICODE) {
+ Py_DECREF(res_dtype);
return RETRY_WITH_UNICODE;
}
if (!string_type &&
res_dtype->type_num == NPY_STRING &&
(*out_dtype)->type_num != NPY_STRING) {
+ Py_DECREF(res_dtype);
return RETRY_WITH_STRING;
}
+ Py_DECREF(*out_dtype);
*out_dtype = res_dtype;
return 0;
}
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c
index 980d73a32..bdf2e6e2b 100644
--- a/numpy/core/src/multiarray/ctors.c
+++ b/numpy/core/src/multiarray/ctors.c
@@ -2075,11 +2075,6 @@ PyArray_FromInterface(PyObject *origin)
/* Case for data access through pointer */
if (attr && PyTuple_Check(attr)) {
PyObject *dataptr;
- if (n == 0) {
- PyErr_SetString(PyExc_ValueError,
- "__array_interface__ shape must be at least size 1");
- goto fail;
- }
if (PyTuple_GET_SIZE(attr) != 2) {
PyErr_SetString(PyExc_TypeError,
"__array_interface__ data must be a 2-tuple with "
diff --git a/numpy/core/src/multiarray/iterators.c b/numpy/core/src/multiarray/iterators.c
index faba1ba62..ce2ef4659 100644
--- a/numpy/core/src/multiarray/iterators.c
+++ b/numpy/core/src/multiarray/iterators.c
@@ -1082,7 +1082,8 @@ iter_ass_subscript(PyArrayIterObject *self, PyObject *ind, PyObject *val)
skip:
Py_INCREF(type);
- arrval = (PyArrayObject *)PyArray_FromAny(val, type, 0, 0, 0, NULL);
+ arrval = (PyArrayObject *)PyArray_FromAny(val, type, 0, 0,
+ NPY_ARRAY_FORCECAST, NULL);
if (arrval == NULL) {
return -1;
}
diff --git a/numpy/core/src/multiarray/mapping.c b/numpy/core/src/multiarray/mapping.c
index 001ccba08..6cc00edab 100644
--- a/numpy/core/src/multiarray/mapping.c
+++ b/numpy/core/src/multiarray/mapping.c
@@ -1306,9 +1306,17 @@ array_ass_sub(PyArrayObject *self, PyObject *ind, PyObject *op)
PyArrayObject *op_arr;
PyArray_Descr *dtype = NULL;
- op_arr = (PyArrayObject *)PyArray_FromAny(op, dtype, 0, 0, 0, NULL);
- if (op_arr == NULL) {
- return -1;
+ if (!PyArray_Check(op)) {
+ dtype = PyArray_DTYPE(self);
+ Py_INCREF(dtype);
+ op_arr = (PyArrayObject *)PyArray_FromAny(op, dtype, 0, 0, 0, NULL);
+ if (op_arr == NULL) {
+ return -1;
+ }
+ }
+ else {
+ op_arr = op;
+ Py_INCREF(op_arr);
}
if (PyArray_NDIM(op_arr) < 2) {
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c
index f0cf3e5f9..f8ade57da 100644
--- a/numpy/core/src/multiarray/multiarraymodule.c
+++ b/numpy/core/src/multiarray/multiarraymodule.c
@@ -2875,7 +2875,7 @@ array_result_type(PyObject *NPY_UNUSED(dummy), PyObject *args)
"too many arguments");
goto finish;
}
- if (!PyArray_DescrConverter2(obj, &dtypes[ndtypes])) {
+ if (!PyArray_DescrConverter(obj, &dtypes[ndtypes])) {
goto finish;
}
++ndtypes;
diff --git a/numpy/core/src/multiarray/scalartypes.c.src b/numpy/core/src/multiarray/scalartypes.c.src
index dacb9c9ce..52d59f43a 100644
--- a/numpy/core/src/multiarray/scalartypes.c.src
+++ b/numpy/core/src/multiarray/scalartypes.c.src
@@ -468,7 +468,7 @@ format_@name@(char *buf, size_t buflen, @type@ val, unsigned int prec)
/* If nothing but digits after sign, append ".0" */
cnt = strlen(buf);
- for (i = (val < 0) ? 1 : 0; i < cnt; ++i) {
+ for (i = (buf[0] == '-') ? 1 : 0; i < cnt; ++i) {
if (!isdigit(Py_CHARMASK(buf[i]))) {
break;
}
diff --git a/numpy/core/src/private/npy_config.h b/numpy/core/src/private/npy_config.h
index 4ccaae517..453dbd065 100644
--- a/numpy/core/src/private/npy_config.h
+++ b/numpy/core/src/private/npy_config.h
@@ -2,7 +2,7 @@
#define _NPY_NPY_CONFIG_H_
#include "config.h"
-#include "_numpyconfig.h"
+#include "numpy/numpyconfig.h"
/* Disable broken MS math functions */
#if defined(_MSC_VER) || defined(__MINGW32_VERSION)
diff --git a/numpy/core/tests/test_multiarray.py b/numpy/core/tests/test_multiarray.py
index 3d5bae220..319147970 100644
--- a/numpy/core/tests/test_multiarray.py
+++ b/numpy/core/tests/test_multiarray.py
@@ -2873,6 +2873,13 @@ def test_array_interface():
f.iface['shape'] = (2,)
assert_raises(ValueError, np.array, f)
+ # test scalar with no shape
+ class ArrayLike(object):
+ array = np.array(1)
+ __array_interface__ = array.__array_interface__
+ assert_equal(np.array(ArrayLike()), 1)
+
+
def test_flat_element_deletion():
it = np.ones(3).flat
try:
diff --git a/numpy/core/tests/test_numeric.py b/numpy/core/tests/test_numeric.py
index f9c9cdf52..b6a9c5157 100644
--- a/numpy/core/tests/test_numeric.py
+++ b/numpy/core/tests/test_numeric.py
@@ -465,6 +465,7 @@ class TestTypes(TestCase):
def test_result_type(self):
self.check_promotion_cases(np.result_type)
+ assert_(np.result_type(None) == np.dtype(None))
def test_promote_types_endian(self):
# promote_types should always return native-endian types
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index d5e59cdc0..1cf2e6e85 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -304,6 +304,19 @@ class TestRegression(TestCase):
self.assertRaises(ValueError, bfa)
self.assertRaises(ValueError, bfb)
+ def test_nonarray_assignment(self):
+ # See also Issue gh-2870, test for nonarray assignment
+ # and equivalent unsafe casted array assignment
+ a = np.arange(10)
+ b = np.ones(10, dtype=bool)
+ r = np.arange(10)
+ def assign(a, b, c):
+ a[b] = c
+ assert_raises(ValueError, assign, a, b, np.nan)
+ a[b] = np.array(np.nan) # but not this.
+ assert_raises(ValueError, assign, a, r, np.nan)
+ a[r] = np.array(np.nan)
+
def test_unpickle_dtype_with_object(self,level=rlevel):
"""Implemented in r2840"""
dt = np.dtype([('x',int),('y',np.object_),('z','O')])
diff --git a/numpy/core/tests/test_scalarprint.py b/numpy/core/tests/test_scalarprint.py
new file mode 100644
index 000000000..3bed7e62a
--- /dev/null
+++ b/numpy/core/tests/test_scalarprint.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+""" Test printing of scalar types.
+
+"""
+
+import numpy as np
+from numpy.testing import TestCase, assert_, run_module_suite
+
+
+class TestRealScalars(TestCase):
+ def test_str(self):
+ svals = [0.0, -0.0, 1, -1, np.inf, -np.inf, np.nan]
+ styps = [np.float16, np.float32, np.float64, np.longdouble]
+ actual = [str(f(c)) for c in svals for f in styps]
+ wanted = [
+ '0.0', '0.0', '0.0', '0.0',
+ '-0.0', '-0.0', '-0.0', '-0.0',
+ '1.0', '1.0', '1.0', '1.0',
+ '-1.0', '-1.0', '-1.0', '-1.0',
+ 'inf', 'inf', 'inf', 'inf',
+ '-inf', '-inf', '-inf', '-inf',
+ 'nan', 'nan', 'nan', 'nan']
+
+ for res, val in zip(actual, wanted):
+ assert_(res == val)
+
+
+if __name__ == "__main__":
+ run_module_suite()
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 892b1fae6..bd281e000 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -20,6 +20,19 @@ class _FilterInvalids(object):
np.seterr(**self.olderr)
+class TestConstants(TestCase):
+ def test_pi(self):
+ assert_allclose(ncu.pi, 3.141592653589793, 1e-15)
+
+
+ def test_e(self):
+ assert_allclose(ncu.e, 2.718281828459045, 1e-15)
+
+
+ def test_euler_gamma(self):
+ assert_allclose(ncu.euler_gamma, 0.5772156649015329, 1e-15)
+
+
class TestDivision(TestCase):
def test_division_int(self):
# int division should follow Python
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py
index f63d5249c..3a552897c 100644
--- a/numpy/distutils/command/build_ext.py
+++ b/numpy/distutils/command/build_ext.py
@@ -231,11 +231,6 @@ class build_ext (old_build_ext):
# Build extensions
self.build_extensions()
- # Make sure that scons based extensions are complete.
- if self.inplace:
- cmd = self.reinitialize_command('scons')
- cmd.inplace = 1
- self.run_command('scons')
def swig_sources(self, sources):
# Do nothing. Swig sources have beed handled in build_src command.
diff --git a/numpy/distutils/command/scons.py b/numpy/distutils/command/scons.py
deleted file mode 100644
index d7bbec35e..000000000
--- a/numpy/distutils/command/scons.py
+++ /dev/null
@@ -1,589 +0,0 @@
-import os
-import sys
-import os.path
-from os.path import join as pjoin, dirname as pdirname
-
-from distutils.errors import DistutilsPlatformError
-from distutils.errors import DistutilsExecError, DistutilsSetupError
-
-from numpy.distutils.command.build_ext import build_ext as old_build_ext
-from numpy.distutils.ccompiler import CCompiler, new_compiler
-from numpy.distutils.fcompiler import FCompiler, new_fcompiler
-from numpy.distutils.exec_command import find_executable
-from numpy.distutils import log
-from numpy.distutils.misc_util import is_bootstrapping, get_cmd
-from numpy.distutils.misc_util import get_numpy_include_dirs as _incdir
-from numpy.distutils.compat import get_exception
-
-# A few notes:
-# - numscons is not mandatory to build numpy, so we cannot import it here.
-# Any numscons import has to happen once we check numscons is available and
-# is required for the build (call through setupscons.py or native numscons
-# build).
-def get_scons_build_dir():
- """Return the top path where everything produced by scons will be put.
-
- The path is relative to the top setup.py"""
- from numscons import get_scons_build_dir
- return get_scons_build_dir()
-
-def get_scons_pkg_build_dir(pkg):
- """Return the build directory for the given package (foo.bar).
-
- The path is relative to the top setup.py"""
- from numscons.core.utils import pkg_to_path
- return pjoin(get_scons_build_dir(), pkg_to_path(pkg))
-
-def get_scons_configres_dir():
- """Return the top path where everything produced by scons will be put.
-
- The path is relative to the top setup.py"""
- from numscons import get_scons_configres_dir
- return get_scons_configres_dir()
-
-def get_scons_configres_filename():
- """Return the top path where everything produced by scons will be put.
-
- The path is relative to the top setup.py"""
- from numscons import get_scons_configres_filename
- return get_scons_configres_filename()
-
-def get_scons_local_path():
- """This returns the full path where scons.py for scons-local is located."""
- from numscons import get_scons_path
- return get_scons_path()
-
-def _get_top_dir(pkg):
- # XXX: this mess is necessary because scons is launched per package, and
- # has no knowledge outside its build dir, which is package dependent. If
- # one day numscons does not launch one process/package, this will be
- # unnecessary.
- from numscons import get_scons_build_dir
- from numscons.core.utils import pkg_to_path
- scdir = pjoin(get_scons_build_dir(), pkg_to_path(pkg))
- n = scdir.count(os.sep)
- return os.sep.join([os.pardir for i in range(n+1)])
-
-def get_distutils_libdir(cmd, pkg):
- """Returns the path where distutils install libraries, relatively to the
- scons build directory."""
- return pjoin(_get_top_dir(pkg), cmd.build_lib)
-
-def get_distutils_clibdir(cmd, pkg):
- """Returns the path where distutils put pure C libraries."""
- return pjoin(_get_top_dir(pkg), cmd.build_clib)
-
-def get_distutils_install_prefix(pkg, inplace):
- """Returns the installation path for the current package."""
- from numscons.core.utils import pkg_to_path
- if inplace == 1:
- return pkg_to_path(pkg)
- else:
- install_cmd = get_cmd('install').get_finalized_command('install')
- return pjoin(install_cmd.install_libbase, pkg_to_path(pkg))
-
-def get_python_exec_invoc():
- """This returns the python executable from which this file is invocated."""
- # Do we need to take into account the PYTHONPATH, in a cross platform way,
- # that is the string returned can be executed directly on supported
- # platforms, and the sys.path of the executed python should be the same
- # than the caller ? This may not be necessary, since os.system is said to
- # take into accound os.environ. This actually also works for my way of
- # using "local python", using the alias facility of bash.
- return sys.executable
-
-def get_numpy_include_dirs(sconscript_path):
- """Return include dirs for numpy.
-
- The paths are relatively to the setup.py script path."""
- from numscons import get_scons_build_dir
- scdir = pjoin(get_scons_build_dir(), pdirname(sconscript_path))
- n = scdir.count(os.sep)
-
- dirs = _incdir()
- rdirs = []
- for d in dirs:
- rdirs.append(pjoin(os.sep.join([os.pardir for i in range(n+1)]), d))
- return rdirs
-
-def dirl_to_str(dirlist):
- """Given a list of directories, returns a string where the paths are
- concatenated by the path separator.
-
- example: ['foo/bar', 'bar/foo'] will return 'foo/bar:bar/foo'."""
- return os.pathsep.join(dirlist)
-
-def dist2sconscc(compiler):
- """This converts the name passed to distutils to scons name convention (C
- compiler). compiler should be a CCompiler instance.
-
- Example:
- --compiler=intel -> intelc"""
- compiler_type = compiler.compiler_type
- if compiler_type == 'msvc':
- return 'msvc'
- elif compiler_type == 'intel':
- return 'intelc'
- else:
- return compiler.compiler[0]
-
-def dist2sconsfc(compiler):
- """This converts the name passed to distutils to scons name convention
- (Fortran compiler). The argument should be a FCompiler instance.
-
- Example:
- --fcompiler=intel -> ifort on linux, ifl on windows"""
- if compiler.compiler_type == 'intel':
- #raise NotImplementedError('FIXME: intel fortran compiler name ?')
- return 'ifort'
- elif compiler.compiler_type == 'gnu':
- return 'g77'
- elif compiler.compiler_type == 'gnu95':
- return 'gfortran'
- elif compiler.compiler_type == 'sun':
- return 'sunf77'
- else:
- # XXX: Just give up for now, and use generic fortran compiler
- return 'fortran'
-
-def dist2sconscxx(compiler):
- """This converts the name passed to distutils to scons name convention
- (C++ compiler). The argument should be a Compiler instance."""
- if compiler.compiler_type == 'msvc':
- return compiler.compiler_type
-
- return compiler.compiler_cxx[0]
-
-def get_compiler_executable(compiler):
- """For any give CCompiler instance, this gives us the name of C compiler
- (the actual executable).
-
- NOTE: does NOT work with FCompiler instances."""
- # Geez, why does distutils has no common way to get the compiler name...
- if compiler.compiler_type == 'msvc':
- # this is harcoded in distutils... A bit cleaner way would be to
- # initialize the compiler instance and then get compiler.cc, but this
- # may be costly: we really just want a string.
- # XXX: we need to initialize the compiler anyway, so do not use
- # hardcoded string
- #compiler.initialize()
- #print compiler.cc
- return 'cl.exe'
- else:
- return compiler.compiler[0]
-
-def get_f77_compiler_executable(compiler):
- """For any give FCompiler instance, this gives us the name of F77 compiler
- (the actual executable)."""
- return compiler.compiler_f77[0]
-
-def get_cxxcompiler_executable(compiler):
- """For any give CCompiler instance, this gives us the name of CXX compiler
- (the actual executable).
-
- NOTE: does NOT work with FCompiler instances."""
- # Geez, why does distutils has no common way to get the compiler name...
- if compiler.compiler_type == 'msvc':
- # this is harcoded in distutils... A bit cleaner way would be to
- # initialize the compiler instance and then get compiler.cc, but this
- # may be costly: we really just want a string.
- # XXX: we need to initialize the compiler anyway, so do not use
- # hardcoded string
- #compiler.initialize()
- #print compiler.cc
- return 'cl.exe'
- else:
- return compiler.compiler_cxx[0]
-
-def get_tool_path(compiler):
- """Given a distutils.ccompiler.CCompiler class, returns the path of the
- toolset related to C compilation."""
- fullpath_exec = find_executable(get_compiler_executable(compiler))
- if fullpath_exec:
- fullpath = pdirname(fullpath_exec)
- else:
- raise DistutilsSetupError("Could not find compiler executable info for scons")
- return fullpath
-
-def get_f77_tool_path(compiler):
- """Given a distutils.ccompiler.FCompiler class, returns the path of the
- toolset related to F77 compilation."""
- fullpath_exec = find_executable(get_f77_compiler_executable(compiler))
- if fullpath_exec:
- fullpath = pdirname(fullpath_exec)
- else:
- raise DistutilsSetupError("Could not find F77 compiler executable "\
- "info for scons")
- return fullpath
-
-def get_cxx_tool_path(compiler):
- """Given a distutils.ccompiler.CCompiler class, returns the path of the
- toolset related to C compilation."""
- fullpath_exec = find_executable(get_cxxcompiler_executable(compiler))
- if fullpath_exec:
- fullpath = pdirname(fullpath_exec)
- else:
- raise DistutilsSetupError("Could not find compiler executable info for scons")
- return fullpath
-
-def protect_path(path):
- """Convert path (given as a string) to something the shell will have no
- problem to understand (space, etc... problems)."""
- if path:
- # XXX: to this correctly, this is totally bogus for now (does not check for
- # already quoted path, for example).
- return '"' + path + '"'
- else:
- return '""'
-
-def parse_package_list(pkglist):
- return pkglist.split(",")
-
-def find_common(seq1, seq2):
- """Given two list, return the index of the common items.
-
- The index are relative to seq1.
-
- Note: do not handle duplicate items."""
- dict2 = dict([(i, None) for i in seq2])
-
- return [i for i in range(len(seq1)) if dict2.has_key(seq1[i])]
-
-def select_packages(sconspkg, pkglist):
- """Given a list of packages in pkglist, return the list of packages which
- match this list."""
- common = find_common(sconspkg, pkglist)
- if not len(common) == len(pkglist):
- msg = "the package list contains a package not found in "\
- "the current list. The current list is %s" % sconspkg
- raise ValueError(msg)
- return common
-
-def check_numscons(minver):
- """Check that we can use numscons.
-
- minver is a 3 integers tuple which defines the min version."""
- try:
- import numscons
- except ImportError:
- e = get_exception()
- raise RuntimeError("importing numscons failed (error was %s), using " \
- "scons within distutils is not possible without "
- "this package " % str(e))
-
- try:
- # version_info was added in 0.10.0
- from numscons import version_info
- # Stupid me used string instead of numbers in version_info in
- # dev versions of 0.10.0
- if isinstance(version_info[0], str):
- raise ValueError("Numscons %s or above expected " \
- "(detected 0.10.0)" % str(minver))
- # Stupid me used list instead of tuple in numscons
- version_info = tuple(version_info)
- if version_info[:3] < minver:
- raise ValueError("Numscons %s or above expected (got %s) "
- % (str(minver), str(version_info[:3])))
- except ImportError:
- raise RuntimeError("You need numscons >= %s to build numpy "\
- "with numscons (imported numscons path " \
- "is %s)." % (minver, numscons.__file__))
-
-# XXX: this is a giantic mess. Refactor this at some point.
-class scons(old_build_ext):
- # XXX: add an option to the scons command for configuration (auto/force/cache).
- description = "Scons builder"
-
- library_options = [
- ('with-perflib=', None,
- 'Specify which performance library to use for BLAS/LAPACK/etc...' \
- 'Examples: mkl/atlas/sunper/accelerate'),
- ('with-mkl-lib=', None, 'TODO'),
- ('with-mkl-include=', None, 'TODO'),
- ('with-mkl-libraries=', None, 'TODO'),
- ('with-atlas-lib=', None, 'TODO'),
- ('with-atlas-include=', None, 'TODO'),
- ('with-atlas-libraries=', None, 'TODO')
- ]
- user_options = [
- ('jobs=', 'j', "specify number of worker threads when executing" \
- "scons"),
- ('inplace', 'i', 'If specified, build in place.'),
- ('import-env', 'e', 'If specified, import user environment into scons env["ENV"].'),
- ('bypass', 'b', 'Bypass distutils compiler detection (experimental).'),
- ('scons-tool-path=', None, 'specify additional path '\
- '(absolute) to look for scons tools'),
- ('silent=', None, 'specify whether scons output should less verbose'\
- '(1), silent (2), super silent (3) or not (0, default)'),
- ('log-level=', None, 'specify log level for numscons. Any value ' \
- 'valid for the logging python module is valid'),
- ('package-list=', None,
- 'If specified, only run scons on the given '\
- 'packages (example: --package-list=scipy.cluster). If empty, '\
- 'no package is built'),
- ('fcompiler=', None, "specify the Fortran compiler type"),
- ('compiler=', None, "specify the C compiler type"),
- ('cxxcompiler=', None,
- "specify the C++ compiler type (same as C by default)"),
- ('debug', 'g',
- "compile/link with debugging information"),
- ] + library_options
-
- def initialize_options(self):
- old_build_ext.initialize_options(self)
- self.build_clib = None
-
- self.debug = 0
-
- self.compiler = None
- self.cxxcompiler = None
- self.fcompiler = None
-
- self.jobs = None
- self.silent = 0
- self.import_env = 0
- self.scons_tool_path = ''
- # If true, we bypass distutils to find the c compiler altogether. This
- # is to be used in desperate cases (like incompatible visual studio
- # version).
- self._bypass_distutils_cc = False
-
- # scons compilers
- self.scons_compiler = None
- self.scons_compiler_path = None
- self.scons_fcompiler = None
- self.scons_fcompiler_path = None
- self.scons_cxxcompiler = None
- self.scons_cxxcompiler_path = None
-
- self.package_list = None
- self.inplace = 0
- self.bypass = 0
-
- # Only critical things
- self.log_level = 50
-
- # library options
- self.with_perflib = []
- self.with_mkl_lib = []
- self.with_mkl_include = []
- self.with_mkl_libraries = []
- self.with_atlas_lib = []
- self.with_atlas_include = []
- self.with_atlas_libraries = []
-
- def _init_ccompiler(self, compiler_type):
- # XXX: The logic to bypass distutils is ... not so logic.
- if compiler_type == 'msvc':
- self._bypass_distutils_cc = True
- try:
- distutils_compiler = new_compiler(compiler=compiler_type,
- verbose=self.verbose,
- dry_run=self.dry_run,
- force=self.force)
- distutils_compiler.customize(self.distribution)
- # This initialization seems necessary, sometimes, for find_executable to work...
- if hasattr(distutils_compiler, 'initialize'):
- distutils_compiler.initialize()
- self.scons_compiler = dist2sconscc(distutils_compiler)
- self.scons_compiler_path = protect_path(get_tool_path(distutils_compiler))
- except DistutilsPlatformError:
- e = get_exception()
- if not self._bypass_distutils_cc:
- raise e
- else:
- self.scons_compiler = compiler_type
-
- def _init_fcompiler(self, compiler_type):
- self.fcompiler = new_fcompiler(compiler = compiler_type,
- verbose = self.verbose,
- dry_run = self.dry_run,
- force = self.force)
-
- if self.fcompiler is not None:
- self.fcompiler.customize(self.distribution)
- self.scons_fcompiler = dist2sconsfc(self.fcompiler)
- self.scons_fcompiler_path = protect_path(get_f77_tool_path(self.fcompiler))
-
- def _init_cxxcompiler(self, compiler_type):
- cxxcompiler = new_compiler(compiler = compiler_type,
- verbose = self.verbose,
- dry_run = self.dry_run,
- force = self.force)
- if cxxcompiler is not None:
- cxxcompiler.customize(self.distribution, need_cxx = 1)
- cxxcompiler.customize_cmd(self)
- self.cxxcompiler = cxxcompiler.cxx_compiler()
- try:
- get_cxx_tool_path(self.cxxcompiler)
- except DistutilsSetupError:
- self.cxxcompiler = None
-
- if self.cxxcompiler:
- self.scons_cxxcompiler = dist2sconscxx(self.cxxcompiler)
- self.scons_cxxcompiler_path = protect_path(get_cxx_tool_path(self.cxxcompiler))
-
- def finalize_options(self):
- old_build_ext.finalize_options(self)
-
- self.sconscripts = []
- self.pre_hooks = []
- self.post_hooks = []
- self.pkg_names = []
- self.pkg_paths = []
-
- if self.distribution.has_scons_scripts():
- for i in self.distribution.scons_data:
- self.sconscripts.append(i.scons_path)
- self.pre_hooks.append(i.pre_hook)
- self.post_hooks.append(i.post_hook)
- self.pkg_names.append(i.parent_name)
- self.pkg_paths.append(i.pkg_path)
- # This crap is needed to get the build_clib
- # directory
- build_clib_cmd = get_cmd("build_clib").get_finalized_command("build_clib")
- self.build_clib = build_clib_cmd.build_clib
-
- if not self.cxxcompiler:
- self.cxxcompiler = self.compiler
-
- # To avoid trouble, just don't do anything if no sconscripts are used.
- # This is useful when for example f2py uses numpy.distutils, because
- # f2py does not pass compiler information to scons command, and the
- # compilation setup below can crash in some situation.
- if len(self.sconscripts) > 0:
- if self.bypass:
- self.scons_compiler = self.compiler
- self.scons_fcompiler = self.fcompiler
- self.scons_cxxcompiler = self.cxxcompiler
- else:
- # Try to get the same compiler than the ones used by distutils: this is
- # non trivial because distutils and scons have totally different
- # conventions on this one (distutils uses PATH from user's environment,
- # whereas scons uses standard locations). The way we do it is once we
- # got the c compiler used, we use numpy.distutils function to get the
- # full path, and add the path to the env['PATH'] variable in env
- # instance (this is done in numpy.distutils.scons module).
-
- self._init_ccompiler(self.compiler)
- self._init_fcompiler(self.fcompiler)
- self._init_cxxcompiler(self.cxxcompiler)
-
- if self.package_list:
- self.package_list = parse_package_list(self.package_list)
-
- def _call_scons(self, scons_exec, sconscript, pkg_name, pkg_path, bootstrapping):
- # XXX: when a scons script is missing, scons only prints warnings, and
- # does not return a failure (status is 0). We have to detect this from
- # distutils (this cannot work for recursive scons builds...)
-
- # XXX: passing everything at command line may cause some trouble where
- # there is a size limitation ? What is the standard solution in thise
- # case ?
-
- cmd = [scons_exec, "-f", sconscript, '-I.']
- if self.jobs:
- cmd.append(" --jobs=%d" % int(self.jobs))
- if self.inplace:
- cmd.append("inplace=1")
- cmd.append('scons_tool_path="%s"' % self.scons_tool_path)
- cmd.append('src_dir="%s"' % pdirname(sconscript))
- cmd.append('pkg_path="%s"' % pkg_path)
- cmd.append('pkg_name="%s"' % pkg_name)
- cmd.append('log_level=%s' % self.log_level)
- #cmd.append('distutils_libdir=%s' % protect_path(pjoin(self.build_lib,
- # pdirname(sconscript))))
- cmd.append('distutils_libdir=%s' %
- protect_path(get_distutils_libdir(self, pkg_name)))
- cmd.append('distutils_clibdir=%s' %
- protect_path(get_distutils_clibdir(self, pkg_name)))
- prefix = get_distutils_install_prefix(pkg_name, self.inplace)
- cmd.append('distutils_install_prefix=%s' % protect_path(prefix))
-
- if not self._bypass_distutils_cc:
- cmd.append('cc_opt=%s' % self.scons_compiler)
- if self.scons_compiler_path:
- cmd.append('cc_opt_path=%s' % self.scons_compiler_path)
- else:
- cmd.append('cc_opt=%s' % self.scons_compiler)
-
- cmd.append('debug=%s' % self.debug)
-
- if self.scons_fcompiler:
- cmd.append('f77_opt=%s' % self.scons_fcompiler)
- if self.scons_fcompiler_path:
- cmd.append('f77_opt_path=%s' % self.scons_fcompiler_path)
-
- if self.scons_cxxcompiler:
- cmd.append('cxx_opt=%s' % self.scons_cxxcompiler)
- if self.scons_cxxcompiler_path:
- cmd.append('cxx_opt_path=%s' % self.scons_cxxcompiler_path)
-
- cmd.append('include_bootstrap=%s' % dirl_to_str(get_numpy_include_dirs(sconscript)))
- cmd.append('bypass=%s' % self.bypass)
- cmd.append('import_env=%s' % self.import_env)
- if self.silent:
- if int(self.silent) == 2:
- cmd.append('-Q')
- elif int(self.silent) == 3:
- cmd.append('-s')
- cmd.append('silent=%d' % int(self.silent))
- cmd.append('bootstrapping=%d' % bootstrapping)
- cmdstr = ' '.join(cmd)
- if int(self.silent) < 1:
- log.info("Executing scons command (pkg is %s): %s ", pkg_name, cmdstr)
- else:
- log.info("======== Executing scons command for pkg %s =========", pkg_name)
- st = os.system(cmdstr)
- if st:
- #print "status is %d" % st
- msg = "Error while executing scons command."
- msg += " See above for more information.\n"
- msg += """\
-If you think it is a problem in numscons, you can also try executing the scons
-command with --log-level option for more detailed output of what numscons is
-doing, for example --log-level=0; the lowest the level is, the more detailed
-the output it."""
- raise DistutilsExecError(msg)
-
- def run(self):
- if len(self.sconscripts) < 1:
- # nothing to do, just leave it here.
- return
-
- check_numscons(minver=(0, 11, 0))
-
- if self.package_list is not None:
- id = select_packages(self.pkg_names, self.package_list)
- sconscripts = [self.sconscripts[i] for i in id]
- pre_hooks = [self.pre_hooks[i] for i in id]
- post_hooks = [self.post_hooks[i] for i in id]
- pkg_names = [self.pkg_names[i] for i in id]
- pkg_paths = [self.pkg_paths[i] for i in id]
- else:
- sconscripts = self.sconscripts
- pre_hooks = self.pre_hooks
- post_hooks = self.post_hooks
- pkg_names = self.pkg_names
- pkg_paths = self.pkg_paths
-
- if is_bootstrapping():
- bootstrapping = 1
- else:
- bootstrapping = 0
-
- scons_exec = get_python_exec_invoc()
- scons_exec += ' ' + protect_path(pjoin(get_scons_local_path(), 'scons.py'))
-
- for sconscript, pre_hook, post_hook, pkg_name, pkg_path in zip(sconscripts,
- pre_hooks, post_hooks,
- pkg_names, pkg_paths):
- if pre_hook:
- pre_hook()
-
- if sconscript:
- self._call_scons(scons_exec, sconscript, pkg_name, pkg_path, bootstrapping)
-
- if post_hook:
- post_hook(**{'pkg_name': pkg_name, 'scons_cmd' : self})
-
diff --git a/numpy/distutils/core.py b/numpy/distutils/core.py
index e617589a2..535b5ed52 100644
--- a/numpy/distutils/core.py
+++ b/numpy/distutils/core.py
@@ -24,7 +24,7 @@ from numpy.distutils.extension import Extension
from numpy.distutils.numpy_distribution import NumpyDistribution
from numpy.distutils.command import config, config_compiler, \
build, build_py, build_ext, build_clib, build_src, build_scripts, \
- sdist, install_data, install_headers, install, bdist_rpm, scons, \
+ sdist, install_data, install_headers, install, bdist_rpm, \
install_clib
from numpy.distutils.misc_util import get_data_files, is_sequence, is_string
@@ -38,7 +38,6 @@ numpy_cmdclass = {'build': build.build,
'build_py': build_py.build_py,
'build_clib': build_clib.build_clib,
'sdist': sdist.sdist,
- 'scons': scons.scons,
'install_data': install_data.install_data,
'install_headers': install_headers.install_headers,
'install_clib': install_clib.install_clib,
@@ -99,7 +98,6 @@ def get_distribution(always=False):
# class is local to a function in setuptools.command.easy_install
if dist is not None and \
'DistributionWithoutHelpCommands' in repr(dist):
- #raise NotImplementedError("setuptools not supported yet for numpy.scons branch")
dist = None
if always and dist is None:
dist = NumpyDistribution()
diff --git a/numpy/distutils/misc_util.py b/numpy/distutils/misc_util.py
index 221cdbb5f..3a9eb3b13 100644
--- a/numpy/distutils/misc_util.py
+++ b/numpy/distutils/misc_util.py
@@ -645,56 +645,13 @@ def get_frame(level=0):
frame = frame.f_back
return frame
-class SconsInfo(object):
- """
- Container object holding build info for building a package with scons.
-
- Parameters
- ----------
- scons_path : str or None
- Path to scons script, relative to the directory of setup.py.
- If None, no scons script is specified. This can be useful to add only
- pre- and post-hooks to a configuration.
- parent_name : str or None
- Name of the parent package (for example "numpy").
- pre_hook : sequence of callables or None
- Callables that are executed before scons is invoked.
- Each callable should be defined as ``callable(*args, **kw)``.
- post_hook : sequence of callables or None
- Callables that are executed after scons is invoked.
- Each callable should be defined as ``callable(*args, **kw)``.
- source_files : list of str or None
- List of paths to source files, relative to the directory of setup.py.
- pkg_path : str or None
- Path to the package for which the `SconsInfo` instance holds the
- build info, relative to the directory of setup.py.
-
- Notes
- -----
- All parameters are available as attributes of a `SconsInfo` instance.
-
- """
- def __init__(self, scons_path, parent_name, pre_hook,
- post_hook, source_files, pkg_path):
- self.scons_path = scons_path
- self.parent_name = parent_name
- self.pre_hook = pre_hook
- self.post_hook = post_hook
- self.source_files = source_files
- if pkg_path:
- self.pkg_path = pkg_path
- else:
- if scons_path:
- self.pkg_path = os.path.dirname(scons_path)
- else:
- self.pkg_path = ''
######################
class Configuration(object):
_list_keys = ['packages', 'ext_modules', 'data_files', 'include_dirs',
- 'libraries', 'headers', 'scripts', 'py_modules', 'scons_data',
+ 'libraries', 'headers', 'scripts', 'py_modules',
'installed_libraries']
_dict_keys = ['package_dir', 'installed_pkg_config']
_extra_keys = ['name', 'version']
@@ -1651,65 +1608,6 @@ class Configuration(object):
self.installed_pkg_config[self.name] = [(template, install_dir,
subst_dict)]
- def add_scons_installed_library(self, name, install_dir):
- """
- Add a scons-built installable library to distutils.
-
- Parameters
- ----------
- name : str
- The name of the library.
- install_dir : str
- Path to install the library, relative to the current sub-package.
-
- """
- install_dir = os.path.join(self.package_path, install_dir)
- self.installed_libraries.append(InstallableLib(name, {}, install_dir))
-
- def add_sconscript(self, sconscript, subpackage_path=None,
- standalone = False, pre_hook = None,
- post_hook = None, source_files = None, package_path=None):
- """Add a sconscript to configuration.
-
- pre_hook and post hook should be sequences of callable, which will be
- use before and after executing scons. The callable should be defined as
- callable(*args, **kw). It is ugly, but well, hooks are ugly anyway...
-
- sconscript can be None, which can be useful to add only post/pre
- hooks."""
- if standalone:
- parent_name = None
- else:
- parent_name = self.name
-
- dist = self.get_distribution()
- # Convert the sconscript name to a relative filename (relative from top
- # setup.py's directory)
- fullsconsname = self.paths(sconscript)[0]
-
- # XXX: Think about a way to automatically register source files from
- # scons...
- full_source_files = []
- if source_files:
- full_source_files.extend([self.paths(i)[0] for i in source_files])
-
- scons_info = SconsInfo(fullsconsname, parent_name,
- pre_hook, post_hook,
- full_source_files, package_path)
- if dist is not None:
- if dist.scons_data is None:
- dist.scons_data = []
- dist.scons_data.append(scons_info)
- self.warn('distutils distribution has been initialized,'\
- ' it may be too late to add a subpackage '+ subpackage_name)
- # XXX: we add a fake extension, to correctly initialize some
- # options in distutils command.
- dist.add_extension('', sources = [])
- else:
- self.scons_data.append(scons_info)
- # XXX: we add a fake extension, to correctly initialize some
- # options in distutils command.
- self.add_extension('', sources = [])
def add_scripts(self,*files):
"""Add scripts to configuration.
@@ -2084,11 +1982,6 @@ class Configuration(object):
"""
self.py_modules.append((self.name,name,generate_config_py))
- def scons_make_config_py(self, name = '__config__'):
- """Generate package __config__.py file containing system_info
- information used during building the package.
- """
- self.py_modules.append((self.name, name, scons_generate_config_py))
def get_info(self,*names):
"""Get resources information.
@@ -2239,49 +2132,6 @@ def is_bootstrapping():
return False
__NUMPY_SETUP__ = False
-def scons_generate_config_py(target):
- """generate config.py file containing system_info information
- used during building the package.
-
- usage:
- config['py_modules'].append((packagename, '__config__',generate_config_py))
- """
- from distutils.dir_util import mkpath
- from numscons import get_scons_configres_dir, get_scons_configres_filename
- d = {}
- mkpath(os.path.dirname(target))
- f = open(target, 'w')
- f.write('# this file is generated by %s\n' % (os.path.abspath(sys.argv[0])))
- f.write('# it contains system_info results at the time of building this package.\n')
- f.write('__all__ = ["show"]\n\n')
- confdir = get_scons_configres_dir()
- confilename = get_scons_configres_filename()
- for root, dirs, files in os.walk(confdir):
- if files:
- file = os.path.join(root, confilename)
- assert root.startswith(confdir)
- pkg_name = '.'.join(root[len(confdir)+1:].split(os.sep))
- fid = open(file, 'r')
- try:
- cnt = fid.read()
- d[pkg_name] = eval(cnt)
- finally:
- fid.close()
- # d is a dictionary whose keys are package names, and values the
- # corresponding configuration. Each configuration is itself a dictionary
- # (lib : libinfo)
- f.write('_config = %s\n' % d)
- f.write(r'''
-def show():
- for pkg, config in _config.items():
- print("package %s configuration:" % pkg)
- for lib, libc in config.items():
- print(' %s' % lib)
- for line in libc.split('\n'):
- print('\t%s' % line)
- ''')
- f.close()
- return target
#########################
diff --git a/numpy/distutils/setupscons.py b/numpy/distutils/setupscons.py
deleted file mode 100644
index 938f07ead..000000000
--- a/numpy/distutils/setupscons.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-import os.path
-
-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_data_dir('tests')
- if os.path.exists("site.cfg"):
- config.add_data_files('site.cfg')
- config.make_config_py()
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/f2py/setupscons.py b/numpy/f2py/setupscons.py
deleted file mode 100755
index e30fd8743..000000000
--- a/numpy/f2py/setupscons.py
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/usr/bin/env python
-"""
-setup.py for installing F2PY
-
-Usage:
- python setup.py install
-
-Copyright 2001-2005 Pearu Peterson all rights reserved,
-Pearu Peterson <pearu@cens.ioc.ee>
-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
-"""
-
-__version__ = "$Id: setup.py,v 1.32 2005/01/30 17:22:14 pearu Exp $"
-
-import os
-import sys
-from distutils.dep_util import newer
-from numpy.distutils import log
-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_data_dir('docs')
-
- config.add_data_files('src/fortranobject.c',
- 'src/fortranobject.h',
- 'f2py.1'
- )
-
- config.make_svn_version_py()
-
- def generate_f2py_py(build_dir):
- f2py_exe = 'f2py'+os.path.basename(sys.executable)[6:]
- if f2py_exe[-4:]=='.exe':
- f2py_exe = f2py_exe[:-4] + '.py'
- if 'bdist_wininst' in sys.argv and f2py_exe[-3:] != '.py':
- f2py_exe = f2py_exe + '.py'
- target = os.path.join(build_dir,f2py_exe)
- if newer(__file__,target):
- log.info('Creating %s', target)
- f = open(target,'w')
- f.write('''\
-#!/usr/bin/env %s
-# See http://cens.ioc.ee/projects/f2py2e/
-import os, sys
-for mode in ["g3-numpy", "2e-numeric", "2e-numarray", "2e-numpy"]:
- try:
- i=sys.argv.index("--"+mode)
- del sys.argv[i]
- break
- except ValueError: pass
-os.environ["NO_SCIPY_IMPORT"]="f2py"
-if mode=="g3-numpy":
- print >> sys.stderr, "G3 f2py support is not implemented, yet."
- sys.exit(1)
-elif mode=="2e-numeric":
- from f2py2e import main
-elif mode=="2e-numarray":
- sys.argv.append("-DNUMARRAY")
- from f2py2e import main
-elif mode=="2e-numpy":
- from numpy.f2py import main
-else:
- print >> sys.stderr, "Unknown mode:",`mode`
- sys.exit(1)
-main()
-'''%(os.path.basename(sys.executable)))
- f.close()
- return target
-
- config.add_scripts(generate_f2py_py)
-
- return config
-
-if __name__ == "__main__":
-
- config = configuration(top_path='')
- version = config.get_version()
- print 'F2PY Version',version
- config = config.todict()
-
- if sys.version[:3]>='2.3':
- config['download_url'] = "http://cens.ioc.ee/projects/f2py2e/2.x"\
- "/F2PY-2-latest.tar.gz"
- 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 Generaton",
- author = "Pearu Peterson",
- author_email = "pearu@cens.ioc.ee",
- maintainer = "Pearu Peterson",
- maintainer_email = "pearu@cens.ioc.ee",
- 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 = "http://cens.ioc.ee/projects/f2py2e/",
- keywords = ['Fortran','f2py'],
- **config)
diff --git a/numpy/fft/SConscript b/numpy/fft/SConscript
deleted file mode 100644
index adceea011..000000000
--- a/numpy/fft/SConscript
+++ /dev/null
@@ -1,8 +0,0 @@
-# Last Change: Thu Jun 12 06:00 PM 2008 J
-# vim:syntax=python
-from numscons import GetNumpyEnvironment
-
-env = GetNumpyEnvironment(ARGUMENTS)
-
-env.NumpyPythonExtension('fftpack_lite',
- source = ['fftpack_litemodule.c', 'fftpack.c'])
diff --git a/numpy/fft/SConstruct b/numpy/fft/SConstruct
deleted file mode 100644
index a377d8391..000000000
--- a/numpy/fft/SConstruct
+++ /dev/null
@@ -1,2 +0,0 @@
-from numscons import GetInitEnvironment
-GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
diff --git a/numpy/fft/setupscons.py b/numpy/fft/setupscons.py
deleted file mode 100644
index 54551b0a3..000000000
--- a/numpy/fft/setupscons.py
+++ /dev/null
@@ -1,15 +0,0 @@
-def configuration(parent_package = '', top_path = None):
- from numpy.distutils.misc_util import Configuration, get_numpy_include_dirs
- config = Configuration('fft', parent_package, top_path)
-
- config.add_data_dir('tests')
-
- config.add_sconscript('SConstruct',
- source_files = ['fftpack_litemodule.c', 'fftpack.c',
- 'fftpack.h'])
-
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/lib/SConscript b/numpy/lib/SConscript
deleted file mode 100644
index 2d1ed5576..000000000
--- a/numpy/lib/SConscript
+++ /dev/null
@@ -1,7 +0,0 @@
-# Last Change: Thu Jun 12 06:00 PM 2008 J
-# vim:syntax=python
-from numscons import GetNumpyEnvironment
-
-env = GetNumpyEnvironment(ARGUMENTS)
-env.Prepend(CPPPATH=["#$build_prefix/numpy/core/src/private"])
-env.NumpyPythonExtension('_compiled_base', source = ['src/_compiled_base.c'])
diff --git a/numpy/lib/SConstruct b/numpy/lib/SConstruct
deleted file mode 100644
index a377d8391..000000000
--- a/numpy/lib/SConstruct
+++ /dev/null
@@ -1,2 +0,0 @@
-from numscons import GetInitEnvironment
-GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py
index b07fde27d..852c5f6fd 100644
--- a/numpy/lib/index_tricks.py
+++ b/numpy/lib/index_tricks.py
@@ -502,7 +502,6 @@ class ndenumerate(object):
def __iter__(self):
return self
-
class ndindex(object):
"""
An N-dimensional iterator object to index arrays.
@@ -532,13 +531,36 @@ class ndindex(object):
(2, 1, 0)
"""
+ # This is a hack to handle 0-d arrays correctly.
+ # Fixing nditer would be more work but should be done eventually,
+ # and then this entire __new__ method can be removed.
+ def __new__(cls, *shape):
+ if len(shape) == 0 or (len(shape) == 1 and len(shape[0]) == 0):
+ class zero_dim_iter(object):
+ def __init__(self):
+ self._N = 1
+ def __iter__(self):
+ return self
+ def ndincr(self):
+ self.next()
+ def next(self):
+ if self._N > 0:
+ self._N -= 1
+ return ()
+ raise StopIteration
+ return zero_dim_iter()
+ else:
+ return super(ndindex, cls).__new__(cls)
+
def __init__(self, *shape):
+ if len(shape) == 1 and isinstance(shape[0], tuple):
+ shape = shape[0]
x = as_strided(_nx.zeros(1), shape=shape, strides=_nx.zeros_like(shape))
self._it = _nx.nditer(x, flags=['multi_index'], order='C')
def __iter__(self):
return self
-
+
def ndincr(self):
"""
Increment the multi-dimensional index by one.
diff --git a/numpy/lib/setupscons.py b/numpy/lib/setupscons.py
deleted file mode 100644
index 4f31f6e8a..000000000
--- a/numpy/lib/setupscons.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from os.path import join
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
-
- config = Configuration('lib',parent_package,top_path)
-
- config.add_sconscript('SConstruct',
- source_files = [join('src', '_compiled_base.c')])
- config.add_data_dir('tests')
-
- return config
-
-if __name__=='__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py
index 0ede40d5a..43160ffb7 100644
--- a/numpy/lib/tests/test_index_tricks.py
+++ b/numpy/lib/tests/test_index_tricks.py
@@ -242,6 +242,16 @@ def test_ndindex():
expected = [ix for ix, e in np.ndenumerate(np.zeros((1, 2, 3)))]
assert_array_equal(x, expected)
+ x = list(np.ndindex((1, 2, 3)))
+ assert_array_equal(x, expected)
+
+ # Make sure size argument is optional
+ x = list(np.ndindex())
+ assert_equal(x, [()])
+
+ x = list(np.ndindex(()))
+ assert_equal(x, [()])
+
if __name__ == "__main__":
run_module_suite()
diff --git a/numpy/linalg/SConscript b/numpy/linalg/SConscript
deleted file mode 100644
index 78c4d569b..000000000
--- a/numpy/linalg/SConscript
+++ /dev/null
@@ -1,23 +0,0 @@
-# Last Change: Thu Jun 12 06:00 PM 2008 J
-# vim:syntax=python
-from numscons import GetNumpyEnvironment, scons_get_mathlib
-from numscons import CheckF77LAPACK
-from numscons import write_info
-
-env = GetNumpyEnvironment(ARGUMENTS)
-
-config = env.NumpyConfigure(custom_tests = {'CheckLAPACK' : CheckF77LAPACK})
-
-use_lapack = config.CheckLAPACK()
-
-mlib = scons_get_mathlib(env)
-env.AppendUnique(LIBS = mlib)
-
-config.Finish()
-write_info(env)
-
-sources = ['lapack_litemodule.c']
-if not use_lapack:
- sources.extend(['python_xerbla.c', 'zlapack_lite.c', 'dlapack_lite.c',
- 'blas_lite.c', 'dlamch.c', 'f2c_lite.c'])
-env.NumpyPythonExtension('lapack_lite', source = sources)
diff --git a/numpy/linalg/SConstruct b/numpy/linalg/SConstruct
deleted file mode 100644
index a377d8391..000000000
--- a/numpy/linalg/SConstruct
+++ /dev/null
@@ -1,2 +0,0 @@
-from numscons import GetInitEnvironment
-GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
diff --git a/numpy/linalg/linalg.py b/numpy/linalg/linalg.py
index 398733a86..a4afb6b6a 100644
--- a/numpy/linalg/linalg.py
+++ b/numpy/linalg/linalg.py
@@ -1253,7 +1253,7 @@ def svd(a, full_matrices=1, compute_uv=1):
>>> U, s, V = np.linalg.svd(a, full_matrices=True)
>>> U.shape, V.shape, s.shape
- ((9, 6), (6, 6), (6,))
+ ((9, 9), (6, 6), (6,))
>>> S = np.zeros((9, 6), dtype=complex)
>>> S[:6, :6] = np.diag(s)
>>> np.allclose(a, np.dot(U, np.dot(S, V)))
diff --git a/numpy/linalg/setupscons.py b/numpy/linalg/setupscons.py
deleted file mode 100644
index fd05ce9af..000000000
--- a/numpy/linalg/setupscons.py
+++ /dev/null
@@ -1,19 +0,0 @@
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- from numpy.distutils.system_info import get_info
- config = Configuration('linalg',parent_package,top_path)
-
- config.add_data_dir('tests')
-
- config.add_sconscript('SConstruct',
- source_files = ['lapack_litemodule.c',
- 'zlapack_lite.c', 'dlapack_lite.c',
- 'blas_lite.c', 'dlamch.c',
- 'f2c_lite.c','f2c.h'])
-
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/ma/setupscons.py b/numpy/ma/setupscons.py
deleted file mode 100644
index 024746655..000000000
--- a/numpy/ma/setupscons.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/env python
-__author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)"
-__version__ = '1.0'
-__revision__ = "$Revision: 3473 $"
-__date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $'
-
-import os
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('ma',parent_package,top_path)
- config.add_data_dir('tests')
- return config
-
-if __name__ == "__main__":
- from numpy.distutils.core import setup
- config = configuration(top_path='').todict()
- setup(**config)
diff --git a/numpy/matrixlib/setupscons.py b/numpy/matrixlib/setupscons.py
deleted file mode 100644
index 85b090094..000000000
--- a/numpy/matrixlib/setupscons.py
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-import os
-
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('matrixlib', parent_package, top_path)
- config.add_data_dir('tests')
- return config
-
-if __name__ == "__main__":
- from numpy.distutils.core import setup
- config = configuration(top_path='').todict()
- setup(**config)
diff --git a/numpy/numarray/SConscript b/numpy/numarray/SConscript
deleted file mode 100644
index f2d18a400..000000000
--- a/numpy/numarray/SConscript
+++ /dev/null
@@ -1,7 +0,0 @@
-# Last Change: Thu Jun 12 06:00 PM 2008 J
-# vim:syntax=python
-from numscons import GetNumpyEnvironment
-
-env = GetNumpyEnvironment(ARGUMENTS)
-env.Prepend(CPPPATH=['numpy', "#$build_prefix/numpy/core/src/private"])
-env.NumpyPythonExtension('_capi', source = ['_capi.c'])
diff --git a/numpy/numarray/SConstruct b/numpy/numarray/SConstruct
deleted file mode 100644
index a377d8391..000000000
--- a/numpy/numarray/SConstruct
+++ /dev/null
@@ -1,2 +0,0 @@
-from numscons import GetInitEnvironment
-GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
diff --git a/numpy/numarray/setupscons.py b/numpy/numarray/setupscons.py
deleted file mode 100644
index 173612ae8..000000000
--- a/numpy/numarray/setupscons.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from os.path import join
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('numarray',parent_package,top_path)
-
- config.add_data_files('include/numpy/')
- config.add_sconscript('SConstruct', source_files = ['_capi.c'])
-
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/oldnumeric/setupscons.py b/numpy/oldnumeric/setupscons.py
deleted file mode 100644
index 82e8a6201..000000000
--- a/numpy/oldnumeric/setupscons.py
+++ /dev/null
@@ -1,8 +0,0 @@
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- return Configuration('oldnumeric',parent_package,top_path)
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/random/SConscript b/numpy/random/SConscript
deleted file mode 100644
index a2acb0a66..000000000
--- a/numpy/random/SConscript
+++ /dev/null
@@ -1,50 +0,0 @@
-# Last Change: Wed Nov 19 09:00 PM 2008 J
-# vim:syntax=python
-import os
-
-from numscons import GetNumpyEnvironment, scons_get_mathlib
-
-from setup import needs_mingw_ftime_workaround
-
-def CheckWincrypt(context):
- from copy import deepcopy
- src = """\
-/* check to see if _WIN32 is defined */
-int main(int argc, char *argv[])
-{
-#ifdef _WIN32
- return 0;
-#else
- return 1;
-#endif
-}
-"""
-
- context.Message("Checking if using wincrypt ... ")
- st = context.env.TryRun(src, '.C')
- if st[0] == 0:
- context.Result('No')
- else:
- context.Result('Yes')
- return st[0]
-
-env = GetNumpyEnvironment(ARGUMENTS)
-
-mlib = scons_get_mathlib(env)
-env.AppendUnique(LIBS = mlib)
-
-# On windows, see if we should use Advapi32
-if os.name == 'nt':
- config = env.NumpyConfigure(custom_tests = {'CheckWincrypt' : CheckWincrypt})
- if config.CheckWincrypt:
- config.env.AppendUnique(LIBS = 'Advapi32')
- config.Finish()
-
-if needs_mingw_ftime_workaround():
- env.Append(CPPDEFINES=['NPY_NEEDS_MINGW_TIME_WORKAROUND'])
-
-sources = [os.path.join('mtrand', x) for x in
- ['mtrand.c', 'randomkit.c', 'initarray.c', 'distributions.c']]
-
-# XXX: Pyrex dependency
-env.NumpyPythonExtension('mtrand', source = sources)
diff --git a/numpy/random/SConstruct b/numpy/random/SConstruct
deleted file mode 100644
index a377d8391..000000000
--- a/numpy/random/SConstruct
+++ /dev/null
@@ -1,2 +0,0 @@
-from numscons import GetInitEnvironment
-GetInitEnvironment(ARGUMENTS).DistutilsSConscript('SConscript')
diff --git a/numpy/random/setupscons.py b/numpy/random/setupscons.py
deleted file mode 100644
index f5342c39e..000000000
--- a/numpy/random/setupscons.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import glob
-from os.path import join, split
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration, get_mathlibs
- config = Configuration('random',parent_package,top_path)
-
- source_files = [join('mtrand', i) for i in ['mtrand.c',
- 'mtrand.pyx',
- 'numpy.pxi',
- 'randomkit.c',
- 'randomkit.h',
- 'Python.pxi',
- 'initarray.c',
- 'initarray.h',
- 'distributions.c',
- 'distributions.h',
- ]]
- config.add_sconscript('SConstruct', source_files = source_files)
- config.add_data_files(('.', join('mtrand', 'randomkit.h')))
- config.add_data_dir('tests')
-
- return config
-
-def testcode_wincrypt():
- return """\
-/* check to see if _WIN32 is defined */
-int main(int argc, char *argv[])
-{
-#ifdef _WIN32
- return 0;
-#else
- return 1;
-#endif
-}
-"""
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(configuration=configuration)
diff --git a/numpy/setupscons.py b/numpy/setupscons.py
deleted file mode 100644
index 59fa57a4d..000000000
--- a/numpy/setupscons.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-from os.path import join as pjoin
-
-def configuration(parent_package='', top_path=None):
- from numpy.distutils.misc_util import Configuration
- from numpy.distutils.misc_util import scons_generate_config_py
-
- pkgname = 'numpy'
- config = Configuration(pkgname, parent_package, top_path,
- setup_name = 'setupscons.py')
- config.add_subpackage('distutils')
- config.add_subpackage('testing')
- config.add_subpackage('f2py')
- config.add_subpackage('core')
- config.add_subpackage('lib')
- config.add_subpackage('oldnumeric')
- config.add_subpackage('numarray')
- config.add_subpackage('fft')
- config.add_subpackage('linalg')
- config.add_subpackage('random')
- config.add_subpackage('ma')
- config.add_subpackage('matrixlib')
- config.add_subpackage('compat')
- config.add_subpackage('polynomial')
- config.add_subpackage('doc')
- config.add_data_dir('doc')
- config.add_data_dir('tests')
-
- def add_config(*args, **kw):
- # Generate __config__, handle inplace issues.
- if kw['scons_cmd'].inplace:
- target = pjoin(kw['pkg_name'], '__config__.py')
- else:
- target = pjoin(kw['scons_cmd'].build_lib, kw['pkg_name'],
- '__config__.py')
- scons_generate_config_py(target)
- config.add_sconscript(None, post_hook = add_config)
-
- return config
-
-if __name__ == '__main__':
- print 'This is the wrong setup.py file to run'
diff --git a/numpy/testing/noseclasses.py b/numpy/testing/noseclasses.py
index 2fec800ac..5152bdd60 100644
--- a/numpy/testing/noseclasses.py
+++ b/numpy/testing/noseclasses.py
@@ -165,8 +165,6 @@ class NumpyDoctest(npd.Doctest):
# files that should be ignored for doctests
doctest_ignore = ['generate_numpy_api.py',
- 'scons_support.py',
- 'setupscons.py',
'setup.py']
# Custom classes; class variables to allow subclassing
diff --git a/numpy/testing/setupscons.py b/numpy/testing/setupscons.py
deleted file mode 100755
index ad248d27f..000000000
--- a/numpy/testing/setupscons.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env python
-
-def configuration(parent_package='',top_path=None):
- from numpy.distutils.misc_util import Configuration
- config = Configuration('testing',parent_package,top_path)
- return config
-
-if __name__ == '__main__':
- from numpy.distutils.core import setup
- setup(maintainer = "NumPy Developers",
- maintainer_email = "numpy-dev@numpy.org",
- description = "NumPy test module",
- url = "http://www.numpy.org",
- license = "NumPy License (BSD Style)",
- configuration = configuration,
- )