当前位置: 首页>>代码示例>>Python>>正文


Python ExternalCompilationInfo.convert_sources_to_files方法代码示例

本文整理汇总了Python中pypy.translator.tool.cbuild.ExternalCompilationInfo.convert_sources_to_files方法的典型用法代码示例。如果您正苦于以下问题:Python ExternalCompilationInfo.convert_sources_to_files方法的具体用法?Python ExternalCompilationInfo.convert_sources_to_files怎么用?Python ExternalCompilationInfo.convert_sources_to_files使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pypy.translator.tool.cbuild.ExternalCompilationInfo的用法示例。


在下文中一共展示了ExternalCompilationInfo.convert_sources_to_files方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_convert_sources_to_c_files

# 需要导入模块: from pypy.translator.tool.cbuild import ExternalCompilationInfo [as 别名]
# 或者: from pypy.translator.tool.cbuild.ExternalCompilationInfo import convert_sources_to_files [as 别名]
 def test_convert_sources_to_c_files(self):
     eci = ExternalCompilationInfo(
         separate_module_sources = ['xxx'],
         separate_module_files = ['x.c'],
     )
     cache_dir = udir.join('test_convert_sources').ensure(dir=1)
     neweci = eci.convert_sources_to_files(cache_dir)
     assert not neweci.separate_module_sources
     res = neweci.separate_module_files
     assert len(res) == 2
     assert res[0] == 'x.c'
     assert str(res[1]).startswith(str(cache_dir))
     e = ExternalCompilationInfo()
     assert e.convert_sources_to_files() is e
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:16,代码来源:test_cbuild.py

示例2: compile_module

# 需要导入模块: from pypy.translator.tool.cbuild import ExternalCompilationInfo [as 别名]
# 或者: from pypy.translator.tool.cbuild.ExternalCompilationInfo import convert_sources_to_files [as 别名]
def compile_module(space, modname, **kwds):
    """
    Build an extension module and return the filename of the resulting native
    code file.

    modname is the name of the module, possibly including dots if it is a module
    inside a package.

    Any extra keyword arguments are passed on to ExternalCompilationInfo to
    build the module (so specify your source with one of those).
    """
    modname = modname.split('.')[-1]
    eci = ExternalCompilationInfo(
        export_symbols=['init%s' % (modname,)],
        include_dirs=api.include_dirs,
        **kwds
        )
    eci = eci.convert_sources_to_files()
    dirname = (udir/uniquemodulename('module')).ensure(dir=1)
    soname = platform.platform.compile(
        [], eci,
        outputfilename=str(dirname/modname),
        standalone=False)
    from pypy.module.imp.importing import get_so_extension
    pydname = soname.new(purebasename=modname, ext=get_so_extension(space))
    soname.rename(pydname)
    return str(pydname)
开发者ID:ieure,项目名称:pypy,代码行数:29,代码来源:test_cpyext.py


注:本文中的pypy.translator.tool.cbuild.ExternalCompilationInfo.convert_sources_to_files方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。