本文整理汇总了Python中waflib.Logs.warning方法的典型用法代码示例。如果您正苦于以下问题:Python Logs.warning方法的具体用法?Python Logs.warning怎么用?Python Logs.warning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Logs
的用法示例。
在下文中一共展示了Logs.warning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _hwaf_get_runtime_env
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warning [as 别名]
def _hwaf_get_runtime_env(ctx):
"""return an environment suitably modified to run locally built programs
"""
import os
cwd = os.getcwd()
root = os.path.realpath(ctx.env.PREFIX)
root = os.path.abspath(os.path.realpath(ctx.env.INSTALL_AREA))
msg.debug("hwaf: :::root:::"+root)
if ctx.env.DESTDIR:
root = ctx.env.DESTDIR + os.sep + ctx.env.INSTALL_AREA
pass
bindir = os.path.join(root, 'bin')
libdir = os.path.join(root, 'lib')
pydir = os.path.join(root, 'python')
env = dict(os.environ)
def _env_prepend(k, args):
old_v = env.get(k, '').split(os.pathsep)
if isinstance(args, (list,tuple)):
env[k] = os.pathsep.join(args)
else:
env[k] = args
pass
if old_v:
env[k] = os.pathsep.join([env[k]]+old_v)
pass
return
def _clean_env_path(env, k):
paths = env.get(k, '').split(os.pathsep)
o = []
for p in paths:
if osp.exists(p):
o.append(p)
pass
#else: msg.info("discarding: %s" % p)
pass
env[k] = os.pathsep.join(o)
return
for k in ctx.env.keys():
v = ctx.env[k]
if not k in ctx.env.HWAF_RUNTIME_ENVVARS:
continue
if k in ctx.env.HWAF_RUNTIME_ENVVARS:
if isinstance(v, (list,tuple)):
if len(v) == 1: v = v[0]
else:
if k.endswith('PATH'): v = os.pathsep.join(v)
else: v = " ".join(v)
pass
# FIXME: we should have an API to decide...
if k.endswith('PATH'): _env_prepend(k, osp.abspath(v))
else: env[k]=v
continue
# reject invalid values (for an environment)
if isinstance(v, (list,tuple)):
continue
env[k] = str(v)
pass
## handle the shell flavours...
if ctx.is_linux():
shell = os.environ.get("SHELL", "/bin/sh")
elif ctx.is_darwin():
shell = os.environ.get("SHELL", "/bin/sh")
shell = shell.strip()
if shell.startswith('-'):
shell = shell[1:]
elif ctx.is_windows():
## FIXME: ???
shell = None
else:
shell = None
pass
# catch-all
if not shell or "(deleted)" in shell:
# fallback on the *login* shell
shell = os.environ.get("SHELL", "/bin/sh")
pass
env['SHELL'] = shell
for k in env:
v = env[k]
if not isinstance(v, str):
msg.warning('hwaf: env[%s]=%r (%s)' % (k,v,type(v)))
del env[k]
for k in (
'PATH',
'LD_LIBRARY_PATH',
'DYLD_LIBRARY_PATH',
'PYTHONPATH',
):
_clean_env_path(env, k)
pass
#.........这里部分代码省略.........