本文整理汇总了Python中waflib.Logs.info方法的典型用法代码示例。如果您正苦于以下问题:Python Logs.info方法的具体用法?Python Logs.info怎么用?Python Logs.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Logs
的用法示例。
在下文中一共展示了Logs.info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: bibfile
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def bibfile(self):
for aux_node in self.aux_nodes:
try:
ct=aux_node.read()
except EnvironmentError:
Logs.error('Error reading %s: %r'%aux_node.abspath())
continue
if g_bibtex_re.findall(ct):
Logs.info('calling bibtex')
self.env.env={}
self.env.env.update(os.environ)
self.env.env.update({'BIBINPUTS':self.texinputs(),'BSTINPUTS':self.texinputs()})
self.env.SRCFILE=aux_node.name[:-4]
self.check_status('error when calling bibtex',self.bibtex_fun())
for node in getattr(self,'multibibs',[]):
self.env.env={}
self.env.env.update(os.environ)
self.env.env.update({'BIBINPUTS':self.texinputs(),'BSTINPUTS':self.texinputs()})
self.env.SRCFILE=node.name[:-4]
self.check_status('error when calling bibtex',self.bibtex_fun())
示例2: run
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def run(self):
env=self.env
if not env['PROMPT_LATEX']:
env.append_value('LATEXFLAGS','-interaction=batchmode')
env.append_value('PDFLATEXFLAGS','-interaction=batchmode')
env.append_value('XELATEXFLAGS','-interaction=batchmode')
self.cwd=self.inputs[0].parent.get_bld().abspath()
Logs.info('first pass on %s'%self.__class__.__name__)
cur_hash=self.hash_aux_nodes()
self.call_latex()
self.hash_aux_nodes()
self.bibtopic()
self.bibfile()
self.bibunits()
self.makeindex()
self.makeglossaries()
for i in range(10):
prev_hash=cur_hash
cur_hash=self.hash_aux_nodes()
if not cur_hash:
Logs.error('No aux.h to process')
if cur_hash and cur_hash==prev_hash:
break
Logs.info('calling %s'%self.__class__.__name__)
self.call_latex()
示例3: exec_command
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def exec_command(self,cmd,**kw):
subprocess=Utils.subprocess
kw['shell']=isinstance(cmd,str)
Logs.debug('runner: %r'%(cmd,))
Logs.debug('runner_env: kw=%s'%kw)
if self.logger:
self.logger.info(cmd)
if'stdout'not in kw:
kw['stdout']=subprocess.PIPE
if'stderr'not in kw:
kw['stderr']=subprocess.PIPE
if Logs.verbose and not kw['shell']and not Utils.check_exe(cmd[0]):
raise Errors.WafError("Program %s not found!"%cmd[0])
try:
if kw['stdout']or kw['stderr']:
p=subprocess.Popen(cmd,**kw)
(out,err)=p.communicate()
ret=p.returncode
else:
out,err=(None,None)
ret=subprocess.Popen(cmd,**kw).wait()
except Exception ,e:
raise Errors.WafError('Execution failure: %s'%str(e),ex=e)
示例4: do_link
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def do_link(self,src,tgt,**kw):
d,_=os.path.split(tgt)
Utils.check_dir(d)
link=False
if not os.path.islink(tgt):
link=True
elif os.readlink(tgt)!=src:
link=True
if link:
try:os.remove(tgt)
except OSError:pass
if not self.progress_bar:
Logs.info('+ symlink %s (to %s)'%(tgt,src))
os.symlink(src,tgt)
else:
if not self.progress_bar:
Logs.info('- symlink %s (to %s)'%(tgt,src))
示例5: write_compilation_database
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def write_compilation_database(ctx):
"Write the clang compilation database as JSON"
database_file = ctx.bldnode.make_node('compile_commands.json')
Logs.info("Build commands will be stored in %s" % database_file.path_from(ctx.path))
try:
root = json.load(database_file)
except IOError:
root = []
clang_db = dict((x["file"], x) for x in root)
for task in getattr(ctx, 'clang_compilation_database_tasks', []):
try:
cmd = task.last_cmd
except AttributeError:
continue
directory = getattr(task, 'cwd', ctx.variant_dir)
f_node = task.inputs[0]
filename = os.path.relpath(f_node.abspath(), directory)
cmd = " ".join(map(quote, cmd))
entry = {
"directory": directory,
"command": cmd,
"file": filename,
}
clang_db[filename] = entry
root = list(clang_db.values())
database_file.write(json.dumps(root, indent=2))
示例6: exec_command
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def exec_command(self,cmd,**kw):
bld=self.generator.bld
Logs.info('runner: %r'%cmd)
try:
if not kw.get('cwd',None):
kw['cwd']=bld.cwd
except AttributeError:
bld.cwd=kw['cwd']=bld.variant_dir
return Utils.subprocess.Popen(cmd,**kw).wait()
示例7: bibunits
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def bibunits(self):
try:
bibunits=bibunitscan(self)
except OSError:
Logs.error('error bibunitscan')
else:
if bibunits:
fn=['bu'+str(i)for i in range(1,len(bibunits)+1)]
if fn:
Logs.info('calling bibtex on bibunits')
for f in fn:
self.env.env={'BIBINPUTS':self.texinputs(),'BSTINPUTS':self.texinputs()}
self.env.SRCFILE=f
self.check_status('error when calling bibtex',self.bibtex_fun())
示例8: makeindex
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def makeindex(self):
self.idx_node=self.inputs[0].change_ext('.idx')
try:
idx_path=self.idx_node.abspath()
os.stat(idx_path)
except OSError:
Logs.info('index file %s absent, not calling makeindex'%idx_path)
else:
Logs.info('calling makeindex')
self.env.SRCFILE=self.idx_node.name
self.env.env={}
self.check_status('error when calling makeindex %s'%idx_path,self.makeindex_fun())
示例9: run_commands
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def run_commands():
parse_options()
run_command('init')
while Options.commands:
cmd_name=Options.commands.pop(0)
ctx=run_command(cmd_name)
Logs.info('%r finished successfully (%s)'%(cmd_name,str(ctx.log_timer)))
run_command('shutdown')
示例10: archive
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def archive(self):
import tarfile
arch_name=self.get_arch_name()
try:
self.base_path
except AttributeError:
self.base_path=self.path
node=self.base_path.make_node(arch_name)
try:
node.delete()
except OSError:
pass
files=self.get_files()
if self.algo.startswith('tar.'):
tar=tarfile.open(arch_name,'w:'+self.algo.replace('tar.',''))
for x in files:
self.add_tar_file(x,tar)
tar.close()
elif self.algo=='zip':
import zipfile
zip=zipfile.ZipFile(arch_name,'w',compression=zipfile.ZIP_DEFLATED)
for x in files:
archive_name=self.get_base_name()+'/'+x.path_from(self.base_path)
zip.write(x.abspath(),archive_name,zipfile.ZIP_DEFLATED)
zip.close()
else:
self.fatal('Valid algo types are tar.bz2, tar.gz, tar.xz or zip')
try:
from hashlib import sha1 as sha
except ImportError:
from sha import sha
try:
digest=" (sha=%r)"%sha(node.read()).hexdigest()
except Exception:
digest=''
Logs.info('New archive created: %s%s'%(self.arch_name,digest))
示例11: fatal
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def fatal(self,msg,ex=None):
if self.logger:
self.logger.info('from %s: %s'%(self.path.abspath(),msg))
try:
msg='%s\n(complete log in %s)'%(msg,self.logger.handlers[0].baseFilename)
except Exception:
pass
raise self.errors.ConfigurationError(msg,ex=ex)
示例12: to_log
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def to_log(self,msg):
if not msg:
return
if self.logger:
self.logger.info(msg)
else:
sys.stderr.write(str(msg))
sys.stderr.flush()
示例13: do_install
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def do_install(self,src,tgt,**kw):
d,_=os.path.split(tgt)
if not d:
raise Errors.WafError('Invalid installation given %r->%r'%(src,tgt))
Utils.check_dir(d)
srclbl=src.replace(self.srcnode.abspath()+os.sep,'')
if not Options.options.force:
try:
st1=os.stat(tgt)
st2=os.stat(src)
except OSError:
pass
else:
if st1.st_mtime+2>=st2.st_mtime and st1.st_size==st2.st_size:
if not self.progress_bar:
Logs.info('- install %s (from %s)'%(tgt,srclbl))
return False
if not self.progress_bar:
Logs.info('+ install %s (from %s)'%(tgt,srclbl))
try:
os.chmod(tgt,Utils.O644|stat.S_IMODE(os.stat(tgt).st_mode))
except EnvironmentError:
pass
try:
os.remove(tgt)
except OSError:
pass
try:
self.copy_fun(src,tgt,**kw)
except IOError:
try:
os.stat(src)
except EnvironmentError:
Logs.error('File %r does not exist'%src)
raise Errors.WafError('Could not install the file %r'%tgt)
示例14: compile
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def compile(self):
if not self.files:
Logs.warn('Add a pattern for the debug build, for example "waf step --files=main.c,app"')
BuildContext.compile(self)
return
targets=None
if self.targets and self.targets!='*':
targets=self.targets.split(',')
for g in self.groups:
for tg in g:
if targets and tg.name not in targets:
continue
try:
f=tg.post
except AttributeError:
pass
else:
f()
for pat in self.files.split(','):
matcher=self.get_matcher(pat)
for tg in g:
if isinstance(tg,Task.TaskBase):
lst=[tg]
else:
lst=tg.tasks
for tsk in lst:
do_exec=False
for node in getattr(tsk,'inputs',[]):
if matcher(node,output=False):
do_exec=True
break
for node in getattr(tsk,'outputs',[]):
if matcher(node,output=True):
do_exec=True
break
if do_exec:
ret=tsk.run()
Logs.info('%s -> exit %r'%(str(tsk),ret))
示例15: print_all_msvc_detected
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import info [as 别名]
def print_all_msvc_detected(conf):
for version,targets in conf.env['MSVC_INSTALLED_VERSIONS']:
Logs.info(version)
for target,l in targets:
Logs.info("\t"+target)