8000 ENH: Make numpy.distutils.system_info.get_info("blas_opt") print less by nouiz · Pull Request #4081 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Make numpy.distutils.system_info.get_info("blas_opt") print less #4081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
8000 Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions numpy/distutils/command/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def check_compiler_gcc4(self):

def get_output(self, body, headers=None, include_dirs=None,
libraries=None, library_dirs=None,
lang="c"):
lang="c", use_tee=None):
"""Try to compile, link to an executable, and run a program
built from 'body' and 'headers'. Returns the exit status code
of the program and its output.
Expand All @@ -426,7 +426,8 @@ def get_output(self, body, headers=None, include_dirs=None,
grabber.restore()
raise
exe = os.path.join('.', exe)
exitstatus, output = exec_command(exe, execute_in='.')
exitstatus, output = exec_command(exe, execute_in='.',
use_tee=use_tee)
if hasattr(os, 'WEXITSTATUS'):
exitcode = os.WEXITSTATUS(exitstatus)
if os.WIFSIGNALED(exitstatus):
Expand Down
2 changes: 1 addition & 1 deletion numpy/distutils/exec_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def find_executable(exe, path=None, _cache={}):
if not os.path.islink(f_ext):
f_ext = realpath(f_ext)
if os.path.isfile(f_ext) and os.access(f_ext, os.X_OK):
log.good('Found executable %s' % f_ext)
log.info('Found executable %s' % f_ext)
_cache[key] = f_ext
return f_ext

Expand Down
45 changes: 25 additions & 20 deletions numpy/distutils/system_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def get_standard_file(fname):
return filenames


def get_info(name, notfound_action=0):
def get_info(name, notfound_action=0, verbosity=None):
"""
notfound_action:
0 - do nothing
Expand Down Expand Up @@ -347,7 +347,7 @@ def get_info(name, notfound_action=0):
'umfpack': umfpack_info,
'amd': amd_info,
}.get(name.lower(), system_info)
return cl().get_info(notfound_action)
return cl(verbosity=verbosity).get_info(notfound_action)


class NotFoundError(DistutilsError):
Expand Down Expand Up @@ -444,7 +444,7 @@ class system_info:
def __init__(self,
default_lib_dirs=default_lib_dirs,
default_include_dirs=default_include_dirs,
verbosity=1,
verbosity=None,
):
self.__class__.info = {}
self.local_prefixes = []
Expand All @@ -463,6 +463,8 @@ def __init__(self,
self.search_static_first = self.cp.getboolean(
self.section, 'search_static_first')
assert isinstance(self.search_static_first, int)
if verbosity is not None:
self.verbosity = verbosity

def parse_config_files(self):
self.cp.read(self.files)
Expand Down Expand Up @@ -756,9 +758,6 @@ class fftw_info(system_info):
'includes':['fftw.h', 'rfftw.h'],
'macros':[('SCIPY_FFTW_H', None)]}]

def __init__(self):
system_info.__init__(self)

def calc_ver_info(self, ver_param):
"""Returns True on successful version detection, else False"""
lib_dirs = self.get_lib_dirs()
Expand Down Expand Up @@ -929,10 +928,10 @@ def get_mkl_rootdir(self):
return d
return None

def __init__(self):
def __init__(self, verbosity=None):
mklroot = self.get_mkl_rootdir()
if mklroot is None:
system_info.__init__(self)
system_info.__init__(self, verbosity=verbosity)
else:
from .cpuinfo import cpu
l = 'mkl' # use shared library
Expand All @@ -950,7 +949,8 @@ def __init__(self):
system_info.__init__(
self,
default_lib_dirs=[os.path.join(mklroot, 'lib', plt)],
default_include_dirs=[os.path.join(mklroot, 'include')])
default_include_dirs=[os.path.join(mklroot, 'include')],
verbosity=verbosity)

def calc_info(self):
lib_dirs = self.get_lib_dirs()
Expand Down Expand Up @@ -1094,8 +1094,8 @@ def calc_info(self):
else:
info['language'] = 'f77'

atlas_version, atlas_extra_info = get_atlas_version(**atlas)
dict_append(info, **atlas_extra_info)
atlas_info = get_atlas_version(verbosity=self.verbosity, **atlas)
dict_append(info, **atlas_info[1])

self.set_info(**info)

Expand All @@ -1119,8 +1119,8 @@ def calc_info(self):
dict_append(info, include_dirs=[h])
info['language'] = 'c'

atlas_version, atlas_extra_info = get_atlas_version(**atlas)
dict_append(atlas, **atlas_extra_info)
atlas_info = get_atlas_version(verbosity=self.verbosity, **atlas)
dict_append(atlas, **atlas_info[1])

dict_append(info, **atlas)

Expand Down Expand Up @@ -1294,6 +1294,7 @@ def calc_info(self):
def get_atlas_version(**config):
libraries = config.get('libraries', [])
library_dirs = config.get('library_dirs', [])
verbosity = config.get('verbosity', 1)
key = (tuple(libraries), tuple(library_dirs))
if key in _cached_atlas_version:
return _cached_atlas_version[key]
Expand All @@ -1302,11 +1303,13 @@ def get_atlas_version(**config):
info = {}
try:
s, o = c.get_output(atlas_version_c_text,
libraries=libraries, library_dirs=library_dirs)
libraries=libraries, library_dirs=library_dirs,
use_tee=verbosity)
if s and re.search(r'undefined reference to `_gfortran', o, re.M):
s, o = c.get_output(atlas_version_c_text,
libraries=libraries + ['gfortran'],
library_dirs=library_dirs)
library_dirs=library_dirs,
use_tee=verbosity)
if not s:
warnings.warn("""
*****************************************************
Expand Down Expand Up @@ -1480,7 +1483,7 @@ def calc_info(self):
if not atlas_info:
atlas_info = get_info('atlas_blas')

if sys.platform == 'darwin'and not atlas_info:
if sys.platform == 'darwin' and not atlas_info:
# Use the system BLAS from Accelerate or vecLib under OSX
args = []
link_args = []
Expand Down Expand Up @@ -1629,10 +1632,11 @@ class x11_info(system_info):
section = 'x11'
notfounderror = X11NotFoundError

def __init__(self):
def __init__(self, verbosity=None):
system_info.__init__(self,
default_lib_dirs=default_x11_lib_dirs,
default_include_dirs=default_x11_include_dirs)
default_include_dirs=default_x11_include_dirs,
verbosity=verbosity)

def calc_info(self):
if sys.platform in ['win32']:
Expand All @@ -1658,7 +1662,7 @@ class _numpy_info(system_info):
modulename = 'Numeric'
notfounderror = NumericNotFoundError

def __init__(self):
def __init__(self, verbosity=None):
include_dirs = []
try:
module = __import__(self.modulename)
Expand Down Expand Up @@ -1690,7 +1694,8 @@ def __init__(self):
include_dirs.append(d)
system_info.__init__(self,
default_lib_dirs=[],
default_include_dirs=include_dirs)
default_include_dirs=include_dirs,
verbosity=verbosity)

def calc_info(self):
try:
Expand Down
0