本文整理汇总了Python中waflib.Logs.pprint方法的典型用法代码示例。如果您正苦于以下问题:Python Logs.pprint方法的具体用法?Python Logs.pprint怎么用?Python Logs.pprint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Logs
的用法示例。
在下文中一共展示了Logs.pprint方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_msg
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def start_msg(self,*k,**kw):
if kw.get('quiet',None):
return
msg=kw.get('msg',None)or k[0]
try:
if self.in_msg:
self.in_msg+=1
return
except AttributeError:
self.in_msg=0
self.in_msg+=1
try:
self.line_just=max(self.line_just,len(msg))
except AttributeError:
self.line_just=max(40,len(msg))
for x in(self.line_just*'-',msg):
self.to_log(x)
Logs.pprint('NORMAL',"%s :"%msg.ljust(self.line_just),sep='')
示例2: end_msg
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def end_msg(self,*k,**kw):
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:
color=k[1]
else:
color=defcolor
Logs.pprint(color,msg)
示例3: execute
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def execute(self):
self.restore()
if not self.all_envs:
self.load_envs()
self.recurse([self.run_dir])
self.pre_build()
self.timer=Utils.Timer()
for g in self.groups:
for tg in g:
try:
f=tg.post
except AttributeError:
pass
else:
f()
try:
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)
示例4: summary
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def summary(bld):
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)
示例5: 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('[-a-zA-Z_@.]+')
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")
示例6: check_boost
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def check_boost(self, *k, **kw):
"""
initialize boost
You can pass the same parameters as the command line (without "--boost-"),
but the command line has the priority.
"""
if not self.env['CXX']:
self.fatal('load a c++ compiler first, conf.load("compiler_cxx")')
params = {'lib': k and k[0] or kw.get('lib', None)}
for key, value in self.options.__dict__.items():
if not key.startswith('boost_'):
continue
key = key[len('boost_'):]
params[key] = value and value or kw.get(key, '')
var = kw.get('uselib_store', 'BOOST')
self.start_msg('Checking boost includes')
try:
self.env['INCLUDES_%s' % var] = self.boost_get_includes(**params)
self.env.BOOST_VERSION = self.boost_get_version(self.env['INCLUDES_%s' % var])
except WafError:
self.end_msg("not found", 'YELLOW')
raise
self.end_msg(self.env.BOOST_VERSION)
if Logs.verbose:
Logs.pprint('CYAN', ' path : %s' % self.env['INCLUDES_%s' % var])
if not params['lib']:
return
self.start_msg('Checking boost libs')
try:
suffix = params.get('static', 'ST') or ''
path, libs = self.boost_get_libs(**params)
except WafError:
self.end_msg("not found", 'YELLOW')
raise
self.env['%sLIBPATH_%s' % (suffix, var)] = [path]
self.env['%sLIB_%s' % (suffix, var)] = libs
self.end_msg('ok')
if Logs.verbose:
Logs.pprint('CYAN', ' path : %s' % path)
Logs.pprint('CYAN', ' libs : %s' % libs)
示例7: process_settings
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def process_settings(self):
enums_tgt_node=[]
install_files=[]
settings_schema_files=getattr(self,'settings_schema_files',[])
if settings_schema_files and not self.env['GLIB_COMPILE_SCHEMAS']:
raise Errors.WafError("Unable to process GSettings schemas - glib-compile-schemas was not found during configure")
if hasattr(self,'settings_enum_files'):
enums_task=self.create_task('glib_mkenums')
source_list=self.settings_enum_files
source_list=[self.path.find_resource(k)for k in source_list]
enums_task.set_inputs(source_list)
enums_task.env['GLIB_MKENUMS_SOURCE']=[k.abspath()for k in source_list]
target=self.settings_enum_namespace+'.enums.xml'
tgt_node=self.path.find_or_declare(target)
enums_task.set_outputs(tgt_node)
enums_task.env['GLIB_MKENUMS_TARGET']=tgt_node.abspath()
enums_tgt_node=[tgt_node]
install_files.append(tgt_node)
options='--comments "<!-- @comment@ -->" --fhead "<schemalist>" --vhead " <@type@ id=\\"%s.@EnumName@\\">" --vprod " <value nick=\\"@valuenick@\\" value=\\"@valuenum@\\"/>" --vtail " </@type@>" --ftail "</schemalist>" '%(self.settings_enum_namespace)
enums_task.env['GLIB_MKENUMS_OPTIONS']=options
for schema in settings_schema_files:
schema_task=self.create_task('glib_validate_schema')
schema_node=self.path.find_resource(schema)
if not schema_node:
raise Errors.WafError("Cannot find the schema file '%s'"%schema)
install_files.append(schema_node)
source_list=enums_tgt_node+[schema_node]
schema_task.set_inputs(source_list)
schema_task.env['GLIB_COMPILE_SCHEMAS_OPTIONS']=[("--schema-file="+k.abspath())for k in source_list]
target_node=schema_node.change_ext('.xml.valid')
schema_task.set_outputs(target_node)
schema_task.env['GLIB_VALIDATE_SCHEMA_OUTPUT']=target_node.abspath()
def compile_schemas_callback(bld):
if not bld.is_install:return
Logs.pprint('YELLOW','Updating GSettings schema cache')
command=Utils.subst_vars("${GLIB_COMPILE_SCHEMAS} ${GSETTINGSSCHEMADIR}",bld.env)
ret=self.bld.exec_command(command)
if self.bld.is_install:
if not self.env['GSETTINGSSCHEMADIR']:
raise Errors.WafError('GSETTINGSSCHEMADIR not defined (should have been set up automatically during configure)')
if install_files:
self.bld.install_files(self.env['GSETTINGSSCHEMADIR'],install_files)
if not hasattr(self.bld,'_compile_schemas_registered'):
self.bld.add_post_fun(compile_schemas_callback)
self.bld._compile_schemas_registered=True
示例8: process_settings
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import pprint [as 别名]
def process_settings(self):
enums_tgt_node=[]
install_files=[]
settings_schema_files=getattr(self,'settings_schema_files',[])
if settings_schema_files and not self.env['GLIB_COMPILE_SCHEMAS']:
raise Errors.WafError("Unable to process GSettings schemas - glib-compile-schemas was not found during configure")
if hasattr(self,'settings_enum_files'):
enums_task=self.create_task('glib_mkenums')
source_list=self.settings_enum_files
source_list=[self.path.find_resource(k)for k in source_list]
enums_task.set_inputs(source_list)
enums_task.env['GLIB_MKENUMS_SOURCE']=[k.abspath()for k in source_list]
target=self.settings_enum_namespace+'.enums.xml'
tgt_node=self.path.find_or_declare(target)
enums_task.set_outputs(tgt_node)
enums_task.env['GLIB_MKENUMS_TARGET']=tgt_node.abspath()
enums_tgt_node=[tgt_node]
install_files.append(tgt_node)
options='--comments "<!-- @comment@ -->" --fhead "<schemalist>" --vhead " <@type@ id=\\"%s.@EnumName@\\">" --vprod " <value nick=\\"@valuenick@\\" value=\\"@valuenum@\\"/>" --vtail " </@type@>" --ftail "</schemalist>" '%(self.settings_enum_namespace)
enums_task.env['GLIB_MKENUMS_OPTIONS']=options
for schema in settings_schema_files:
schema_task=self.create_task('glib_validate_schema')
schema_node=self.path.find_resource(schema)
if not schema_node:
raise Errors.WafError("Cannot find the schema file '%s'"%schema)
install_files.append(schema_node)
source_list=enums_tgt_node+[schema_node]
schema_task.set_inputs(source_list)
schema_task.env['GLIB_COMPILE_SCHEMAS_OPTIONS']=[("--schema-file="+k.abspath())for k in source_list]
target_node=schema_node.change_ext('.xml.valid')
schema_task.set_outputs(target_node)
schema_task.env['GLIB_VALIDATE_SCHEMA_OUTPUT']=target_node.abspath()
def compile_schemas_callback(bld):
if not bld.is_install:return
Logs.pprint('YELLOW','Updating GSettings schema cache')
command=Utils.subst_vars("${GLIB_COMPILE_SCHEMAS} ${GSETTINGSSCHEMADIR}",bld.env)
self.bld.exec_command(command)
if self.bld.is_install:
if not self.env['GSETTINGSSCHEMADIR']:
raise Errors.WafError('GSETTINGSSCHEMADIR not defined (should have been set up automatically during configure)')
if install_files:
self.bld.install_files(self.env['GSETTINGSSCHEMADIR'],install_files)
if not hasattr(self.bld,'_compile_schemas_registered'):
self.bld.add_post_fun(compile_schemas_callback)
self.bld._compile_schemas_registered=True