Commit 673f1210 authored by Stefan Behnel's avatar Stefan Behnel

suppress more output in cythonize() when 'quiet' flag is passed

parent 8880c78f
...@@ -326,8 +326,9 @@ def parse_dependencies(source_filename): ...@@ -326,8 +326,9 @@ def parse_dependencies(source_filename):
class DependencyTree(object): class DependencyTree(object):
def __init__(self, context): def __init__(self, context, quiet=False):
self.context = context self.context = context
self.quiet = quiet
self._transitive_cache = {} self._transitive_cache = {}
def parse_dependencies(self, source_filename): def parse_dependencies(self, source_filename):
...@@ -347,7 +348,7 @@ class DependencyTree(object): ...@@ -347,7 +348,7 @@ class DependencyTree(object):
include_path = os.path.normpath(include_path) include_path = os.path.normpath(include_path)
all.add(include_path) all.add(include_path)
all.update(self.included_files(include_path)) all.update(self.included_files(include_path))
else: elif not self.quiet:
print("Unable to locate '%s' referenced from '%s'" % (filename, include)) print("Unable to locate '%s' referenced from '%s'" % (filename, include))
return all return all
...@@ -401,11 +402,10 @@ class DependencyTree(object): ...@@ -401,11 +402,10 @@ class DependencyTree(object):
if module[:7] == 'cython.' or module == 'cython': if module[:7] == 'cython.' or module == 'cython':
continue continue
pxd_file = self.find_pxd(module, filename) pxd_file = self.find_pxd(module, filename)
if pxd_file is None: if pxd_file is not None:
print("missing cimport: %s" % filename)
print(module)
else:
pxd_list.append(pxd_file) pxd_list.append(pxd_file)
elif not self.quiet:
print("missing cimport in module '%s': %s" % (module, filename))
return tuple(pxd_list) return tuple(pxd_list)
@cached_method @cached_method
...@@ -490,19 +490,19 @@ class DependencyTree(object): ...@@ -490,19 +490,19 @@ class DependencyTree(object):
del stack[node] del stack[node]
_dep_tree = None _dep_tree = None
def create_dependency_tree(ctx=None): def create_dependency_tree(ctx=None, quiet=False):
global _dep_tree global _dep_tree
if _dep_tree is None: if _dep_tree is None:
if ctx is None: if ctx is None:
ctx = Context(["."], CompilationOptions(default_options)) ctx = Context(["."], CompilationOptions(default_options))
_dep_tree = DependencyTree(ctx) _dep_tree = DependencyTree(ctx, quiet=quiet)
return _dep_tree return _dep_tree
# This may be useful for advanced users? # This may be useful for advanced users?
def create_extension_list(patterns, exclude=[], ctx=None, aliases=None): def create_extension_list(patterns, exclude=[], ctx=None, aliases=None, quiet=False):
explicit_modules = set([m.name for m in patterns if isinstance(m, Extension)]) explicit_modules = set([m.name for m in patterns if isinstance(m, Extension)])
seen = set() seen = set()
deps = create_dependency_tree(ctx) deps = create_dependency_tree(ctx, quiet=quiet)
to_exclude = set() to_exclude = set()
if not isinstance(exclude, list): if not isinstance(exclude, list):
exclude = [exclude] exclude = [exclude]
...@@ -575,8 +575,9 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo ...@@ -575,8 +575,9 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
module_list, module_list,
exclude=exclude, exclude=exclude,
ctx=ctx, ctx=ctx,
quiet=quiet,
aliases=aliases) aliases=aliases)
deps = create_dependency_tree(ctx) deps = create_dependency_tree(ctx, quiet=quiet)
to_compile = [] to_compile = []
for m in module_list: for m in module_list:
new_sources = [] new_sources = []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment