summaryrefslogtreecommitdiff
path: root/numpy/distutils/command
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils/command')
-rw-r--r--numpy/distutils/command/__init__.py2
-rw-r--r--numpy/distutils/command/bdist_rpm.py2
-rw-r--r--numpy/distutils/command/build.py2
-rw-r--r--numpy/distutils/command/build_clib.py18
-rw-r--r--numpy/distutils/command/build_ext.py36
-rw-r--r--numpy/distutils/command/build_py.py2
-rw-r--r--numpy/distutils/command/build_src.py96
-rw-r--r--numpy/distutils/command/config.py20
-rw-r--r--numpy/distutils/command/config_compiler.py30
-rw-r--r--numpy/distutils/command/install.py4
-rw-r--r--numpy/distutils/command/install_headers.py2
-rw-r--r--numpy/distutils/command/sdist.py2
12 files changed, 108 insertions, 108 deletions
diff --git a/numpy/distutils/command/__init__.py b/numpy/distutils/command/__init__.py
index 94a7185bb..76a260072 100644
--- a/numpy/distutils/command/__init__.py
+++ b/numpy/distutils/command/__init__.py
@@ -24,7 +24,7 @@ distutils_all = [ #'build_py',
'bdist_wininst',
]
-__import__('distutils.command',globals(),locals(),distutils_all)
+__import__('distutils.command', globals(), locals(), distutils_all)
__all__ = ['build',
'config_compiler',
diff --git a/numpy/distutils/command/bdist_rpm.py b/numpy/distutils/command/bdist_rpm.py
index e24072ff4..3e52a503b 100644
--- a/numpy/distutils/command/bdist_rpm.py
+++ b/numpy/distutils/command/bdist_rpm.py
@@ -19,6 +19,6 @@ class bdist_rpm(old_bdist_rpm):
return spec_file
new_spec_file = []
for line in spec_file:
- line = line.replace('setup.py',setup_py)
+ line = line.replace('setup.py', setup_py)
new_spec_file.append(line)
return new_spec_file
diff --git a/numpy/distutils/command/build.py b/numpy/distutils/command/build.py
index 0577738bf..b6912be15 100644
--- a/numpy/distutils/command/build.py
+++ b/numpy/distutils/command/build.py
@@ -19,7 +19,7 @@ class build(old_build):
]
help_options = old_build.help_options + [
- ('help-fcompiler',None, "list available Fortran compilers",
+ ('help-fcompiler', None, "list available Fortran compilers",
show_fortran_compilers),
]
diff --git a/numpy/distutils/command/build_clib.py b/numpy/distutils/command/build_clib.py
index ab40a71ea..84ca87250 100644
--- a/numpy/distutils/command/build_clib.py
+++ b/numpy/distutils/command/build_clib.py
@@ -42,13 +42,13 @@ class build_clib(old_build_clib):
def have_f_sources(self):
for (lib_name, build_info) in self.libraries:
- if has_f_sources(build_info.get('sources',[])):
+ if has_f_sources(build_info.get('sources', [])):
return True
return False
def have_cxx_sources(self):
for (lib_name, build_info) in self.libraries:
- if has_cxx_sources(build_info.get('sources',[])):
+ if has_cxx_sources(build_info.get('sources', [])):
return True
return False
@@ -63,7 +63,7 @@ class build_clib(old_build_clib):
self.run_command('build_src')
for (lib_name, build_info) in self.libraries:
- l = build_info.get('language',None)
+ l = build_info.get('language', None)
if l and l not in languages: languages.append(l)
from distutils.ccompiler import new_compiler
@@ -136,7 +136,7 @@ class build_clib(old_build_clib):
c_sources, cxx_sources, f_sources, fmodule_sources \
= filter_sources(sources)
requiref90 = not not fmodule_sources or \
- build_info.get('language','c')=='f90'
+ build_info.get('language', 'c')=='f90'
# save source type information so that build_ext can use it.
source_languages = []
@@ -148,14 +148,14 @@ class build_clib(old_build_clib):
lib_file = compiler.library_filename(lib_name,
output_dir=self.build_clib)
- depends = sources + build_info.get('depends',[])
+ depends = sources + build_info.get('depends', [])
if not (self.force or newer_group(depends, lib_file, 'newer')):
log.debug("skipping '%s' library (up-to-date)", lib_name)
return
else:
log.info("building '%s' library", lib_name)
- config_fc = build_info.get('config_fc',{})
+ config_fc = build_info.get('config_fc', {})
if fcompiler is not None and config_fc:
log.info('using additional config_fc from setup script '\
'for fortran compiler: %s' \
@@ -229,7 +229,7 @@ class build_clib(old_build_clib):
if fcompiler.module_dir_switch is None:
existing_modules = glob('*.mod')
extra_postargs += fcompiler.module_options(\
- module_dirs,module_build_dir)
+ module_dirs, module_build_dir)
if fmodule_sources:
log.info("compiling Fortran 90 module sources")
@@ -276,9 +276,9 @@ class build_clib(old_build_clib):
debug=self.debug)
# fix library dependencies
- clib_libraries = build_info.get('libraries',[])
+ clib_libraries = build_info.get('libraries', [])
for lname, binfo in libraries:
if lname in clib_libraries:
- clib_libraries.extend(binfo[1].get('libraries',[]))
+ clib_libraries.extend(binfo[1].get('libraries', []))
if clib_libraries:
build_info['libraries'] = clib_libraries
diff --git a/numpy/distutils/command/build_ext.py b/numpy/distutils/command/build_ext.py
index 97bfa1613..b48e4227a 100644
--- a/numpy/distutils/command/build_ext.py
+++ b/numpy/distutils/command/build_ext.py
@@ -37,7 +37,7 @@ class build_ext (old_build_ext):
]
help_options = old_build_ext.help_options + [
- ('help-fcompiler',None, "list available Fortran compilers",
+ ('help-fcompiler', None, "list available Fortran compilers",
show_fortran_compilers),
]
@@ -99,14 +99,14 @@ class build_ext (old_build_ext):
# Create mapping of libraries built by build_clib:
clibs = {}
if build_clib is not None:
- for libname,build_info in build_clib.libraries or []:
+ for libname, build_info in build_clib.libraries or []:
if libname in clibs and clibs[libname] != build_info:
log.warn('library %r defined more than once,'\
' overwriting build_info\n%s... \nwith\n%s...' \
% (libname, repr(clibs[libname])[:300], repr(build_info)[:300]))
clibs[libname] = build_info
# .. and distribution libraries:
- for libname,build_info in self.distribution.libraries or []:
+ for libname, build_info in self.distribution.libraries or []:
if libname in clibs:
# build_clib libraries have a precedence before distribution ones
continue
@@ -123,13 +123,13 @@ class build_ext (old_build_ext):
for libname in ext.libraries:
if libname in clibs:
binfo = clibs[libname]
- c_libs += binfo.get('libraries',[])
- c_lib_dirs += binfo.get('library_dirs',[])
- for m in binfo.get('macros',[]):
+ c_libs += binfo.get('libraries', [])
+ c_lib_dirs += binfo.get('library_dirs', [])
+ for m in binfo.get('macros', []):
if m not in macros:
macros.append(m)
- for l in clibs.get(libname,{}).get('source_languages',[]):
+ for l in clibs.get(libname, {}).get('source_languages', []):
ext_languages.add(l)
if c_libs:
new_c_libs = ext.libraries + c_libs
@@ -161,7 +161,7 @@ class build_ext (old_build_ext):
ext_language = 'c' # default
if l and l != ext_language and ext.language:
log.warn('resetting extension %r language from %r to %r.' %
- (ext.name,l,ext_language))
+ (ext.name, l, ext_language))
ext.language = ext_language
# global language
all_languages.update(ext_languages)
@@ -177,7 +177,7 @@ class build_ext (old_build_ext):
dry_run=self.dry_run,
force=self.force)
compiler = self._cxx_compiler
- compiler.customize(self.distribution,need_cxx=need_cxx_compiler)
+ compiler.customize(self.distribution, need_cxx=need_cxx_compiler)
compiler.customize_cmd(self)
compiler.show_customization()
self._cxx_compiler = compiler.cxx_compiler()
@@ -297,8 +297,8 @@ class build_ext (old_build_ext):
else: # in case ext.language is c++, for instance
fcompiler = self._f90_compiler or self._f77_compiler
if fcompiler is not None:
- fcompiler.extra_f77_compile_args = (ext.extra_f77_compile_args or []) if hasattr(ext,'extra_f77_compile_args') else []
- fcompiler.extra_f90_compile_args = (ext.extra_f90_compile_args or []) if hasattr(ext,'extra_f90_compile_args') else []
+ fcompiler.extra_f77_compile_args = (ext.extra_f77_compile_args or []) if hasattr(ext, 'extra_f77_compile_args') else []
+ fcompiler.extra_f90_compile_args = (ext.extra_f90_compile_args or []) if hasattr(ext, 'extra_f90_compile_args') else []
cxx_compiler = self._cxx_compiler
# check for the availability of required compilers
@@ -308,7 +308,7 @@ class build_ext (old_build_ext):
if (f_sources or fmodule_sources) and fcompiler is None:
raise DistutilsError("extension %r has Fortran sources " \
"but no Fortran compiler found" % (ext.name))
- if ext.language in ['f77','f90'] and fcompiler is None:
+ if ext.language in ['f77', 'f90'] and fcompiler is None:
self.warn("extension %r has Fortran libraries " \
"but no Fortran linker found, using default linker" % (ext.name))
if ext.language=='c++' and cxx_compiler is None:
@@ -347,14 +347,14 @@ class build_ext (old_build_ext):
log.info("compiling Fortran 90 module sources")
module_dirs = ext.module_dirs[:]
module_build_dir = os.path.join(
- self.build_temp,os.path.dirname(
+ self.build_temp, os.path.dirname(
self.get_ext_filename(fullname)))
self.mkpath(module_build_dir)
if fcompiler.module_dir_switch is None:
existing_modules = glob('*.mod')
extra_postargs += fcompiler.module_options(
- module_dirs,module_build_dir)
+ module_dirs, module_build_dir)
f_objects += fcompiler.compile(fmodule_sources,
output_dir=self.build_temp,
macros=macros,
@@ -402,7 +402,7 @@ class build_ext (old_build_ext):
# not using fcompiler linker
self._libs_with_msvc_and_fortran(fcompiler, libraries, library_dirs)
- elif ext.language in ['f77','f90'] and fcompiler is not None:
+ elif ext.language in ['f77', 'f90'] and fcompiler is not None:
linker = fcompiler.link_shared_object
if ext.language=='c++' and cxx_compiler is not None:
linker = cxx_compiler.link_shared_object
@@ -437,7 +437,7 @@ class build_ext (old_build_ext):
if libname.startswith('msvc'): continue
fileexists = False
for libdir in c_library_dirs or []:
- libfile = os.path.join(libdir,'%s.lib' % (libname))
+ libfile = os.path.join(libdir, '%s.lib' % (libname))
if os.path.isfile(libfile):
fileexists = True
break
@@ -445,7 +445,7 @@ class build_ext (old_build_ext):
# make g77-compiled static libs available to MSVC
fileexists = False
for libdir in c_library_dirs:
- libfile = os.path.join(libdir,'lib%s.a' % (libname))
+ libfile = os.path.join(libdir, 'lib%s.a' % (libname))
if os.path.isfile(libfile):
# copy libname.a file to name.lib so that MSVC linker
# can find it
@@ -465,7 +465,7 @@ class build_ext (old_build_ext):
# correct path when compiling in Cygwin but with normal Win
# Python
if dir.startswith('/usr/lib'):
- s,o = exec_command(['cygpath', '-w', dir], use_tee=False)
+ s, o = exec_command(['cygpath', '-w', dir], use_tee=False)
if not s:
dir = o
f_lib_dirs.append(dir)
diff --git a/numpy/distutils/command/build_py.py b/numpy/distutils/command/build_py.py
index c25fa227d..54dcde435 100644
--- a/numpy/distutils/command/build_py.py
+++ b/numpy/distutils/command/build_py.py
@@ -16,7 +16,7 @@ class build_py(old_build_py):
# Find build_src generated *.py files.
build_src = self.get_finalized_command('build_src')
- modules += build_src.py_modules_dict.get(package,[])
+ modules += build_src.py_modules_dict.get(package, [])
return modules
diff --git a/numpy/distutils/command/build_src.py b/numpy/distutils/command/build_src.py
index 2a33e5175..7463a0e17 100644
--- a/numpy/distutils/command/build_src.py
+++ b/numpy/distutils/command/build_src.py
@@ -66,7 +66,7 @@ class build_src(build_ext.build_ext):
"directory alongside your pure Python modules"),
]
- boolean_options = ['force','inplace']
+ boolean_options = ['force', 'inplace']
help_options = []
@@ -136,14 +136,14 @@ class build_src(build_ext.build_ext):
self.inplace = build_ext.inplace
if self.swig_cpp is None:
self.swig_cpp = build_ext.swig_cpp
- for c in ['swig','swig_opt']:
- o = '--'+c.replace('_','-')
- v = getattr(build_ext,c,None)
+ for c in ['swig', 'swig_opt']:
+ o = '--'+c.replace('_', '-')
+ v = getattr(build_ext, c, None)
if v:
- if getattr(self,c):
+ if getattr(self, c):
log.warn('both build_src and build_ext define %s option' % (o))
else:
- log.info('using "%s=%s" option from build_ext command' % (o,v))
+ log.info('using "%s=%s" option from build_ext command' % (o, v))
setattr(self, c, v)
def run(self):
@@ -179,14 +179,14 @@ class build_src(build_ext.build_ext):
from numpy.distutils.misc_util import get_data_files
new_data_files = []
for data in self.data_files:
- if isinstance(data,str):
+ if isinstance(data, str):
new_data_files.append(data)
- elif isinstance(data,tuple):
- d,files = data
+ elif isinstance(data, tuple):
+ d, files = data
if self.inplace:
build_dir = self.get_package_dir('.'.join(d.split(os.sep)))
else:
- build_dir = os.path.join(self.build_src,d)
+ build_dir = os.path.join(self.build_src, d)
funcs = [f for f in files if hasattr(f, '__call__')]
files = [f for f in files if not hasattr(f, '__call__')]
for f in funcs:
@@ -195,13 +195,13 @@ class build_src(build_ext.build_ext):
else:
s = f()
if s is not None:
- if isinstance(s,list):
+ if isinstance(s, list):
files.extend(s)
- elif isinstance(s,str):
+ elif isinstance(s, str):
files.append(s)
else:
raise TypeError(repr(s))
- filenames = get_data_files((d,files))
+ filenames = get_data_files((d, files))
new_data_files.append((d, filenames))
else:
raise TypeError(repr(data))
@@ -289,7 +289,7 @@ class build_src(build_ext.build_ext):
self.py_modules[:] = new_py_modules
def build_library_sources(self, lib_name, build_info):
- sources = list(build_info.get('sources',[]))
+ sources = list(build_info.get('sources', []))
if not sources:
return
@@ -396,10 +396,10 @@ class build_src(build_ext.build_ext):
return new_sources
def filter_py_files(self, sources):
- return self.filter_files(sources,['.py'])
+ return self.filter_files(sources, ['.py'])
def filter_h_files(self, sources):
- return self.filter_files(sources,['.h','.hpp','.inc'])
+ return self.filter_files(sources, ['.h', '.hpp', '.inc'])
def filter_files(self, sources, exts = []):
new_sources = []
@@ -428,7 +428,7 @@ class build_src(build_ext.build_ext):
else:
target_dir = appendpath(self.build_src, os.path.dirname(base))
self.mkpath(target_dir)
- target_file = os.path.join(target_dir,os.path.basename(base))
+ target_file = os.path.join(target_dir, os.path.basename(base))
if (self.force or newer_group([source] + depends, target_file)):
if _f_pyf_ext_match(base):
log.info("from_template:> %s" % (target_file))
@@ -436,7 +436,7 @@ class build_src(build_ext.build_ext):
else:
log.info("conv_template:> %s" % (target_file))
outstr = process_c_file(source)
- fid = open(target_file,'w')
+ fid = open(target_file, 'w')
fid.write(outstr)
fid.close()
if _header_ext_match(target_file):
@@ -515,20 +515,20 @@ class build_src(build_ext.build_ext):
raise DistutilsSetupError('mismatch of extension names: %s '
'provides %r but expected %r' % (
source, name, ext_name))
- target_file = os.path.join(target_dir,name+'module.c')
+ target_file = os.path.join(target_dir, name+'module.c')
else:
log.debug(' source %s does not exist: skipping f2py\'ing.' \
% (source))
name = ext_name
skip_f2py = 1
- target_file = os.path.join(target_dir,name+'module.c')
+ target_file = os.path.join(target_dir, name+'module.c')
if not os.path.isfile(target_file):
log.warn(' target %s does not exist:\n '\
'Assuming %smodule.c was generated with '\
'"build_src --inplace" command.' \
% (target_file, name))
target_dir = os.path.dirname(base)
- target_file = os.path.join(target_dir,name+'module.c')
+ target_file = os.path.join(target_dir, name+'module.c')
if not os.path.isfile(target_file):
raise DistutilsSetupError("%r missing" % (target_file,))
log.info(' Yes! Using %r as up-to-date target.' \
@@ -551,9 +551,9 @@ class build_src(build_ext.build_ext):
f2py_options = extension.f2py_options + self.f2py_opts
if self.distribution.libraries:
- for name,build_info in self.distribution.libraries:
+ for name, build_info in self.distribution.libraries:
if name in extension.libraries:
- f2py_options.extend(build_info.get('f2py_options',[]))
+ f2py_options.extend(build_info.get('f2py_options', []))
log.info("f2py options: %s" % (f2py_options))
@@ -566,12 +566,12 @@ class build_src(build_ext.build_ext):
target_file = f2py_targets[source]
target_dir = os.path.dirname(target_file) or '.'
depends = [source] + extension.depends
- if (self.force or newer_group(depends, target_file,'newer')) \
+ if (self.force or newer_group(depends, target_file, 'newer')) \
and not skip_f2py:
log.info("f2py: %s" % (source))
import numpy.f2py
numpy.f2py.run_main(f2py_options
- + ['--build-dir',target_dir,source])
+ + ['--build-dir', target_dir, source])
else:
log.debug(" skipping '%s' f2py interface (up-to-date)" % (source))
else:
@@ -581,7 +581,7 @@ class build_src(build_ext.build_ext):
else: name = extension.name
target_dir = os.path.join(*([self.build_src]\
+name.split('.')[:-1]))
- target_file = os.path.join(target_dir,ext_name + 'module.c')
+ target_file = os.path.join(target_dir, ext_name + 'module.c')
new_sources.append(target_file)
depends = f_sources + extension.depends
if (self.force or newer_group(depends, target_file, 'newer')) \
@@ -590,8 +590,8 @@ class build_src(build_ext.build_ext):
self.mkpath(target_dir)
import numpy.f2py
numpy.f2py.run_main(f2py_options + ['--lower',
- '--build-dir',target_dir]+\
- ['-m',ext_name]+f_sources)
+ '--build-dir', target_dir]+\
+ ['-m', ext_name]+f_sources)
else:
log.debug(" skipping f2py fortran files for '%s' (up-to-date)"\
% (target_file))
@@ -599,8 +599,8 @@ class build_src(build_ext.build_ext):
if not os.path.isfile(target_file):
raise DistutilsError("f2py target file %r not generated" % (target_file,))
- target_c = os.path.join(self.build_src,'fortranobject.c')
- target_h = os.path.join(self.build_src,'fortranobject.h')
+ target_c = os.path.join(self.build_src, 'fortranobject.c')
+ target_h = os.path.join(self.build_src, 'fortranobject.h')
log.info(" adding '%s' to sources." % (target_c))
new_sources.append(target_c)
if self.build_src not in extension.include_dirs:
@@ -611,20 +611,20 @@ class build_src(build_ext.build_ext):
if not skip_f2py:
import numpy.f2py
d = os.path.dirname(numpy.f2py.__file__)
- source_c = os.path.join(d,'src','fortranobject.c')
- source_h = os.path.join(d,'src','fortranobject.h')
- if newer(source_c,target_c) or newer(source_h,target_h):
+ source_c = os.path.join(d, 'src', 'fortranobject.c')
+ source_h = os.path.join(d, 'src', 'fortranobject.h')
+ if newer(source_c, target_c) or newer(source_h, target_h):
self.mkpath(os.path.dirname(target_c))
- self.copy_file(source_c,target_c)
- self.copy_file(source_h,target_h)
+ self.copy_file(source_c, target_c)
+ self.copy_file(source_h, target_h)
else:
if not os.path.isfile(target_c):
raise DistutilsSetupError("f2py target_c file %r not found" % (target_c,))
if not os.path.isfile(target_h):
raise DistutilsSetupError("f2py target_h file %r not found" % (target_h,))
- for name_ext in ['-f2pywrappers.f','-f2pywrappers2.f90']:
- filename = os.path.join(target_dir,ext_name + name_ext)
+ for name_ext in ['-f2pywrappers.f', '-f2pywrappers2.f90']:
+ filename = os.path.join(target_dir, ext_name + name_ext)
if os.path.isfile(filename):
log.info(" adding '%s' to sources." % (filename))
f_sources.append(filename)
@@ -689,7 +689,7 @@ class build_src(build_ext.build_ext):
log.warn('assuming that %r has c++ swig target' % (source))
if is_cpp:
target_ext = '.cpp'
- target_file = os.path.join(target_dir,'%s_wrap%s' \
+ target_file = os.path.join(target_dir, '%s_wrap%s' \
% (name, target_ext))
else:
log.warn(' source %s does not exist: skipping swig\'ing.' \
@@ -745,17 +745,17 @@ class build_src(build_ext.build_ext):
return new_sources + py_files
-_f_pyf_ext_match = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\Z',re.I).match
-_header_ext_match = re.compile(r'.*[.](inc|h|hpp)\Z',re.I).match
+_f_pyf_ext_match = re.compile(r'.*[.](f90|f95|f77|for|ftn|f|pyf)\Z', re.I).match
+_header_ext_match = re.compile(r'.*[.](inc|h|hpp)\Z', re.I).match
#### SWIG related auxiliary functions ####
_swig_module_name_match = re.compile(r'\s*%module\s*(.*\(\s*package\s*=\s*"(?P<package>[\w_]+)".*\)|)\s*(?P<name>[\w_]+)',
re.I).match
-_has_c_header = re.compile(r'-[*]-\s*c\s*-[*]-',re.I).search
-_has_cpp_header = re.compile(r'-[*]-\s*c[+][+]\s*-[*]-',re.I).search
+_has_c_header = re.compile(r'-[*]-\s*c\s*-[*]-', re.I).search
+_has_cpp_header = re.compile(r'-[*]-\s*c[+][+]\s*-[*]-', re.I).search
def get_swig_target(source):
- f = open(source,'r')
+ f = open(source, 'r')
result = None
line = f.readline()
if _has_cpp_header(line):
@@ -766,7 +766,7 @@ def get_swig_target(source):
return result
def get_swig_modulename(source):
- f = open(source,'r')
+ f = open(source, 'r')
name = None
for line in f:
m = _swig_module_name_match(line)
@@ -776,9 +776,9 @@ def get_swig_modulename(source):
f.close()
return name
-def _find_swig_target(target_dir,name):
- for ext in ['.cpp','.c']:
- target = os.path.join(target_dir,'%s_wrap%s' % (name, ext))
+def _find_swig_target(target_dir, name):
+ for ext in ['.cpp', '.c']:
+ target = os.path.join(target_dir, '%s_wrap%s' % (name, ext))
if os.path.isfile(target):
break
return target
@@ -788,7 +788,7 @@ def _find_swig_target(target_dir,name):
_f2py_module_name_match = re.compile(r'\s*python\s*module\s*(?P<name>[\w_]+)',
re.I).match
_f2py_user_module_name_match = re.compile(r'\s*python\s*module\s*(?P<name>[\w_]*?'\
- '__user__[\w_]*)',re.I).match
+ '__user__[\w_]*)', re.I).match
def get_f2py_modulename(source):
name = None
diff --git a/numpy/distutils/command/config.py b/numpy/distutils/command/config.py
index 3434dffee..5d363eb4e 100644
--- a/numpy/distutils/command/config.py
+++ b/numpy/distutils/command/config.py
@@ -80,15 +80,15 @@ class was %s
self.fcompiler.customize_cmd(self)
self.fcompiler.show_customization()
- def _wrap_method(self,mth,lang,args):
+ def _wrap_method(self, mth, lang, args):
from distutils.ccompiler import CompileError
from distutils.errors import DistutilsExecError
save_compiler = self.compiler
- if lang in ['f77','f90']:
+ if lang in ['f77', 'f90']:
self.compiler = self.fcompiler
try:
ret = mth(*((self,)+args))
- except (DistutilsExecError,CompileError):
+ except (DistutilsExecError, CompileError):
msg = str(get_exception())
self.compiler = save_compiler
raise CompileError
@@ -96,7 +96,7 @@ class was %s
return ret
def _compile (self, body, headers, include_dirs, lang):
- return self._wrap_method(old_config._compile,lang,
+ return self._wrap_method(old_config._compile, lang,
(body, headers, include_dirs, lang))
def _link (self, body,
@@ -105,14 +105,14 @@ class was %s
if self.compiler.compiler_type=='msvc':
libraries = (libraries or [])[:]
library_dirs = (library_dirs or [])[:]
- if lang in ['f77','f90']:
+ if lang in ['f77', 'f90']:
lang = 'c' # always use system linker when using MSVC compiler
if self.fcompiler:
for d in self.fcompiler.library_dirs or []:
# correct path when compiling in Cygwin but with
# normal Win Python
if d.startswith('/usr/lib'):
- s,o = exec_command(['cygpath', '-w', d],
+ s, o = exec_command(['cygpath', '-w', d],
use_tee=False)
if not s: d = o
library_dirs.append(d)
@@ -123,7 +123,7 @@ class was %s
if libname.startswith('msvc'): continue
fileexists = False
for libdir in library_dirs or []:
- libfile = os.path.join(libdir,'%s.lib' % (libname))
+ libfile = os.path.join(libdir, '%s.lib' % (libname))
if os.path.isfile(libfile):
fileexists = True
break
@@ -131,11 +131,11 @@ class was %s
# make g77-compiled static libs available to MSVC
fileexists = False
for libdir in library_dirs:
- libfile = os.path.join(libdir,'lib%s.a' % (libname))
+ libfile = os.path.join(libdir, 'lib%s.a' % (libname))
if os.path.isfile(libfile):
# copy libname.a file to name.lib so that MSVC linker
# can find it
- libfile2 = os.path.join(libdir,'%s.lib' % (libname))
+ libfile2 = os.path.join(libdir, '%s.lib' % (libname))
copy_file(libfile, libfile2)
self.temp_files.append(libfile2)
fileexists = True
@@ -145,7 +145,7 @@ class was %s
% (libname, library_dirs))
elif self.compiler.compiler_type == 'mingw32':
generate_manifest(self)
- return self._wrap_method(old_config._link,lang,
+ return self._wrap_method(old_config._link, lang,
(body, headers, include_dirs,
libraries, library_dirs, lang))
diff --git a/numpy/distutils/command/config_compiler.py b/numpy/distutils/command/config_compiler.py
index bf776dd02..5e638fecc 100644
--- a/numpy/distutils/command/config_compiler.py
+++ b/numpy/distutils/command/config_compiler.py
@@ -24,24 +24,24 @@ class config_fc(Command):
description = "specify Fortran 77/Fortran 90 compiler information"
user_options = [
- ('fcompiler=',None,"specify Fortran compiler type"),
+ ('fcompiler=', None, "specify Fortran compiler type"),
('f77exec=', None, "specify F77 compiler command"),
('f90exec=', None, "specify F90 compiler command"),
- ('f77flags=',None,"specify F77 compiler flags"),
- ('f90flags=',None,"specify F90 compiler flags"),
- ('opt=',None,"specify optimization flags"),
- ('arch=',None,"specify architecture specific optimization flags"),
- ('debug','g',"compile with debugging information"),
- ('noopt',None,"compile without optimization"),
- ('noarch',None,"compile without arch-dependent optimization"),
+ ('f77flags=', None, "specify F77 compiler flags"),
+ ('f90flags=', None, "specify F90 compiler flags"),
+ ('opt=', None, "specify optimization flags"),
+ ('arch=', None, "specify architecture specific optimization flags"),
+ ('debug', 'g', "compile with debugging information"),
+ ('noopt', None, "compile without optimization"),
+ ('noarch', None, "compile without arch-dependent optimization"),
]
help_options = [
- ('help-fcompiler',None, "list available Fortran compilers",
+ ('help-fcompiler', None, "list available Fortran compilers",
show_fortran_compilers),
]
- boolean_options = ['debug','noopt','noarch']
+ boolean_options = ['debug', 'noopt', 'noarch']
def initialize_options(self):
self.fcompiler = None
@@ -65,7 +65,7 @@ class config_fc(Command):
for a in ['fcompiler']:
l = []
for c in cmd_list:
- v = getattr(c,a)
+ v = getattr(c, a)
if v is not None:
if not isinstance(v, str): v = v.compiler_type
if v not in l: l.append(v)
@@ -76,7 +76,7 @@ class config_fc(Command):
', using first in list as default' % (a, l))
if v1:
for c in cmd_list:
- if getattr(c,a) is None: setattr(c, a, v1)
+ if getattr(c, a) is None: setattr(c, a, v1)
def run(self):
# Do nothing.
@@ -90,7 +90,7 @@ class config_cc(Command):
description = "specify C/C++ compiler information"
user_options = [
- ('compiler=',None,"specify C/C++ compiler type"),
+ ('compiler=', None, "specify C/C++ compiler type"),
]
def initialize_options(self):
@@ -106,7 +106,7 @@ class config_cc(Command):
for a in ['compiler']:
l = []
for c in cmd_list:
- v = getattr(c,a)
+ v = getattr(c, a)
if v is not None:
if not isinstance(v, str): v = v.compiler_type
if v not in l: l.append(v)
@@ -117,7 +117,7 @@ class config_cc(Command):
', using first in list as default' % (a, l))
if v1:
for c in cmd_list:
- if getattr(c,a) is None: setattr(c, a, v1)
+ if getattr(c, a) is None: setattr(c, a, v1)
return
def run(self):
diff --git a/numpy/distutils/command/install.py b/numpy/distutils/command/install.py
index 9dd8dede9..2da21542f 100644
--- a/numpy/distutils/command/install.py
+++ b/numpy/distutils/command/install.py
@@ -41,7 +41,7 @@ class install(old_install):
# work.
#
caller = sys._getframe(3)
- caller_module = caller.f_globals.get('__name__','')
+ caller_module = caller.f_globals.get('__name__', '')
caller_name = caller.f_code.co_name
if caller_module != 'distutils.dist' or caller_name!='run_commands':
@@ -61,7 +61,7 @@ class install(old_install):
# bdist_rpm fails when INSTALLED_FILES contains
# paths with spaces. Such paths must be enclosed
# with double-quotes.
- f = open(self.record,'r')
+ f = open(self.record, 'r')
lines = []
need_rewrite = False
for l in f:
diff --git a/numpy/distutils/command/install_headers.py b/numpy/distutils/command/install_headers.py
index 84eb5f6da..f3f58aa28 100644
--- a/numpy/distutils/command/install_headers.py
+++ b/numpy/distutils/command/install_headers.py
@@ -12,7 +12,7 @@ class install_headers (old_install_headers):
prefix = os.path.dirname(self.install_dir)
for header in headers:
- if isinstance(header,tuple):
+ if isinstance(header, tuple):
# Kind of a hack, but I don't know where else to change this...
if header[0] == 'numpy.core':
header = ('numpy', header[1])
diff --git a/numpy/distutils/command/sdist.py b/numpy/distutils/command/sdist.py
index 7d8cc7826..bfaab1c8f 100644
--- a/numpy/distutils/command/sdist.py
+++ b/numpy/distutils/command/sdist.py
@@ -22,7 +22,7 @@ class sdist(old_sdist):
if dist.has_headers():
headers = []
for h in dist.headers:
- if isinstance(h,str): headers.append(h)
+ if isinstance(h, str): headers.append(h)
else: headers.append(h[1])
self.filelist.extend(headers)