本文整理汇总了Python中waflib.Configure.conf.fatal函数的典型用法代码示例。如果您正苦于以下问题:Python fatal函数的具体用法?Python fatal怎么用?Python fatal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fatal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_emscripten_version
def get_emscripten_version(conf, cc):
"""
Emscripten doesn't support processing '-' like clang/gcc
"""
dummy = conf.cachedir.parent.make_node("waf-emscripten.c")
dummy.write("")
cmd = cc + ['-dM', '-E', '-x', 'c', dummy.abspath()]
env = conf.env.env or None
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env)
out = p.communicate()[0]
except Exception as e:
conf.fatal('Could not determine emscripten version %r: %s' % (cmd, e))
if not isinstance(out, str):
out = out.decode(sys.stdout.encoding or 'iso8859-1')
k = {}
out = out.splitlines()
for line in out:
lst = shlex.split(line)
if len(lst)>2:
key = lst[1]
val = lst[2]
k[key] = val
if not ('__clang__' in k and 'EMSCRIPTEN' in k):
conf.fatal('Could not determine the emscripten compiler version.')
conf.env.DEST_OS = 'generic'
conf.env.DEST_BINFMT = 'elf'
conf.env.DEST_CPU = 'asm-js'
conf.env.CC_VERSION = (k['__clang_major__'], k['__clang_minor__'], k['__clang_patchlevel__'])
return k
示例2: check_fortran_clib
def check_fortran_clib(self, autoadd=True, *k, **kw):
"""
Obtain the flags for linking with the C library
if this check works, add uselib='CLIB' to your task generators
"""
if not self.env.FC_VERBOSE_FLAG:
self.fatal("env.FC_VERBOSE_FLAG is not set: execute check_fortran_verbose_flag?")
self.start_msg("Getting fortran runtime link flags")
try:
self.check_cc(
fragment=FC_FRAGMENT2,
compile_filename="test.f",
features="fc fcprogram_test",
linkflags=[self.env.FC_VERBOSE_FLAG],
)
except Exception:
self.end_msg(False)
if kw.get("mandatory", True):
conf.fatal("Could not find the c library flags")
else:
out = self.test_bld.err
flags = parse_fortran_link(out.splitlines())
self.end_msg("ok (%s)" % " ".join(flags))
self.env.LINKFLAGS_CLIB = flags
return flags
return []
示例3: check_libdynamixel
def check_libdynamixel(conf, **kw):
required = 'required' in kw and kw.get('required', False)
includes_check = ['/usr/include', '/usr/local/include']
resibots_dir = conf.options.resibots if hasattr(conf.options, 'resibots') and conf.options.resibots else None
if resibots_dir:
includes_check = [resibots_dir + '/include'] + includes_check
if conf.options.libdynamixel:
includes_check = [conf.options.libdynamixel + '/include'] + includes_check
conf.start_msg('Checking for libdynamixel includes')
try:
res = conf.find_file('dynamixel/dynamixel.hpp', includes_check)
except:
res = False
if res:
conf.env.INCLUDES_LIBDYNAMIXEL = [os.path.expanduser(include) for include in includes_check]
conf.env.DEFINES_LIBDYNAMIXEL = ['USE_LIBDYNAMIXEL']
conf.end_msg('ok')
else:
if conf.options.libdynamixel and resibots_dir:
msg = 'not found in %s nor in %s' % (conf.options.libdynamixel, resibots_dir)
elif conf.options.libdynamixel or resibots_dir:
msg = 'not found in %s' % (conf.options.libdynamixel if conf.options.libdynamixel else resibots_dir)
else:
msg = 'not found, use --libdynamixel=/path/to/libdynamixel or --resibots=/path/to/resibots'
if required:
conf.fatal(msg)
else:
conf.end_msg(msg, 'YELLOW')
示例4: expand_bundle
def expand_bundle(conf,arg):
if not arg:
return[]
arg=arg.split(',')
if'NONE'in arg and'ALL'in arg:
conf.fatal('Cannot specify both ALL and NONE as dependencies')
candidate_score=dict([(name,0)for name in dependencies])
def check_candidate(c):
if c not in candidate_score:
conf.fatal('Cannot bundle %s, since it is not specified as a'' dependency'%c)
for a in arg:
if a=='ALL':
for candidate in candidate_score:
candidate_score[candidate]+=1
continue
if a=='NONE':
continue
if a.startswith('-'):
a=a[1:]
check_candidate(a)
candidate_score[a]-=1
else:
check_candidate(a)
candidate_score[a]+=1
candidates=[name for name in candidate_score if candidate_score[name]>0]
return candidates
示例5: find_dmd
def find_dmd(conf):
conf.find_program(['dmd','dmd2','ldc'],var='D')
out=conf.cmd_and_log([conf.env.D,'--help'])
if out.find("D Compiler v")==-1:
out=conf.cmd_and_log([conf.env.D,'-version'])
if out.find("based on DMD v1.")==-1:
conf.fatal("detected compiler is not dmd/ldc")
示例6: ecpp_setuptoolchain
def ecpp_setuptoolchain(conf, arch):
global tool_prefixes
arch = arch.lower()
envname = 'toolchain_%s' % arch
if envname not in conf.all_envs:
conf.setenv(envname, conf.env)
for prefix in tool_prefixes[arch]:
try:
conf.env.stash()
conf.env['TOOL_PREFIX'] = prefix
conf.load('gcc')
conf.load('gxx')
conf.load('gas')
conf.find_program(['strip'], var='STRIP')
conf.find_program(['objcopy'], var='OBJCOPY')
conf.find_program(['objdump'], var='OBJDUMP')
conf.find_program(['nm'], var='NM')
conf.env.append_value('ASFLAGS', ['-g'])
conf.env.append_value('CFLAGS', ['-g', '-Wall'])
conf.env.append_value('CXXFLAGS', ['-g', '-std=c++11','-Wall', '-ftemplate-depth=10000'])
except conf.errors.ConfigurationError:
conf.env.revert()
else:
break
else:
conf.fatal('Could not find a valid toolchain for "%s".' % arch)
else:
conf.setenv(envname)
示例7: getoutput
def getoutput(conf,cmd,stdin=False):
input=stdin and'\n'or None
try:
out,err=conf.cmd_and_log(cmd,env=conf.env.env or None,output=0,input=input)
except Exception:
conf.fatal('could not determine the compiler version %r'%cmd)
return(out,err)
示例8: find_msvc
def find_msvc(conf):
if sys.platform=='cygwin':
conf.fatal('MSVC module does not work under cygwin Python!')
v=conf.env
path=v.PATH
compiler=v.MSVC_COMPILER
version=v.MSVC_VERSION
compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler)
v.MSVC_MANIFEST=(compiler=='msvc'and version>=8)or(compiler=='wsdk'and version>=6)or(compiler=='intel'and version>=11)
cxx=conf.find_program(compiler_name,var='CXX',path_list=path)
env=dict(conf.environ)
if path:env.update(PATH=';'.join(path))
if not conf.cmd_and_log(cxx+['/nologo','/help'],env=env):
conf.fatal('the msvc compiler could not be identified')
v.CC=v.CXX=cxx
v.CC_NAME=v.CXX_NAME='msvc'
if not v.LINK_CXX:
v.LINK_CXX=conf.find_program(linker_name,path_list=path,errmsg='%s was not found (linker)'%linker_name)
if not v.LINK_CC:
v.LINK_CC=v.LINK_CXX
if not v.AR:
stliblink=conf.find_program(lib_name,path_list=path,var='AR')
if not stliblink:
return
v.ARFLAGS=['/nologo']
if v.MSVC_MANIFEST:
conf.find_program('MT',path_list=path,var='MT')
v.MTFLAGS=['/nologo']
try:
conf.load('winres')
except Errors.ConfigurationError:
Logs.warn('Resource compiler not found. Compiling resource file is disabled')
示例9: check_omni_vrep
def check_omni_vrep(conf, **kw):
required = 'required' in kw and kw.get('required', False)
includes_check = ['/usr/include', '/usr/local/include']
resibots_dir = conf.options.resibots if hasattr(conf.options, 'resibots') and conf.options.resibots else None
if resibots_dir:
includes_check = [resibots_dir + '/include'] + includes_check
if conf.options.omni_vrep:
includes_check = [conf.options.omni_vrep + '/include'] + includes_check
conf.start_msg('Checking for omni_vrep includes')
try:
res = conf.find_file('omni_vrep/omnipointer.hpp', includes_check)
except:
res = False
if res:
conf.env.INCLUDES_OMNI_VREP = [os.path.expanduser(include) for include in includes_check]
conf.env.DEFINES_OMNI_VREP = ['USE_OMNI_VREP']
conf.end_msg('ok')
else:
if conf.options.omni_vrep and resibots_dir:
msg = 'not found in %s nor in %s' % (conf.options.omni_vrep, resibots_dir)
elif conf.options.omni_vrep or resibots_dir:
msg = 'not found in %s' % (conf.options.omni_vrep if conf.options.omni_vrep else resibots_dir)
else:
msg = 'not found, use --omni_vrep=/path/to/omni_vrep or --resibots=/path/to/resibots'
if required:
conf.fatal(msg)
else:
conf.end_msg(msg, 'YELLOW')
示例10: setup_ifort
def setup_ifort(conf, versiondict):
"""
Checks installed compilers and targets and returns the first combination from the user's
options, env, or the global supported lists that checks.
:param versiondict: dict(platform -> dict(architecture -> configuration))
:type versiondict: dict(string -> dict(string -> target_compiler)
:return: the compiler, revision, path, include dirs, library paths and target architecture
:rtype: tuple of strings
"""
platforms = Utils.to_list(conf.env.MSVC_TARGETS) or [i for i,j in all_ifort_platforms]
desired_versions = conf.env.MSVC_VERSIONS or list(reversed(list(versiondict.keys())))
for version in desired_versions:
try:
targets = versiondict[version]
except KeyError:
continue
for arch in platforms:
try:
cfg = targets[arch]
except KeyError:
continue
cfg.evaluate()
if cfg.is_valid:
compiler,revision = version.rsplit(' ', 1)
return compiler,revision,cfg.bindirs,cfg.incdirs,cfg.libdirs,cfg.cpu
conf.fatal('ifort: Impossible to find a valid architecture for building %r - %r' % (desired_versions, list(versiondict.keys())))
示例11: check_cython_version
def check_cython_version(conf, minver):
conf.start_msg("Checking cython version")
minver = tuple(minver)
import re
version_re = re.compile(r'cython\s*version\s*(?P<major>\d*)\.(?P<minor>\d*)(?:\.(?P<micro>\d*))?', re.I).search
cmd = conf.cmd_to_list(conf.env['CYTHON'])
cmd = cmd + ['--version']
from waflib.Tools import fc_config
stdout, stderr = fc_config.getoutput(conf, cmd)
if stdout:
match = version_re(stdout)
else:
match = version_re(stderr)
if not match:
conf.fatal("cannot determine the Cython version")
cy_ver = [match.group('major'), match.group('minor')]
if match.group('micro'):
cy_ver.append(match.group('micro'))
else:
cy_ver.append('0')
cy_ver = tuple([int(x) for x in cy_ver])
if cy_ver < minver:
conf.end_msg(False)
conf.fatal("cython version %s < %s" % (cy_ver, minver))
conf.end_msg(str(cy_ver))
示例12: get_pgfortran_version
def get_pgfortran_version(conf,fc):
version_re = re.compile(r"The Portland Group", re.I).search
cmd = fc + ['-V']
out,err = fc_config.getoutput(conf, cmd, stdin=False)
if out: match = version_re(out)
else: match = version_re(err)
if not match:
conf.fatal('Could not verify PGI signature')
cmd = fc + ['-help=variable']
out,err = fc_config.getoutput(conf, cmd, stdin=False)
if out.find('COMPVER')<0:
conf.fatal('Could not determine the compiler type')
k = {}
prevk = ''
out = out.split('\n')
for line in out:
lst = line.partition('=')
if lst[1] == '=':
key = lst[0].rstrip()
if key == '': key = prevk
val = lst[2].rstrip()
k[key] = val
else: prevk = line.partition(' ')[0]
def isD(var):
return var in k
def isT(var):
return var in k and k[var]!='0'
conf.env['FC_VERSION'] = (k['COMPVER'].split('.'))
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:28,代码来源:fc_pgfortran.py
示例13: get_suncc_version
def get_suncc_version(conf, cc):
"""
Returns the Sun compiler version
:raise: :py:class:`waflib.Errors.ConfigurationError`
"""
cmd = cc + ['-V']
try:
out, err = conf.cmd_and_log(cmd, output=0)
except Errors.WafError as e:
# Older versions of the compiler exit with non-zero status when reporting their version
if not (hasattr(e, 'returncode') and hasattr(e, 'stdout') and hasattr(e, 'stderr')):
conf.fatal('Could not find suncc %r' % cmd)
out = e.stdout
err = e.stderr
version = (out or err)
version = version.splitlines()[0]
# cc: Sun C 5.10 SunOS_i386 2009/06/03
# cc: Studio 12.5 Sun C++ 5.14 SunOS_sparc Beta 2015/11/17
# cc: WorkShop Compilers 5.0 98/12/15 C 5.0
version_re = re.compile(r'cc: (studio.*?|\s+)?(sun\s+(c\+\+|c)|(WorkShop\s+Compilers))?\s+(?P<major>\d*)\.(?P<minor>\d*)', re.I).search
match = version_re(version)
if match:
k = match.groupdict()
conf.env.CC_VERSION = (k['major'], k['minor'])
else:
conf.fatal('Could not determine the suncc version.')
示例14: getoutput
def getoutput(conf, cmd, stdin=False):
"""
Obtains Fortran command outputs
"""
from waflib import Errors
if conf.env.env:
env = conf.env.env
else:
env = dict(os.environ)
env['LANG'] = 'C'
input = stdin and '\n'.encode() or None
try:
out, err = conf.cmd_and_log(cmd, env=env, output=0, input=input)
except Errors.WafError as e:
# An WafError might indicate an error code during the command
# execution, in this case we still obtain the stderr and stdout,
# which we can use to find the version string.
if not (hasattr(e, 'stderr') and hasattr(e, 'stdout')):
raise e
else:
# Ignore the return code and return the original
# stdout and stderr.
out = e.stdout
err = e.stderr
except Exception:
conf.fatal('could not determine the compiler version %r' % cmd)
return (out, err)
示例15: check_fortran_clib
def check_fortran_clib(self, autoadd=True, *k, **kw):
"""
Obtain flags for linking with the c library
if this check works, add uselib='CLIB' to your task generators
"""
if not self.env.FC_VERBOSE_FLAG:
self.fatal('env.FC_VERBOSE_FLAG is not set: execute check_fortran_verbose_flag?')
self.start_msg('Getting fortran runtime link flags')
try:
self.check_cc(
fragment = FC_FRAGMENT2,
compile_filename = 'test.f',
features = 'fc fcprogram_test',
linkflags = [self.env.FC_VERBOSE_FLAG]
)
except:
self.end_msg(False)
if kw.get('mandatory', True):
conf.fatal('Could not find the c library flags')
else:
out = self.test_bld.err
flags = parse_fortran_link(out.splitlines())
self.end_msg('ok (%s)' % ' '.join(flags))
self.env.CLIB_LINKFLAGS = flags
return flags
return []