本文整理汇总了Python中pypy.translator.c.genc.CStandaloneBuilder.eci方法的典型用法代码示例。如果您正苦于以下问题:Python CStandaloneBuilder.eci方法的具体用法?Python CStandaloneBuilder.eci怎么用?Python CStandaloneBuilder.eci使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pypy.translator.c.genc.CStandaloneBuilder
的用法示例。
在下文中一共展示了CStandaloneBuilder.eci方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_separate_files
# 需要导入模块: from pypy.translator.c.genc import CStandaloneBuilder [as 别名]
# 或者: from pypy.translator.c.genc.CStandaloneBuilder import eci [as 别名]
def test_separate_files(self):
# One file in translator/c/src
fname = py.path.local(pypydir).join(
'translator', 'c', 'src', 'll_strtod.h')
# One file in (another) subdir of the temp directory
dirname = udir.join("test_dir").ensure(dir=1)
fname2 = dirname.join("test_genc.c")
fname2.write("""
void f() {
LL_strtod_formatd("%5f", 12.3);
}""")
files = [fname, fname2]
def entry_point(argv):
return 0
t = TranslationContext(self.config)
t.buildannotator().build_types(entry_point, [s_list_of_strings])
t.buildrtyper().specialize()
cbuilder = CStandaloneBuilder(t, entry_point, t.config)
cbuilder.eci = cbuilder.eci.merge(
ExternalCompilationInfo(separate_module_files=files))
cbuilder.generate_source()
makefile = udir.join(cbuilder.modulename, 'Makefile').read()
# generated files are compiled in the same directory
assert " ../test_dir/test_genc.c" in makefile
assert " ../test_dir/test_genc.o" in makefile
# but files from pypy source dir must be copied
assert "translator/c/src" not in makefile
assert " ll_strtod.h" in makefile
assert " ll_strtod.o" in makefile