本文整理匯總了Python中rpython.translator.c.genc.CStandaloneBuilder.eci方法的典型用法代碼示例。如果您正苦於以下問題:Python CStandaloneBuilder.eci方法的具體用法?Python CStandaloneBuilder.eci怎麽用?Python CStandaloneBuilder.eci使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rpython.translator.c.genc.CStandaloneBuilder
的用法示例。
在下文中一共展示了CStandaloneBuilder.eci方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_separate_files
# 需要導入模塊: from rpython.translator.c.genc import CStandaloneBuilder [as 別名]
# 或者: from rpython.translator.c.genc.CStandaloneBuilder import eci [as 別名]
def test_separate_files(self):
# One file in translator/c/src
fname = py.path.local(cdir).join('src', 'll_strtod.c')
# 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(12.3, 'f', 5);
}""")
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.c" in makefile
assert " ll_strtod.o" in makefile