本文整理汇总了Python中waflib.Logs.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: install_pyfile
def install_pyfile(self,node,install_from=None):
from_node=install_from or node.parent
tsk=self.bld.install_as(self.install_path+'/'+node.path_from(from_node),node,postpone=False)
path=tsk.get_install_path()
if self.bld.is_install<0:
info("+ removing byte compiled python files")
for x in'co':
try:
os.remove(path+x)
except OSError:
pass
if self.bld.is_install>0:
try:
st1=os.stat(path)
except:
error('The python file is missing, this should not happen')
for x in['c','o']:
do_inst=self.env['PY'+x.upper()]
try:
st2=os.stat(path+x)
except OSError:
pass
else:
if st1.st_mtime<=st2.st_mtime:
do_inst=False
if do_inst:
lst=(x=='o')and[self.env['PYFLAGS_OPT']]or[]
(a,b,c)=(path,path+x,tsk.get_install_path(destdir=False)+x)
argv=self.env['PYTHON']+lst+['-c',INST,a,b,c]
info('+ byte compiling %r'%(path+x))
env=self.env.env or None
ret=Utils.subprocess.Popen(argv,env=env).wait()
if ret:
raise Errors.WafError('py%s compilation failed %r'%(x,path))
示例2: install_pyfile
def install_pyfile(self, node, install_from=None):
from_node = install_from or node.parent
tsk = self.bld.install_as(self.install_path + "/" + node.path_from(from_node), node, postpone=False)
path = tsk.get_install_path()
if self.bld.is_install < 0:
info("+ removing byte compiled python files")
for x in "co":
try:
os.remove(path + x)
except OSError:
pass
if self.bld.is_install > 0:
try:
st1 = os.stat(path)
except:
error("The python file is missing, this should not happen")
for x in ["c", "o"]:
do_inst = self.env["PY" + x.upper()]
try:
st2 = os.stat(path + x)
except OSError:
pass
else:
if st1.st_mtime <= st2.st_mtime:
do_inst = False
if do_inst:
lst = (x == "o") and [self.env["PYFLAGS_OPT"]] or []
(a, b, c) = (path, path + x, tsk.get_install_path(destdir=False) + x)
argv = self.env["PYTHON"] + lst + ["-c", INST, a, b, c]
info("+ byte compiling %r" % (path + x))
ret = Utils.subprocess.Popen(argv).wait()
if ret:
raise Errors.WafError("py%s compilation failed %r" % (x, path))
示例3: apply_intltool_in_f
def apply_intltool_in_f(self):
try:self.meths.remove('process_source')
except ValueError:pass
self.ensure_localedir()
podir=getattr(self,'podir','.')
podirnode=self.path.find_dir(podir)
if not podirnode:
error("could not find the podir %r"%podir)
return
cache=getattr(self,'intlcache','.intlcache')
self.env.INTLCACHE=[os.path.join(str(self.path.get_bld()),podir,cache)]
self.env.INTLPODIR=podirnode.bldpath()
self.env.append_value('INTLFLAGS',getattr(self,'flags',self.env.INTLFLAGS_DEFAULT))
if'-c'in self.env.INTLFLAGS:
self.bld.fatal('Redundant -c flag in intltool task %r'%self)
style=getattr(self,'style',None)
if style:
try:
style_flag=_style_flags[style]
except KeyError:
self.bld.fatal('intltool_in style "%s" is not valid'%style)
self.env.append_unique('INTLFLAGS',[style_flag])
for i in self.to_list(self.source):
node=self.path.find_resource(i)
task=self.create_task('intltool',node,node.change_ext(''))
inst=getattr(self,'install_path',None)
if inst:
self.bld.install_files(inst,task.outputs)
示例4: iapply_intltool_in_f
def iapply_intltool_in_f(self):
try: self.meths.remove('process_source')
except ValueError: pass
if not self.env.LOCALEDIR:
self.env.LOCALEDIR = self.env.PREFIX + '/share/locale'
for i in self.to_list(self.source):
node = self.path.find_resource(i)
podir = getattr(self, 'podir', 'po')
podirnode = self.path.find_dir(podir)
if not podirnode:
error("could not find the podir %r" % podir)
continue
cache = getattr(self, 'intlcache', '.intlcache')
self.env['INTLCACHE'] = os.path.join(self.path.bldpath(), podir, cache)
self.env['INTLPODIR'] = podirnode.bldpath()
self.env['INTLFLAGS'] = getattr(self, 'flags', ['-q', '-u', '-c'])
task = self.create_task('intltool', node, node.change_ext(''))
inst = getattr(self, 'install_path', '${LOCALEDIR}')
if inst:
self.bld.install_files(inst, task.outputs)
示例5: addlines
def addlines(self,node):
self.currentnode_stack.append(node.parent)
filepath=node.abspath()
self.count_files+=1
if self.count_files>recursion_limit:
raise PreprocError("recursion limit exceeded")
pc=self.parse_cache
debug('preproc: reading file %r',filepath)
try:
lns=pc[filepath]
except KeyError:
pass
else:
self.lines.extend(lns)
return
try:
lines=filter_comments(filepath)
lines.append((POPFILE,''))
lines.reverse()
pc[filepath]=lines
self.lines.extend(lines)
except IOError:
raise PreprocError("could not read the file %s"%filepath)
except Exception:
if Logs.verbose>0:
error("parsing %s failed"%filepath)
traceback.print_exc()
示例6: add_moc_tasks
def add_moc_tasks(self):
node=self.inputs[0]
bld=self.generator.bld
try:
self.signature()
except KeyError:
pass
else:
delattr(self,'cache_sig')
moctasks=[]
mocfiles=[]
try:
tmp_lst=bld.raw_deps[self.uid()]
bld.raw_deps[self.uid()]=[]
except KeyError:
tmp_lst=[]
for d in tmp_lst:
if not d.endswith('.moc'):
continue
if d in mocfiles:
error("paranoia owns")
continue
mocfiles.append(d)
ext=''
try:ext=Options.options.qt_header_ext
except AttributeError:pass
if not ext:
base2=d[:-4]
for exth in MOC_H:
k=node.parent.find_node(base2+exth)
if k:
break
else:
raise Errors.WafError('no header found for %r which is a moc file'%d)
h_node=node.parent.find_resource(base2+exth)
m_node=h_node.change_ext('.moc')
bld.node_deps[(self.inputs[0].parent.abspath(),m_node.name)]=h_node
task=Task.classes['moc'](env=self.env,generator=self.generator)
task.set_inputs(h_node)
task.set_outputs(m_node)
gen=bld.producer
gen.outstanding.insert(0,task)
gen.total+=1
moctasks.append(task)
tmp_lst=bld.raw_deps[self.uid()]=mocfiles
lst=bld.node_deps.get(self.uid(),())
for d in lst:
name=d.name
if name.endswith('.moc'):
task=Task.classes['moc'](env=self.env,generator=self.generator)
task.set_inputs(bld.node_deps[(self.inputs[0].parent.abspath(),name)])
task.set_outputs(d)
gen=bld.producer
gen.outstanding.insert(0,task)
gen.total+=1
moctasks.append(task)
self.run_after.update(set(moctasks))
self.moc_done=1
示例7: apply_incpaths_ml
def apply_incpaths_ml(self):
inc_lst = self.includes.split()
lst = self.incpaths_lst
for dir in inc_lst:
node = self.path.find_dir(dir)
if not node:
error("node not found: " + str(dir))
continue
if not node in lst:
lst.append(node)
self.bld_incpaths_lst.append(node)
示例8: bibunits
def bibunits(self):
try:
bibunits = bibunitscan(self)
except FSError:
error("error bibunitscan")
else:
if bibunits:
fn = ["bu" + str(i) for i in xrange(1, len(bibunits) + 1)]
if fn:
warn("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())
示例9: run
def run(task):
command = 'SAS'
env = task.env
bld = task.generator.bld
fun = sas_fun
node = task.inputs[0]
logfilenode = node.change_ext('.log')
lstfilenode = node.change_ext('.lst')
# set the cwd
task.cwd = task.inputs[0].parent.get_src().abspath()
debug('runner: %s on %s' % (command, node.abspath))
SASINPUTS = node.parent.get_bld().abspath() + os.pathsep + node.parent.get_src().abspath() + os.pathsep
task.env.env = {'SASINPUTS': SASINPUTS}
task.env.SRCFILE = node.abspath()
task.env.LOGFILE = logfilenode.abspath()
task.env.LSTFILE = lstfilenode.abspath()
ret = fun(task)
if ret:
error('Running %s on %r returned a non-zero exit' % (command, node))
error('SRCFILE = %r' % node)
error('LOGFILE = %r' % logfilenode)
error('LSTFILE = %r' % lstfilenode)
return ret
示例10: bibunits
def bibunits(self):
try:
bibunits=bibunitscan(self)
except FSError:
error('error bibunitscan')
else:
if bibunits:
fn=['bu'+str(i)for i in xrange(1,len(bibunits)+1)]
if fn:
warn('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())
示例11: bibfile
def bibfile(self):
try:
ct=self.aux_node.read()
except(OSError,IOError):
error('error bibtex scan')
else:
fo=g_bibtex_re.findall(ct)
if fo:
warn('calling bibtex')
self.env.env={}
self.env.env.update(os.environ)
self.env.env.update({'BIBINPUTS':self.TEXINPUTS,'BSTINPUTS':self.TEXINPUTS})
self.env.SRCFILE=self.aux_node.name[:-4]
self.check_status('error when calling bibtex',self.bibtex_fun())
示例12: apply_intltool_in_f
def apply_intltool_in_f(self):
"""
Create tasks to translate files by intltool-merge::
def build(bld):
bld(
features = "intltool_in",
podir = "../po",
flags = ["-d", "-q", "-u", "-c"],
source = 'kupfer.desktop.in',
install_path = "${DATADIR}/applications",
)
:param podir: location of the .po files
:type podir: string
:param source: source files to process
:type source: list of string
:param flags: compilation flags ("-quc" by default)
:type flags: list of string
:param install_path: installation path
:type install_path: string
"""
try:
self.meths.remove('process_source')
except ValueError:
pass
if not self.env.LOCALEDIR:
self.env.LOCALEDIR = self.env.PREFIX + '/share/locale'
for i in self.to_list(self.source):
node = self.path.find_resource(i)
podir = getattr(self, 'podir', 'po')
podirnode = self.path.find_dir(podir)
if not podirnode:
error("could not find the podir %r" % podir)
continue
cache = getattr(self, 'intlcache', '.intlcache')
self.env['INTLCACHE'] = os.path.join(self.path.bldpath(), podir, cache)
self.env['INTLPODIR'] = podirnode.bldpath()
self.env['INTLFLAGS'] = getattr(self, 'flags', ['-q', '-u', '-c'])
task = self.create_task('intltool', node, node.change_ext(''))
inst = getattr(self, 'install_path', '${LOCALEDIR}')
if inst:
self.bld.install_files(inst, task.outputs)
示例13: bibfile
def bibfile(self):
need_bibtex=False
try:
for aux_node in self.aux_nodes:
ct=aux_node.read()
if g_bibtex_re.findall(ct):
need_bibtex=True
break
except(OSError,IOError):
error('error bibtex scan')
else:
if need_bibtex:
warn('calling bibtex')
self.env.env={}
self.env.env.update(os.environ)
self.env.env.update({'BIBINPUTS':self.TEXINPUTS,'BSTINPUTS':self.TEXINPUTS})
self.env.SRCFILE=self.aux_nodes[0].name[:-4]
self.check_status('error when calling bibtex',self.bibtex_fun())
示例14: iapply_intltool_in_f
def iapply_intltool_in_f(self):
try:
self.meths.remove("process_source")
except ValueError:
pass
for i in self.to_list(self.source):
node = self.path.find_resource(i)
podir = getattr(self, "podir", "po")
podirnode = self.path.find_dir(podir)
if not podirnode:
error("could not find the podir %r" % podir)
continue
cache = getattr(self, "intlcache", ".intlcache")
self.env["INTLCACHE"] = os.path.join(self.path.bldpath(self.env), podir, cache)
self.env["INTLPODIR"] = podirnode.srcpath(self.env)
self.env["INTLFLAGS"] = getattr(self, "flags", ["-q", "-u", "-c"])
task = self.create_task("intltool", node, node.change_ext(""))
task.install_path = self.install_path
示例15: bibunits
def bibunits(self):
"""
Parse the *.aux* file to find bibunit files. If there are bibunit files,
execute :py:meth:`waflib.Tools.tex.tex.bibtex_fun`.
"""
try:
bibunits = bibunitscan(self)
except FSError:
error('error bibunitscan')
else:
if bibunits:
fn = ['bu' + str(i) for i in xrange(1, len(bibunits) + 1)]
if fn:
warn('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())