本文整理汇总了Python中pypy.translator.jvm.option.getoption函数的典型用法代码示例。如果您正苦于以下问题:Python getoption函数的具体用法?Python getoption怎么用?Python getoption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getoption函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: detect_missing_support_programs
def detect_missing_support_programs():
def check(exechelper):
if py.path.local.sysfind(exechelper) is None:
py.test.skip("%s is not on your path" % exechelper)
check(getoption('jasmin'))
check(getoption('javac'))
check(getoption('java'))
开发者ID:antoine1fr,项目名称:pygirl,代码行数:7,代码来源:genjvm.py
示例2: compile
def compile(self):
"""
Compiles the .java sources into .class files, ready for execution.
"""
jascmd = [getoption('jasmin'), '-g', '-d', str(self.javadir)]
def split_list(files):
"Split the files list into manageable pieces"
# - On Windows 2000, commands in .bat are limited to 2047 chars.
# - But the 'jasmin' script contains a line like
# path_to_jre/java -jar path_to_jasmin/jasmin.jar $*
# So we limit the length of arguments files to:
MAXLINE = 1500
chunk = []
chunklen = 0
for f in files:
# Account for the space between items
chunklen += len(f) + 1
if chunklen > MAXLINE:
yield chunk
chunk = []
chunklen = len(f)
chunk.append(f)
if chunk:
yield chunk
for files in split_list(self.jasmin_files):
print "Invoking jasmin on %s" % files
self._invoke(jascmd + files, False)
print "... completed!"
self.compiled = True
self._compile_helper()
开发者ID:antoine1fr,项目名称:pygirl,代码行数:35,代码来源:genjvm.py
示例3: __init__
def __init__(self, class_name):
# We put all of our classes into some package like 'pypy':
# strip the initial 'pypy.' that results from the class name,
# and we append a number to make the class name unique. Strip
# those.
pkg = getoption('package')+'.'
assert class_name.startswith(pkg)
uniqidx = class_name.rindex('_')
self.class_name = class_name[len(pkg):uniqidx]
开发者ID:alkorzt,项目名称:pypy,代码行数:9,代码来源:runtest.py
示例4: __init__
def __init__(self, tmpdir, translator, entrypoint):
"""
'tmpdir' --- where the generated files will go. In fact, we will
put our binaries into the directory pypy/jvm
'translator' --- a TranslationContext object
'entrypoint' --- if supplied, an object with a render method
"""
GenOO.__init__(self, tmpdir, translator, entrypoint)
self.jvmsrc = JvmGeneratedSource(tmpdir, getoption('package'))
开发者ID:enyst,项目名称:plexnet,代码行数:9,代码来源:genjvm.py
示例5: generate_source_for_function
def generate_source_for_function(func, annotation):
"""
Given a Python function and some hints about its argument types,
generates JVM sources that call it and print the result. Returns
the JvmGeneratedSource object.
"""
if hasattr(func, 'im_func'):
func = func.im_func
t = TranslationContext()
ann = t.buildannotator()
ann.build_types(func, annotation)
t.buildrtyper(type_system="ootype").specialize()
main_graph = t.graphs[0]
if getoption('view'): t.view()
if getoption('wd'): tmpdir = py.path.local('.')
else: tmpdir = udir
jvm = GenJvm(tmpdir, t, EntryPoint(main_graph, True, True))
return jvm.generate_source()
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:20,代码来源:genjvm.py
示例6: _compile
def _compile(self, fn, args, ann=None):
if ann is None:
ann = [lltype_to_annotation(typeOf(x)) for x in args]
if self._func is fn and self._ann == ann:
return JvmGeneratedSourceWrapper(self._jvm_src)
else:
self._func = fn
self._ann = ann
self._jvm_src = generate_source_for_function(fn, ann)
if not getoption('noasm'):
self._jvm_src.compile()
return JvmGeneratedSourceWrapper(self._jvm_src)
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:12,代码来源:runtest.py
示例7: compile
def compile(self, fn, args, ann=None, backendopt=False):
if ann is None:
ann = [lltype_to_annotation(typeOf(x)) for x in args]
if self._func is fn and self._ann == ann:
return JvmGeneratedSourceWrapper(self._jvm_src)
else:
self._func = fn
self._ann = ann
olddefs = patch_os()
self._jvm_src = generate_source_for_function(fn, ann, backendopt)
unpatch_os(olddefs)
if not getoption('noasm'):
self._jvm_src.compile()
return JvmGeneratedSourceWrapper(self._jvm_src)
开发者ID:alkorzt,项目名称:pypy,代码行数:14,代码来源:runtest.py
示例8: run
def run(self,*args):
if not self.gensrc.compiled:
py.test.skip("Assembly disabled")
if getoption('norun'):
py.test.skip("Execution disabled")
# if self._exe is None:
# py.test.skip("Compilation disabled")
# if getoption('norun'):
# py.test.skip("Execution disabled")
stdout, stderr, retval = self.gensrc.execute(args)
return stdout, stderr, retval
开发者ID:alkorzt,项目名称:pypy,代码行数:15,代码来源:runtest.py
示例9: __call__
def __call__(self, *args):
if not self.gensrc.compiled:
py.test.skip("Assembly disabled")
if getoption('norun'):
py.test.skip("Execution disabled")
resstr = self.gensrc.execute(args)
print "resstr=%s" % repr(resstr)
res = eval(resstr)
if isinstance(res, tuple):
res = StructTuple(res) # so tests can access tuple elements with .item0, .item1, etc.
elif isinstance(res, list):
res = OOList(res)
return res
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:15,代码来源:runtest.py
示例10: __call__
def __call__(self, *args):
if not self.gensrc.compiled:
py.test.skip("Assembly disabled")
if getoption('norun'):
py.test.skip("Execution disabled")
stdout, stderr, retval = self.gensrc.execute(args)
res = eval(stdout.strip())
if isinstance(res, tuple):
res = StructTuple(res) # so tests can access tuple elements with .item0, .item1, etc.
elif isinstance(res, list):
res = OOList(res)
elif isinstance(res, ExceptionWrapper):
raise res
return res
开发者ID:alkorzt,项目名称:pypy,代码行数:16,代码来源:runtest.py
示例11: _compile_helper
def _compile_helper(self):
# HACK: compile the Java helper classes. Should eventually
# use rte.py
if JvmGeneratedSource._cached == self.classdir:
return
log.red('Compiling java classes')
javafiles = self.srcdir.listdir('*.java')
javasrcs = [str(jf) for jf in javafiles]
self._invoke([getoption('javac'),
'-nowarn',
'-d', str(self.classdir),
'-classpath', str(self.jnajar),
] + javasrcs,
True)
# NOTE if you are trying to add more caching: some .java files
# compile to several .class files of various names.
JvmGeneratedSource._cached = self.classdir
开发者ID:enyst,项目名称:plexnet,代码行数:17,代码来源:genjvm.py
示例12: execute
def execute(self, args):
"""
Executes the compiled sources in a separate process. Returns the
output as a string. The 'args' are provided as arguments,
and will be converted to strings.
"""
assert self.compiled
strargs = [self._make_str(a) for a in args]
cmd = [getoption('java'),
'-cp',
str(self.javadir),
self.package+".Main"] + strargs
print "Invoking java to run the code"
stdout, stderr = self._invoke(cmd, True)
print "...done!"
sys.stderr.write(stderr)
return stdout
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:17,代码来源:genjvm.py
示例13: _compile_helper
def _compile_helper(self, clsnms):
# HACK: compile the Java helper class. Should eventually
# use rte.py
tocompile = []
for clsnm in clsnms:
pypycls = self.classdir.join(clsnm + '.class')
if not pypycls.check():
tocompile.append(clsnm)
if tocompile:
thisdir = py.magic.autopath().dirpath()
javasrcs = [str(thisdir.join('src/pypy', clsnm + '.java')) for
clsnm in tocompile]
self._invoke([getoption('javac'),
'-nowarn',
'-d', str(self.classdir)]+
javasrcs,
True)
开发者ID:TheDunn,项目名称:flex-pypy,代码行数:17,代码来源:genjvm.py
示例14: _trace_enabled
def _trace_enabled(self):
return getoption('trace')
开发者ID:antoine1fr,项目名称:pygirl,代码行数:2,代码来源:node.py
示例15: _pkg
def _pkg(self, nm):
return "%s.%s" % (getoption('package'), nm)
开发者ID:Debug-Orz,项目名称:Sypy,代码行数:2,代码来源:database.py
注:本文中的pypy.translator.jvm.option.getoption函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论