本文整理汇总了Python中waflib.Logs.pprint方法的典型用法代码示例。如果您正苦于以下问题:Python Logs.pprint方法的具体用法?Python Logs.pprint怎么用?Python Logs.pprint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Logs
的用法示例。
在下文中一共展示了Logs.pprint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def run(self, perf_run, available_params, configurations):
test_build_path = self.path.make_node(self.bldnode.name + '_tests')
Options.lockfile = Options.lockfile + '_tests'
Options.options.out = test_build_path.abspath()
Options.options.profiling = self.env.profiling
Options.options.input_file = os.path.relpath(self.env.INPUT_FILE, self.path.abspath())
Options.options.reference_file = os.path.relpath(self.env.REFERENCE_FILE, self.path.abspath())
for configuration in configurations:
for configuration_param in available_params:
setattr(Options.options, configuration_param, configuration_param in configuration['modules'])
Logs.pprint('PINK', 'Testing %s build...' % configuration['id'])
Scripting.run_command('configure')
Scripting.run_command('build')
Scripting.run_command('perf' if perf_run else 'debug')
self.exec_command('cp %s %s' % (
test_build_path.find_node('current_profile.txt').abspath(),
self.bldnode.make_node('%s_profile.txt' % configuration['id']).abspath()))
if perf_run:
self.exec_command('cp %s %s' % (
test_build_path.find_node('current_profile_detailed.json').abspath(),
self.bldnode.make_node('%s_profile_detailed.json' % configuration['id']).abspath()))
Scripting.run_command('distclean')
示例2: execute
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def execute(self):
"""see Context.execute"""
self.load()
if not self.all_envs:
self.load_envs()
self.recurse([self.run_dir])
self.pre_build()
# display the time elapsed in the progress bar
self.timer = Utils.Timer()
for g in self.groups:
for tg in g:
if isinstance(tg, TaskGen.task_gen):
tg.post()
try:
# force the cache initialization
self.get_tgen_by_name('')
except:
pass
lst = list(self.task_gen_cache_names.keys())
lst.sort()
for k in lst:
Logs.pprint('GREEN', k)
示例3: run
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def run(self):
filename = self.inputs[0].abspath()
cwd = self.inputs[0].parent.abspath()
try:
proc = Utils.subprocess.Popen(filename, cwd=cwd, stderr=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE)
(stdout, stderr) = proc.communicate()
except OSError:
Logs.pprint('RED', 'Failed to run test: %s' % filename)
return
tup = (filename, proc.returncode, stdout, stderr)
self.generator.utest_result = tup
testlock.acquire()
try:
bld = self.generator.bld
Logs.debug("ut: %r", tup)
try:
bld.utest_results.append(tup)
except AttributeError:
bld.utest_results = [tup]
a = getattr(self.generator.bld, 'added_post_fun', False)
if not a:
self.generator.bld.add_post_fun(summary)
self.generator.bld.added_post_fun = True
finally:
testlock.release()
示例4: summary
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def summary(bld):
lst = getattr(bld, 'utest_results', [])
if not lst: return
total = len(lst)
fail = len([x for x in lst if x[1]])
Logs.pprint('CYAN', 'test summary')
Logs.pprint('CYAN', ' tests that pass %d/%d' % (total-fail, total))
for (f, code, out, err) in lst:
if not code:
Logs.pprint('GREEN', ' %s' % f)
if isinstance(Options.options.checkfilter, str):
print(err)
print(out)
if fail>0:
Logs.pprint('RED', ' tests that fail %d/%d' % (fail, total))
for (f, code, out, err) in lst:
if code:
Logs.pprint('RED', ' %s' % f)
print(err.decode('utf-8'))
print(out.decode('utf-8'))
raise Errors.WafError('test failed')
示例5: installlapack
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def installlapack(ctx):
filen = version+".tgz"
atl.installsmthg_pre(ctx,"http://www.netlib.org/lapack/"+filen,filen)
from waflib import Utils,Errors
dii = {"FCC":ctx.env.FC,"FCFLAGS":" ".join(ctx.env.FCFLAGS+ctx.env.FCFLAGS_fcshlib),"FLINKFLAGS":" ".join(ctx.env.FCFLAGS+ctx.env.LINKFLAGS_fcshlib),"SO":ctx.env.shsuffix,"MFLAG":" ".join(ctx.env.FCFLAGS) }
Logs.pprint("PINK","build blas")
f=open("build/%s/make.inc"%version,"w")
print >>f,make_inc_blas%dii
f.close()
cmdline = "cd build/%s; make blaslib"%version
if ctx.exec_command(cmdline)!=0:
raise Errors.WafError("Cannot build %s"%version)
Logs.pprint("PINK","build lapack")
f=open("build/%s/make.inc"%version,"w")
print >>f,make_inc_lapack%dii
f.close()
cmdline = "cd build/%s; make lapacklib"%version
if ctx.exec_command(cmdline)!=0:
raise Errors.WafError("Cannot build %s"%version)
import shutil
shutil.copyfile("build/%s/liblapack_clik.%s"%(version,ctx.env.shsuffix), osp.join(ctx.env.LIBDIR,"liblapack_clik.%s"%ctx.env.shsuffix))
shutil.copyfile("build/%s/libblas_clik.%s"%(version,ctx.env.shsuffix), osp.join(ctx.env.LIBDIR,"libblas_clik.%s"%ctx.env.shsuffix))
do_include(ctx)
示例6: apply_intltool_po
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def apply_intltool_po(self):
try:self.meths.remove('process_source')
except ValueError:pass
self.ensure_localedir()
appname=getattr(self,'appname',getattr(Context.g_module,Context.APPNAME,'set_your_app_name'))
podir=getattr(self,'podir','.')
inst=getattr(self,'install_path','${LOCALEDIR}')
linguas=self.path.find_node(os.path.join(podir,'LINGUAS'))
if linguas:
file=open(linguas.abspath())
langs=[]
for line in file.readlines():
if not line.startswith('#'):
langs+=line.split()
file.close()
re_linguas=re.compile('[[email protected]]+')
for lang in langs:
if re_linguas.match(lang):
node=self.path.find_resource(os.path.join(podir,re_linguas.match(lang).group()+'.po'))
task=self.create_task('po',node,node.change_ext('.mo'))
if inst:
filename=task.outputs[0].name
(langname,ext)=os.path.splitext(filename)
inst_file=inst+os.sep+langname+os.sep+'LC_MESSAGES'+os.sep+appname+'.mo'
self.bld.install_as(inst_file,task.outputs[0],chmod=getattr(self,'chmod',Utils.O644),env=task.env)
else:
Logs.pprint('RED',"Error no LINGUAS file found in po directory")
示例7: post_test
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def post_test(ctx,appname,dirs=['src'],remove=['*boost*','c++*']):
diropts=''
for i in dirs:
diropts+=' -d '+i
coverage_log=open('lcov-coverage.log','w')
coverage_lcov=open('coverage.lcov','w')
coverage_stripped_lcov=open('coverage-stripped.lcov','w')
try:
try:
base='.'
if g_is_child:
base='..'
subprocess.call(('lcov -c %s -b %s'%(diropts,base)).split(),stdout=coverage_lcov,stderr=coverage_log)
subprocess.call(['lcov','--remove','coverage.lcov']+remove,stdout=coverage_stripped_lcov,stderr=coverage_log)
if not os.path.isdir('coverage'):
os.makedirs('coverage')
subprocess.call('genhtml -o coverage coverage-stripped.lcov'.split(),stdout=coverage_log,stderr=coverage_log)
except:
Logs.warn('Failed to run lcov, no coverage report will be generated')
finally:
coverage_stripped_lcov.close()
coverage_lcov.close()
coverage_log.close()
print('')
Logs.pprint('GREEN',"Waf: Leaving directory `%s'"%os.path.abspath(os.getcwd()))
top_level=(len(ctx.stack_path)>1)
if top_level:
cd_to_orig_dir(ctx,top_level)
print('')
Logs.pprint('BOLD','Coverage:',sep='')
print('<file://%s>\n\n'%os.path.abspath('coverage/index.html'))
示例8: summary
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def summary(bld):
"""
Display an execution summary::
def build(bld):
bld(features='cxx cxxprogram test', source='main.c', target='app')
from waflib.Tools import waf_unit_test
bld.add_post_fun(waf_unit_test.summary)
"""
lst = getattr(bld, 'utest_results', [])
if lst:
Logs.pprint('CYAN', 'execution summary')
total = len(lst)
tfail = len([x for x in lst if x[1]])
Logs.pprint('CYAN', ' tests that pass %d/%d' % (total-tfail, total))
for (f, code, out, err) in lst:
if not code:
Logs.pprint('CYAN', ' %s' % f)
Logs.pprint('CYAN', ' tests that fail %d/%d' % (tfail, total))
for (f, code, out, err) in lst:
if code:
Logs.pprint('CYAN', ' %s' % f)
示例9: summary
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def summary(bld):
"""
Show the status of Google Test
"""
lst = getattr(bld, 'utest_results', [])
if not lst:
return
Logs.pprint('CYAN', '[test summary]')
nfails = 0
for (f, code, out, err, result) in lst:
fail = int(result.attrib['failures'])
if fail > 0:
nfails += fail
for failure in result.iter('failure'):
message = failure.attrib['message']
message_body = '\n'.join(message.split('\n')[1:])
message = message.split('\n')[0]
m = re.compile(r'^(.*):([0-9]+)$').match(message)
body = m.group(1)
num = int(m.group(2))
Logs.error('{}({}): error: {}'.format(body, num, message_body))
if nfails > 0:
raise Errors.WafError('test failed')
示例10: end_msg
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def end_msg(self, *k, **kw):
"""Prints the end of a 'Checking for' message. See :py:meth:`waflib.Context.Context.msg`"""
if kw.get("quiet"):
return
self.in_msg -= 1
if self.in_msg:
return
result = kw.get("result") or k[0]
defcolor = "GREEN"
if result == True:
msg = "ok"
elif result == False:
msg = "not found"
defcolor = "YELLOW"
else:
msg = str(result)
self.to_log(msg)
try:
color = kw["color"]
except KeyError:
if len(k) > 1 and k[1] in Logs.colors_lst:
# compatibility waf 1.7
color = k[1]
else:
color = defcolor
Logs.pprint(color, msg)
示例11: summary
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def summary(bld):
lst = getattr(bld, "utest_results", [])
if not lst:
return
total = len(lst)
fail = len([x for x in lst if x[1]])
Logs.pprint("CYAN", "test summary")
Logs.pprint("CYAN", " tests that pass %d/%d" % (total - fail, total))
for (f, code, out, err) in lst:
if not code:
Logs.pprint("GREEN", " %s" % f)
if isinstance(Options.options.checkfilter, str):
print(out)
if fail > 0:
Logs.pprint("RED", " tests that fail %d/%d" % (fail, total))
for (f, code, out, err) in lst:
if code:
Logs.pprint("RED", " %s" % f)
print(out.decode("utf-8"))
raise Errors.WafError("test failed")
示例12: execute
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def execute(self):
"""
See :py:func:`waflib.Context.Context.execute`.
"""
self.restore()
if not self.all_envs:
self.load_envs()
self.recurse([self.run_dir])
self.pre_build()
# display the time elapsed in the progress bar
self.timer = Utils.Timer()
for g in self.groups:
for tg in g:
try:
f = tg.post
except AttributeError:
pass
else:
f()
try:
# force the cache initialization
self.get_tgen_by_name('')
except Exception:
pass
lst = list(self.task_gen_cache_names.keys())
lst.sort()
for k in lst:
Logs.pprint('GREEN', k)
示例13: end_msg
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def end_msg(self, *k, **kw):
"""Print the end of a 'Checking for' message. See :py:meth:`waflib.Context.Context.msg`"""
if kw.get('quiet', None):
return
self.in_msg -= 1
if self.in_msg:
return
result = kw.get('result', None) or k[0]
defcolor = 'GREEN'
if result == True:
msg = 'ok'
elif result == False:
msg = 'not found'
defcolor = 'YELLOW'
else:
msg = str(result)
self.to_log(msg)
try:
color = kw['color']
except KeyError:
if len(k) > 1 and k[1] in Logs.colors_lst:
# compatibility waf 1.7
color = k[1]
else:
color = defcolor
Logs.pprint(color, msg)
示例14: serve
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def serve(ctx):
ctx.load('python')
ctx.load('wurf_tools')
print('Starting Development Server...')
app_root = ctx.root.find_dir(ctx.env.APPENGINE_APP_ROOT)
if not app_root:
ctx.fatal('Unable to locate application directory ({0})'.format(ctx.env.APPENGINE_APP_ROOT))
cmd = ctx.env.PYTHON + [ctx.env.APPENGINE_SDK_DEVAPPSERVER,
app_root.get_bld().abspath(),
#app_root.abspath(),
]
#if not ctx.options.port is None:
# cmd += ['--port', str(ctx.options.port)]
proc = Popen(cmd)
try:
proc.wait()
except KeyboardInterrupt:
Logs.pprint('RED', 'Development Server Interrupted... Shutting Down')
proc.terminate()
示例15: unpack_archive
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def unpack_archive (src_dir_node, name, filename = None, dest_dir_node = None):
if not dest_dir_node:
dest_dir_node = src_dir_node
src_dir = src_dir_node.abspath()
dest_dir = dest_dir_node.abspath()
# path is the destination folder where the file is extracted
path = os.path.join (dest_dir, name)
if not os.path.isdir (path): # if not already extracted
# extract the sources
os.makedirs (path)
if not filename:
filename = "%s.tar.gz" % name
Logs.pprint ("NORMAL", "Unpacking %s" % filename)
t = tarfile.open (os.path.join (src_dir, filename))
t.extractall (dest_dir)
node = dest_dir_node.find_dir (name)
assert node
return node