本文整理汇总了Python中waflib.Configure.conf.cmd_and_log函数的典型用法代码示例。如果您正苦于以下问题:Python cmd_and_log函数的具体用法?Python cmd_and_log怎么用?Python cmd_and_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmd_and_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_pgi_version
def get_pgi_version(conf, cc):
"""Find the version of a pgi compiler."""
version_re = re.compile(r"The Portland Group", re.I).search
cmd = cc + ['-V', '-E'] # Issue 1078, prevent wrappers from linking
try:
out, err = conf.cmd_and_log(cmd, output=0)
except Exception:
conf.fatal('Could not find pgi compiler %r' % cmd)
if out: match = version_re(out)
else: match = version_re(err)
if not match:
conf.fatal('Could not verify PGI signature')
cmd = cc + ['-help=variable']
try:
out, err = conf.cmd_and_log(cmd, output=0)
except Exception:
conf.fatal('Could not find pgi compiler %r' % cmd)
version = re.findall('^COMPVER\s*=(.*)', out, re.M)
if len(version) != 1:
conf.fatal('Could not determine the compiler version')
return version[0]
示例2: 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")
示例3: check_python_module
def check_python_module(conf,module_name):
conf.start_msg('Python module %s'%module_name)
try:
conf.cmd_and_log(conf.env['PYTHON']+['-c',PYTHON_MODULE_TEMPLATE%module_name])
except:
conf.end_msg(False)
conf.fatal('Could not find the python module %r'%module_name)
conf.end_msg(True)
示例4: check_python_module
def check_python_module(conf, module_name):
conf.start_msg("Python module %s" % module_name)
try:
conf.cmd_and_log(conf.env["PYTHON"] + ["-c", PYTHON_MODULE_TEMPLATE % module_name])
except:
conf.end_msg(False)
conf.fatal("Could not find the python module %r" % module_name)
conf.end_msg(True)
示例5: check_python_module
def check_python_module(conf,module_name):
conf.start_msg('Python module %s'%module_name)
try:
conf.cmd_and_log([conf.env['PYTHON'],'-c','import %s\nprint(1)\n'%module_name])
except:
conf.end_msg(False)
conf.fatal('Could not find the python module %r'%module_name)
conf.end_msg(True)
示例6: find_scc
def find_scc(conf):
v=conf.env
cc=conf.find_program('cc',var='CC')
try:
conf.cmd_and_log(cc+['-flags'])
except Exception:
conf.fatal('%r is not a Sun compiler'%cc)
v.CC_NAME='sun'
conf.get_suncc_version(cc)
示例7: find_sxx
def find_sxx(conf):
v=conf.env
cc=conf.find_program(['CC','c++'],var='CXX')
try:
conf.cmd_and_log(cc+['-flags'])
except Exception:
conf.fatal('%r is not a Sun compiler'%cc)
v.CXX_NAME='sun'
conf.get_suncc_version(cc)
示例8: find_scc
def find_scc(conf):
v = conf.env
cc = conf.find_program("cc", var="CC")
try:
conf.cmd_and_log(cc + ["-flags"])
except Exception:
conf.fatal("%r is not a Sun compiler" % cc)
v.CC_NAME = "sun"
conf.get_suncc_version(cc)
示例9: find_sxx
def find_sxx(conf):
v = conf.env
cc = conf.find_program(["CC", "c++"], var="CXX")
try:
conf.cmd_and_log(cc + ["-flags"])
except Exception:
conf.fatal("%r is not a Sun compiler" % cc)
v.CXX_NAME = "sun"
conf.get_suncc_version(cc)
示例10: get_msvc_version
def get_msvc_version(conf,compiler,version,target,vcvars):
debug('msvc: get_msvc_version: %r %r %r',compiler,version,target)
batfile=conf.bldnode.make_node('waf-print-msvc.bat')
batfile.write("""@echo off
set INCLUDE=
set LIB=
call "%s" %s
echo PATH=%%PATH%%
echo INCLUDE=%%INCLUDE%%
echo LIB=%%LIB%%
"""%(vcvars,target))
sout=conf.cmd_and_log(['cmd','/E:on','/V:on','/C',batfile.abspath()])
lines=sout.splitlines()
if not lines[0]:
lines.pop(0)
if version=='11.0':
if lines[0].startswith('Error'):
conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_1)')
else:
for x in('Setting environment','Setting SDK environment','Intel(R) C++ Compiler','Intel Parallel Studio'):
if lines[0].find(x)>-1:
lines.pop(0)
break
else:
debug('msvc: get_msvc_version: %r %r %r -> not found',compiler,version,target)
conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_2)')
MSVC_PATH=MSVC_INCDIR=MSVC_LIBDIR=None
for line in lines:
if line.startswith('PATH='):
path=line[5:]
MSVC_PATH=path.split(';')
elif line.startswith('INCLUDE='):
MSVC_INCDIR=[i for i in line[8:].split(';')if i]
elif line.startswith('LIB='):
MSVC_LIBDIR=[i for i in line[4:].split(';')if i]
if None in(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR):
conf.fatal('msvc: Could not find a valid architecture for building (get_msvc_version_3)')
env=dict(os.environ)
env.update(PATH=path)
compiler_name,linker_name,lib_name=_get_prog_names(conf,compiler)
cxx=conf.find_program(compiler_name,path_list=MSVC_PATH)
cxx=conf.cmd_to_list(cxx)
if'CL'in env:
del(env['CL'])
try:
try:
conf.cmd_and_log(cxx+['/help'],env=env)
except Exception as e:
debug('msvc: get_msvc_version: %r %r %r -> failure'%(compiler,version,target))
debug(str(e))
conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
else:
debug('msvc: get_msvc_version: %r %r %r -> OK',compiler,version,target)
finally:
conf.env[compiler_name]=''
return(MSVC_PATH,MSVC_INCDIR,MSVC_LIBDIR)
示例11: get_msvc_version
def get_msvc_version(conf, compiler, version, target, vcvars):
debug('msvc: get_msvc_version: %r %r %r', compiler, version, target)
batfile = conf.bldnode.make_node('waf-print-msvc.bat')
batfile.write("""@echo off
set INCLUDE=
set LIB=
call "%s" %s
echo PATH=%%PATH%%
echo INCLUDE=%%INCLUDE%%
echo LIB=%%LIB%%
""" % (vcvars,target))
sout = conf.cmd_and_log(['cmd', '/E:on', '/V:on', '/C', batfile.abspath()])
lines = sout.splitlines()
for x in ('Setting environment', 'Setting SDK environment', 'Intel(R) C++ Compiler'):
if lines[0].find(x) != -1:
break
else:
debug('msvc: get_msvc_version: %r %r %r -> not found', compiler, version, target)
conf.fatal('msvc: Impossible to find a valid architecture for building (in get_msvc_version)')
for line in lines[1:]:
if line.startswith('PATH='):
path = line[5:]
MSVC_PATH = path.split(';')
elif line.startswith('INCLUDE='):
MSVC_INCDIR = [i for i in line[8:].split(';') if i]
elif line.startswith('LIB='):
MSVC_LIBDIR = [i for i in line[4:].split(';') if i]
# Check if the compiler is usable at all.
# The detection may return 64-bit versions even on 32-bit systems, and these would fail to run.
env = {}
env.update(os.environ)
env.update(PATH = path)
compiler_name, linker_name, lib_name = _get_prog_names(conf, compiler)
cxx = conf.find_program(compiler_name, path_list=MSVC_PATH)
cxx = conf.cmd_to_list(cxx)
# delete CL if exists. because it could contain parameters wich can change cl's behaviour rather catastrophically.
if 'CL' in env:
del(env['CL'])
try:
try:
conf.cmd_and_log(cxx + ['/help'], env=env)
except Exception as e:
debug('msvc: get_msvc_version: %r %r %r -> failure' % (compiler, version, target))
debug(str(e))
conf.fatal('msvc: cannot run the compiler (in get_msvc_version)')
else:
debug('msvc: get_msvc_version: %r %r %r -> OK', compiler, version, target)
finally:
conf.env[compiler_name] = ''
return (MSVC_PATH, MSVC_INCDIR, MSVC_LIBDIR)
示例12: check_python_module
def check_python_module(conf, module_name):
"""
Check if the selected python interpreter can import the given python module.
"""
conf.start_msg('Python module %s' % module_name)
try:
conf.cmd_and_log([conf.env['PYTHON'], '-c', 'import %s\nprint(1)\n' % module_name])
except:
conf.end_msg(False)
conf.fatal('Could not find the python module %r' % module_name)
conf.end_msg(True)
示例13: find_dmd
def find_dmd(conf):
"""
Finds the program *dmd*, *dmd2*, or *ldc* and set the variable *D*
"""
conf.find_program(['dmd', 'dmd2', 'ldc'], var='D')
# make sure that we're dealing with dmd1, dmd2, or ldc(1)
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")
示例14: find_sxx
def find_sxx(conf):
"""
Detects the sun C++ compiler
"""
v = conf.env
cc = conf.find_program(['CC', 'c++'], var='CXX')
try:
conf.cmd_and_log(cc + ['-flags'])
except Errors.WafError:
conf.fatal('%r is not a Sun compiler' % cc)
v.CXX_NAME = 'sun'
conf.get_suncc_version(cc)
示例15: find_scc
def find_scc(conf):
"""
Detects the Sun C compiler
"""
v = conf.env
cc = conf.find_program('cc', var='CC')
try:
conf.cmd_and_log(cc + ['-flags'])
except Errors.WafError:
conf.fatal('%r is not a Sun compiler' % cc)
v.CC_NAME = 'sun'
conf.get_suncc_version(cc)