提交 3ba4b4cc authored 作者: Pascal Lamblin's avatar Pascal Lamblin

add py_module argument to GCC_compiler.compile_str

上级 486f4931
......@@ -1483,7 +1483,7 @@ class GCC_compiler(object):
@staticmethod
def compile_str(module_name, src_code, location=None,
include_dirs=None, lib_dirs=None, libs=None,
preargs=None):
preargs=None, py_module=True):
"""
:param module_name: string (this has been embedded in the src_code
......@@ -1503,7 +1503,11 @@ class GCC_compiler(object):
:param preargs: a list of extra compiler arguments
:param py_module: if False, compile to a shared library, but do not
import it as a Python module.
:returns: dynamically-imported python module of the compiled code.
(unless py_module is False, in that case returns None.)
"""
#TODO: Do not do the dlimport in this function
......@@ -1628,9 +1632,10 @@ class GCC_compiler(object):
# Print errors just below the command line.
print compile_stderr
#touch the __init__ file
file(os.path.join(location, "__init__.py"), 'w').close()
return dlimport(lib_filename)
if py_module:
#touch the __init__ file
file(os.path.join(location, "__init__.py"), 'w').close()
return dlimport(lib_filename)
def icc_module_compile_str(*args):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论