本文整理汇总了Python中waflib.Utils.pprint方法的典型用法代码示例。如果您正苦于以下问题:Python Utils.pprint方法的具体用法?Python Utils.pprint怎么用?Python Utils.pprint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Utils
的用法示例。
在下文中一共展示了Utils.pprint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_intltool_po
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import pprint [as 别名]
def apply_intltool_po(self):
try:
self.meths.remove("process_source")
except ValueError:
pass
self.default_install_path = "${LOCALEDIR}"
appname = getattr(self, "appname", "set_your_app_name")
podir = getattr(self, "podir", "")
def install_translation(task):
out = task.outputs[0]
filename = out.name
(langname, ext) = os.path.splitext(filename)
inst_file = langname + os.sep + "LC_MESSAGES" + os.sep + appname + ".mo"
self.bld.install_as(os.path.join(self.install_path, inst_file), out, self.env, self.chmod)
linguas = self.path.find_resource(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")
task.set_inputs(node)
task.set_outputs(node.change_ext(".mo"))
if self.bld.is_install:
task.install = install_translation
else:
Utils.pprint("RED", "Error no LINGUAS file found in po directory")
示例2: daemon
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import pprint [as 别名]
def daemon(ctx):
"""waf command: rebuild as soon as something changes"""
bld = None
while True:
bld = Context.create_context('build')
try:
bld.options = Options.options
bld.cmd = 'build'
bld.execute()
except ctx.errors.WafError as e:
print(e)
except KeyboardInterrupt:
Utils.pprint('RED', 'interrupted')
break
try:
x = ctx.state
except AttributeError:
setattr(ctx, 'state', DirWatch())
x = ctx.state
x.wait(bld)
示例3: summary
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import pprint [as 别名]
def summary(bld):
lst = getattr(bld, 'utest_results', [])
if lst:
Utils.pprint('CYAN', 'execution summary')
for (f, fail, ret) in lst:
col = fail and 'RED' or 'GREEN'
Utils.pprint(col, (fail and 'FAIL' or 'ok') + " " + f)
if fail: Utils.pprint('NORMAL', ret.replace('\\n', '\n'))
示例4: apply_intltool_po
# 需要导入模块: from waflib import Utils [as 别名]
# 或者: from waflib.Utils import pprint [as 别名]
def apply_intltool_po(self):
try: self.meths.remove('process_source')
except ValueError: pass
self.default_install_path = '${LOCALEDIR}'
appname = getattr(self, 'appname', 'set_your_app_name')
podir = getattr(self, 'podir', '')
def install_translation(task):
out = task.outputs[0]
filename = out.name
(langname, ext) = os.path.splitext(filename)
inst_file = langname + os.sep + 'LC_MESSAGES' + os.sep + appname + '.mo'
self.bld.install_as(os.path.join(self.install_path, inst_file), out, self.env, self.chmod)
linguas = self.path.find_resource(os.path.join(podir, 'LINGUAS'))
if linguas:
# scan LINGUAS file for locales to process
file = open(linguas.abspath())
langs = []
for line in file.readlines():
# ignore lines containing comments
if not line.startswith('#'):
langs += line.split()
file.close()
re_linguas = re.compile('[[email protected]]+')
for lang in langs:
# Make sure that we only process lines which contain locales
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')
task.set_inputs(node)
task.set_outputs(node.change_ext('.mo'))
if self.bld.is_install: task.install = install_translation
else:
Utils.pprint('RED', "Error no LINGUAS file found in po directory")