本文整理汇总了Python中waflib.Logs.error方法的典型用法代码示例。如果您正苦于以下问题:Python Logs.error方法的具体用法?Python Logs.error怎么用?Python Logs.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Logs
的用法示例。
在下文中一共展示了Logs.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_check_func
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def get_check_func(conf, lang):
if lang == 'c':
return conf.check_cc
elif lang == 'cxx':
return conf.check_cxx
else:
Logs.error("Unknown header language `%s'" % lang)
示例2: configure
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def configure(cfg):
msg.debug('orch: CONFIG CALLED')
if not cfg.options.orch_config:
raise RuntimeError('No Orchestration configuration file given (--orch-config)')
orch_config = []
for lst in util.string2list(cfg.options.orch_config):
lst = lst.strip()
orch_config += glob(lst)
okay = True
for maybe in orch_config:
if os.path.exists(maybe):
continue
msg.error('No such file: %s' % maybe)
okay = False
if not okay or not orch_config:
raise ValueError('missing configuration files')
cfg.msg('Orch configuration files', '"%s"' % '", "'.join(orch_config))
extra = dict(cfg.env)
extra['top'] = context.top_dir
extra['out'] = context.out_dir # usually {top}/tmp
extra['DESTDIR'] = getattr(cfg.options, 'destdir', '')
suite = pkgconf.load(orch_config, start = cfg.options.orch_start, **extra)
envmunge.decompose(cfg, suite)
cfg.msg('Orch configure envs', '"%s"' % '", "'.join(cfg.all_envs.keys()))
bind_functions(cfg)
return
示例3: ant_glob
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def ant_glob(self,*k,**kw):
if k:
lst=Utils.to_list(k[0])
for pat in lst:
if'..'in pat.split('/'):
Logs.error("In ant_glob pattern %r: '..' means 'two dots', not 'parent directory'"%k[0])
return old_ant_glob(self,*k,**kw)
示例4: dl_task
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def dl_task(task):
src = task.inputs[0]
tgt = task.outputs[0]
url = src.read().strip()
try:
web = urlopen(url)
tgt.write(web.read(),'wb')
except Exception:
import traceback
traceback.print_exc()
msg.error(tgen.worch.format("[{package}_dlpatch] problem downloading [{patch_urlfile}]"))
raise
checksum = tgen.worch.patch_checksum
if not checksum:
return
hasher_name, ref = checksum.split(":")
import hashlib, os
# FIXME: check the hasher method exists. check for typos.
hasher = getattr(hashlib, hasher_name)()
hasher.update(tgt.read('rb'))
data= hasher.hexdigest()
if data != ref:
msg.error(tgen.worch.format("[{package}_dlpatch] invalid checksum:\nref: %s\nnew: %s" %\
(ref, data)))
try:
os.remove(tgt.abspath())
except IOError:
pass
return 1
return
示例5: do_install
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def do_install(self, src, tgt, chmod=Utils.O644):
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 >= 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.remove(tgt)
except OSError:
pass
try:
shutil.copy2(src, tgt)
os.chmod(tgt, chmod)
except IOError:
try:
os.stat(src)
except (OSError, IOError):
Logs.error("File %r does not exist" % src)
raise Errors.WafError("Could not install the file %r" % tgt)
示例6: add_moc_tasks
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
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:
Logs.error("paranoia owns")
continue
mocfiles.append(d)
h_node=None
try:ext=Options.options.qt_header_ext.split()
except AttributeError:pass
if not ext:ext=MOC_H
base2=d[:-4]
for x in[node.parent]+self.generator.includes_nodes:
for e in ext:
h_node=x.find_node(base2+e)
if h_node:
break
if h_node:
m_node=h_node.change_ext('.moc')
break
else:
for k in EXT_QT4:
if base2.endswith(k):
for x in[node.parent]+self.generator.includes_nodes:
h_node=x.find_node(base2)
if h_node:
break
if h_node:
m_node=h_node.change_ext(k+'.moc')
break
if not h_node:
raise Errors.WafError('no header found for %r which is a moc file'%d)
bld.node_deps[(self.inputs[0].parent.abspath(),m_node.name)]=h_node
task=self.create_moc_task(h_node,m_node)
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=self.create_moc_task(bld.node_deps[(self.inputs[0].parent.abspath(),name)],d)
moctasks.append(task)
self.run_after.update(set(moctasks))
self.moc_done=1
示例7: scan
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def scan(self):
"""Parse the *.qrc* files"""
if not has_xml:
Logs.error('no xml support was found, the rcc dependencies will be incomplete!')
return ([], [])
parser = make_parser()
curHandler = XMLHandler()
parser.setContentHandler(curHandler)
fi = open(self.inputs[0].abspath(), 'r')
try:
parser.parse(fi)
finally:
fi.close()
nodes = []
names = []
root = self.inputs[0].parent
for x in curHandler.files:
nd = root.find_resource(x)
if nd:
nodes.append(nd)
else:
names.append(x)
return (nodes, names)
示例8: check_err_features
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def check_err_features(self):
lst = self.to_list(self.features)
if "shlib" in lst:
Logs.error("feature shlib -> cshlib, dshlib or cxxshlib")
for x in ("c", "cxx", "d", "fc"):
if not x in lst and lst and lst[0] in [x + y for y in ("program", "shlib", "stlib")]:
Logs.error("%r features is probably missing %r" % (self, x))
示例9: run
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def run(self):
run_do_script_base.run(self)
ret, log_tail = self.check_erase_log_file()
if ret:
Logs.error("""Running Stata on %s failed with code %r.\n\nCheck the log file %s, last 10 lines\n\n%s\n\n\n""" % (
self.inputs[0].nice_path(), ret, self.env.LOGFILEPATH, log_tail))
return ret
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:9,代码来源:run_do_script.py
示例10: load_envs
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def load_envs(self):
"""
The configuration command creates files of the form ``build/c4che/NAMEcache.py``. This method
creates a :py:class:`waflib.ConfigSet.ConfigSet` instance for each ``NAME`` by reading those
files. The config sets are then stored in the dict :py:attr:`waflib.Build.BuildContext.allenvs`.
"""
try:
lst = Utils.listdir(self.cache_dir)
except OSError as e:
if e.errno == errno.ENOENT:
raise Errors.WafError('The project was not configured: run "waf configure" first!')
else:
raise
if not lst:
raise Errors.WafError('The cache directory is empty: reconfigure the project')
for fname in lst:
if fname.endswith(CACHE_SUFFIX):
env = ConfigSet.ConfigSet(os.path.join(self.cache_dir, fname))
name = fname[:-len(CACHE_SUFFIX)]
self.all_envs[name] = env
for f in env[CFG_FILES]:
newnode = self.root.find_resource(f)
try:
h = Utils.h_file(newnode.abspath())
except (IOError, AttributeError):
Logs.error('cannot find %r' % f)
h = Utils.SIG_NIL
newnode.sig = h
示例11: gather_vswhere_versions
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def gather_vswhere_versions(conf, versions):
try:
import json
except ImportError:
Logs.error('Visual Studio 2017 detection requires Python 2.6')
return
prg_path = os.environ.get('ProgramFiles(x86)', os.environ.get('ProgramFiles', 'C:\\Program Files (x86)'))
vswhere = os.path.join(prg_path, 'Microsoft Visual Studio', 'Installer', 'vswhere.exe')
args = [vswhere, '-products', '*', '-legacy', '-format', 'json']
try:
txt = conf.cmd_and_log(args)
except Errors.WafError as e:
Logs.debug('msvc: vswhere.exe failed %s', e)
return
if sys.version_info[0] < 3:
txt = txt.decode(sys.stdout.encoding or 'windows-1252')
arr = json.loads(txt)
arr.sort(key=lambda x: x['installationVersion'])
for entry in arr:
ver = entry['installationVersion']
ver = str('.'.join(ver.split('.')[:2]))
path = str(os.path.abspath(entry['installationPath']))
if os.path.exists(path) and ('msvc %s' % ver) not in versions:
conf.gather_msvc_targets(versions, ver, path)
示例12: addlines
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def addlines(self, node):
"""
Add the lines from a header in the list of preprocessor lines to parse
:param node: header
:type node: :py:class:`waflib.Node.Node`
"""
self.currentnode_stack.append(node.parent)
self.count_files += 1
if self.count_files > recursion_limit:
# issue #812
raise PreprocError('recursion limit exceeded')
if Logs.verbose:
Logs.debug('preproc: reading file %r', node)
try:
lines = self.parse_lines(node)
except EnvironmentError:
raise PreprocError('could not read the file %r' % node)
except Exception:
if Logs.verbose > 0:
Logs.error('parsing %r failed %s', node, traceback.format_exc())
else:
self.lines.extend(lines)
示例13: check_output
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def check_output(self,ret,out):
for num,line in enumerate(out.split('\n')):
if line.find('Error:') == 0:
Logs.error("Error in line %d: %s" % (num,line[6:]))
ret = 1
return ret
示例14: call
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
def call(self,*k,**kw):
for x in typos:
if x in kw:
kw[typos[x]]=kw[x]
del kw[x]
Logs.error('typo %r -> %r'%(x,typos[x]))
return oldcall(self,*k,**kw)
示例15: install_pyfile
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import error [as 别名]
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:
Logs.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 OSError:
Logs.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]
Logs.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))