提交 0d9af1bc authored 作者: Olivier Delalleau's avatar Olivier Delalleau

More readable error when compilation fails

上级 9517a606
...@@ -1407,8 +1407,13 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[] ...@@ -1407,8 +1407,13 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[]
print >> sys.stderr, '%05i\t%s'%(i+1, l) print >> sys.stderr, '%05i\t%s'%(i+1, l)
print '===============================' print '==============================='
print_command_line_error() print_command_line_error()
raise Exception('Compilation failed (return status=%s):\n%s' % # Print errors just below the command line.
(status, compile_stderr)) print compile_stderr
# We replace '\n' by '. ' in the error message because when Python
# prints the exception, having '\n' in the text makes it more difficult
# to read.
raise Exception('Compilation failed (return status=%s): %s' %
(status, compile_stderr.replace('\n', '. ')))
#touch the __init__ file #touch the __init__ file
file(os.path.join(location, "__init__.py"),'w').close() file(os.path.join(location, "__init__.py"),'w').close()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论