diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-07-05 11:47:29 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-07-05 12:18:26 -0600 |
commit | 8b3e9ae5262c1da1118370cd6e83db9b2166952e (patch) | |
tree | ad552d92d8f806db622da102707571a38faec7c2 /numpy/core/setup.py | |
parent | c2ae6aa0103aecdb5e2a71504583451cada1bfbc (diff) | |
download | numpy-8b3e9ae5262c1da1118370cd6e83db9b2166952e.tar.gz |
STY: PEP8 fixes for numpy/core/*.py
Diffstat (limited to 'numpy/core/setup.py')
-rw-r--r-- | numpy/core/setup.py | 68 |
1 files changed, 33 insertions, 35 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 7a82f1e35..ac797562d 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -247,7 +247,7 @@ def check_ieee_macros(config): # Note: including Python.h is necessary because it modifies some math.h # definitions for f in macros: - st = config.check_decl(f, headers = ["Python.h", "math.h"]) + st = config.check_decl(f, headers=["Python.h", "math.h"]) if st: _add_decl(f) @@ -276,7 +276,7 @@ def check_types(config_cmd, ext, build_dir): result = config_cmd.check_header('Python.h') if not result: raise SystemError( - "Cannot compile 'Python.h'. Perhaps you need to "\ + "Cannot compile 'Python.h'. Perhaps you need to " "install python-dev|python-devel.") res = config_cmd.check_header("endian.h") if res: @@ -285,7 +285,7 @@ def check_types(config_cmd, ext, build_dir): # Check basic types sizes for type in ('short', 'int', 'long'): - res = config_cmd.check_decl("SIZEOF_%s" % sym2def(type), headers = ["Python.h"]) + res = config_cmd.check_decl("SIZEOF_%s" % sym2def(type), headers=["Python.h"]) if res: public_defines.append(('NPY_SIZEOF_%s' % sym2def(type), "SIZEOF_%s" % sym2def(type))) else: @@ -297,7 +297,7 @@ def check_types(config_cmd, ext, build_dir): for type in ('float', 'double', 'long double'): already_declared = config_cmd.check_decl("SIZEOF_%s" % sym2def(type), - headers = ["Python.h"]) + headers=["Python.h"]) res = config_cmd.check_type_size(type, expected=expected[type]) if res >= 0: public_defines.append(('NPY_SIZEOF_%s' % sym2def(type), '%d' % res)) @@ -317,7 +317,6 @@ def check_types(config_cmd, ext, build_dir): else: raise SystemError("Checking sizeof (%s) failed !" % complex_def) - for type in ('Py_intptr_t', 'off_t'): res = config_cmd.check_type_size(type, headers=["Python.h"], library_dirs=[pythonlib_dir()], @@ -350,7 +349,7 @@ def check_types(config_cmd, ext, build_dir): if not config_cmd.check_decl('CHAR_BIT', headers=['Python.h']): raise RuntimeError( - "Config wo CHAR_BIT is not supported"\ + "Config wo CHAR_BIT is not supported" ", please contact the maintainers") return private_defines, public_defines @@ -401,7 +400,7 @@ def configuration(parent_package='',top_path=None): open(generate_umath_py, 'U'), generate_umath_py, ('.py', 'U', 1)) - header_dir = 'include/numpy' # this is relative to config.path_in_package + header_dir = 'include/numpy' # this is relative to config.path_in_package cocache = CallOnceOnly() @@ -431,7 +430,7 @@ def configuration(parent_package='',top_path=None): moredefs.append('__NPY_PRIVATE_NO_SIGNAL') # Windows checks - if sys.platform=='win32' or os.name=='nt': + if sys.platform == 'win32' or os.name == 'nt': win32_checks(moredefs) # C99 restrict keyword @@ -558,7 +557,7 @@ def configuration(parent_package='',top_path=None): moredefs.append(('NPY_RELAXED_STRIDES_CHECKING', 1)) # Check wether we can use inttypes (C99) formats - if config_cmd.check_decl('PRIdPTR', headers = ['inttypes.h']): + if config_cmd.check_decl('PRIdPTR', headers=['inttypes.h']): moredefs.append(('NPY_USE_C99_FORMATS', 1)) # visibility check @@ -645,7 +644,7 @@ def configuration(parent_package='',top_path=None): # generate_numpyconfig_h as sources *before* adding npymath. config.add_extension('_dummy', - sources = [join('src', 'dummymodule.c'), + sources=[join('src', 'dummymodule.c'), generate_config_h, generate_numpyconfig_h, generate_numpy_api] @@ -656,6 +655,7 @@ def configuration(parent_package='',top_path=None): ####################################################################### subst_dict = dict([("sep", os.path.sep), ("pkgname", "numpy.core")]) + def get_mathlib_info(*args): # Another ugly hack: the mathlib info is known once build_src is run, # but we cannot use add_installed_pkg_config here either, so we only @@ -678,7 +678,8 @@ def configuration(parent_package='',top_path=None): npymath_sources = [join('src', 'npymath', 'npy_math.c.src'), join('src', 'npymath', 'ieee754.c.src'), join('src', 'npymath', 'npy_math_complex.c.src'), - join('src', 'npymath', 'halffloat.c')] + join('src', 'npymath', 'halffloat.c') + ] config.add_installed_library('npymath', sources=npymath_sources + [get_mathlib_info], install_dir='lib') @@ -692,19 +693,18 @@ def configuration(parent_package='',top_path=None): ####################################################################### # This library is created for the build but it is not installed - npysort_sources=[join('src', 'npysort', 'quicksort.c.src'), - join('src', 'npysort', 'mergesort.c.src'), - join('src', 'npysort', 'heapsort.c.src'), - join('src', 'private', 'npy_partition.h.src'), - join('src', 'npysort', 'selection.c.src'), - join('src', 'private', 'npy_binsearch.h.src'), - join('src', 'npysort', 'binsearch.c.src'), - ] + npysort_sources = [join('src', 'npysort', 'quicksort.c.src'), + join('src', 'npysort', 'mergesort.c.src'), + join('src', 'npysort', 'heapsort.c.src'), + join('src', 'private', 'npy_partition.h.src'), + join('src', 'npysort', 'selection.c.src'), + join('src', 'private', 'npy_binsearch.h.src'), + join('src', 'npysort', 'binsearch.c.src'), + ] config.add_library('npysort', sources=npysort_sources, include_dirs=[]) - ####################################################################### # multiarray module # ####################################################################### @@ -721,7 +721,8 @@ def configuration(parent_package='',top_path=None): join(local_dir, subpath, 'nditer_templ.c.src'), join(local_dir, subpath, 'lowlevel_strided_loops.c.src'), join(local_dir, subpath, 'einsum.c.src'), - join(local_dir, 'src', 'private', 'templ_common.h.src')] + join(local_dir, 'src', 'private', 'templ_common.h.src') + ] # numpy.distutils generate .c from .c.src in weird directories, we have # to add them there as they depend on the build_dir @@ -834,11 +835,11 @@ def configuration(parent_package='',top_path=None): ] blas_info = get_info('blas_opt', 0) - if blas_info and ('HAVE_CBLAS', None) in blas_info.get('define_macros', []): + if blas_info and ('HAVE_CBLAS', None) in blas_info.get('define_macros', []): extra_info = blas_info multiarray_src.extend([join('src', 'multiarray', 'cblasfuncs.c'), join('src', 'multiarray', 'python_xerbla.c'), - ]) + ]) if uses_accelerate_framework(blas_info): multiarray_src.extend(get_sgemv_fix()) else: @@ -849,7 +850,6 @@ def configuration(parent_package='',top_path=None): multiarray_src = [join('src', 'multiarray', 'multiarraymodule_onefile.c')] multiarray_src.append(generate_multiarray_templated_sources) - config.add_extension('multiarray', sources=multiarray_src + [generate_config_h, @@ -885,7 +885,6 @@ def configuration(parent_package='',top_path=None): cmd.ensure_finalized() cmd.template_sources(sources, ext) - def generate_umath_c(ext, build_dir): target = join(build_dir, header_dir, '__umath_generated.c') dir = os.path.dirname(target) @@ -926,50 +925,49 @@ def configuration(parent_package='',top_path=None): umath_src.append(join('src', 'umath', 'simd.inc.src')) config.add_extension('umath', - sources = umath_src + + sources=umath_src + [generate_config_h, generate_numpyconfig_h, generate_umath_c, generate_ufunc_api], - depends = deps + umath_deps, - libraries = ['npymath'], + depends=deps + umath_deps, + libraries=['npymath'], ) - ####################################################################### # umath_tests module # ####################################################################### config.add_extension('umath_tests', - sources = [join('src', 'umath', 'umath_tests.c.src')]) + sources=[join('src', 'umath', 'umath_tests.c.src')]) ####################################################################### # custom rational dtype module # ####################################################################### config.add_extension('test_rational', - sources = [join('src', 'umath', 'test_rational.c.src')]) + sources=[join('src', 'umath', 'test_rational.c.src')]) ####################################################################### # struct_ufunc_test module # ####################################################################### config.add_extension('struct_ufunc_test', - sources = [join('src', 'umath', 'struct_ufunc_test.c.src')]) + sources=[join('src', 'umath', 'struct_ufunc_test.c.src')]) ####################################################################### # multiarray_tests module # ####################################################################### config.add_extension('multiarray_tests', - sources = [join('src', 'multiarray', 'multiarray_tests.c.src')]) + sources=[join('src', 'multiarray', 'multiarray_tests.c.src')]) ####################################################################### # operand_flag_tests module # ####################################################################### config.add_extension('operand_flag_tests', - sources = [join('src', 'umath', 'operand_flag_tests.c.src')]) + sources=[join('src', 'umath', 'operand_flag_tests.c.src')]) config.add_data_dir('tests') config.add_data_dir('tests/data') @@ -978,6 +976,6 @@ def configuration(parent_package='',top_path=None): return config -if __name__=='__main__': +if __name__ == '__main__': from numpy.distutils.core import setup setup(configuration=configuration) |