Commit 360609df authored by Stefan Behnel's avatar Stefan Behnel

fix "exclude_failures" mode in cythonize() by also ignoring stripped C files...

fix "exclude_failures" mode in cythonize() by also ignoring stripped C files from compilation failures
parent b07d9d79
......@@ -18,6 +18,11 @@ try:
except ImportError:
import md5 as hashlib
try:
from io import open as io_open
except ImportError:
from codecs import open as io_open
try:
from os.path import relpath as _relpath
except ImportError:
......@@ -761,8 +766,16 @@ def cythonize(module_list, exclude=[], nthreads=0, aliases=None, quiet=False, fo
for c_file, modules in modules_by_cfile.iteritems():
if not os.path.exists(c_file):
failed_modules.update(modules)
for module in failed_modules:
module_list.remove(module)
elif os.path.getsize(c_file) < 200:
with io_open(c_file, 'r', encoding='iso8859-1') as f:
if f.read(len('#error ')) == '#error ':
# dead compilation result
failed_modules.update(modules)
if failed_modules:
for module in failed_modules:
module_list.remove(module)
print("Failed compilations: %s" % ', '.join(sorted([
module.name for module in failed_modules])))
if hasattr(options, 'cache'):
cleanup_cache(options.cache, getattr(options, 'cache_size', 1024 * 1024 * 100))
# cythonize() is often followed by the (non-Python-buffered)
......
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