本文整理汇总了Python中waflib.Logs.warn方法的典型用法代码示例。如果您正苦于以下问题:Python Logs.warn方法的具体用法?Python Logs.warn怎么用?Python Logs.warn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waflib.Logs
的用法示例。
在下文中一共展示了Logs.warn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def execute(self):
"""
See :py:func:`waflib.Context.Context.execute`
"""
self.init_dirs()
self.cachedir = self.bldnode.make_node(Build.CACHE_DIR)
self.cachedir.mkdir()
path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG)
self.logger = Logs.make_logger(path, 'cfg')
app = getattr(Context.g_module, 'APPNAME', '')
if app:
ver = getattr(Context.g_module, 'VERSION', '')
if ver:
app = "%s (%s)" % (app, ver)
params = {'now': time.ctime(), 'pyver': sys.hexversion, 'systype': sys.platform, 'args': " ".join(sys.argv), 'wafver': Context.WAFVERSION, 'abi': Context.ABI, 'app': app}
self.to_log(conf_template % params)
self.msg('Setting top to', self.srcnode.abspath())
self.msg('Setting out to', self.bldnode.abspath())
if id(self.srcnode) == id(self.bldnode):
Logs.warn('Setting top == out')
elif id(self.path) != id(self.srcnode):
if self.srcnode.is_child_of(self.path):
Logs.warn('Are you certain that you do not want to set top="." ?')
super(ConfigurationContext, self).execute()
self.store()
Context.top_dir = self.srcnode.abspath()
Context.out_dir = self.bldnode.abspath()
# this will write a configure lock so that subsequent builds will
# consider the current path as the root directory (see prepare_impl).
# to remove: use 'waf distclean'
env = ConfigSet.ConfigSet()
env.argv = sys.argv
env.options = Options.options.__dict__
env.config_cmd = self.cmd
env.run_dir = Context.run_dir
env.top_dir = Context.top_dir
env.out_dir = Context.out_dir
# conf.hash & conf.files hold wscript files paths and hash
# (used only by Configure.autoconfig)
env.hash = self.hash
env.files = self.files
env.environ = dict(self.environ)
if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options, 'no_lock_in_run'):
env.store(os.path.join(Context.run_dir, Options.lockfile))
if not self.env.NO_LOCK_IN_TOP and not getattr(Options.options, 'no_lock_in_top'):
env.store(os.path.join(Context.top_dir, Options.lockfile))
if not self.env.NO_LOCK_IN_OUT and not getattr(Options.options, 'no_lock_in_out'):
env.store(os.path.join(Context.out_dir, Options.lockfile))
示例2: download_tool
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def download_tool(tool, force=False, ctx=None):
"""
Download a Waf tool from the remote repository defined in :py:const:`waflib.Context.remote_repo`::
$ waf configure --download
"""
for x in Utils.to_list(Context.remote_repo):
for sub in Utils.to_list(Context.remote_locs):
url = '/'.join((x, sub, tool + '.py'))
try:
web = urlopen(url)
if web.getcode() != 200:
continue
except Exception as e:
# on python3 urlopen throws an exception
continue
else:
tmp = ctx.root.make_node(os.sep.join((Context.waf_dir, 'waflib', 'extras', tool + '.py')))
tmp.write(web.read())
Logs.warn('Downloaded %s from %s' % (tool, url))
download_check(tmp)
try:
module = Context.load_tool(tool)
except:
Logs.warn('The tool %s from %s is unusable' % (tool, url))
try:
tmp.delete()
except:
pass
continue
return module
raise Errors.WafError('Could not load the Waf tool')
示例3: execute
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def execute(self):
if not Configure.autoconfig:
return execute_method(self)
env = ConfigSet.ConfigSet()
do_config = False
try:
env.load(os.path.join(Context.top_dir, Options.lockfile))
except Exception:
Logs.warn('Configuring the project')
do_config = True
else:
if env.run_dir != Context.run_dir:
do_config = True
else:
h = 0
for f in env['files']:
h = Utils.h_list((h, Utils.readf(f, 'rb')))
do_config = h != env.hash
if do_config:
Options.commands.insert(0, self.cmd)
Options.commands.insert(0, 'configure')
if Configure.autoconfig == 'clobber':
Options.options.__dict__ = env.options
return
return execute_method(self)
示例4: configure
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def configure(conf):
areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
defaultFlags = []
defaultFlags += ['-pedantic', '-Wall', '-Wno-long-long']
if conf.options.debug:
conf.define('_DEBUG', 1)
defaultFlags += ['-O0',
'-Og', # gcc >= 4.8
'-g3',
'-fcolor-diagnostics', # clang
'-fdiagnostics-color', # gcc >= 4.9
'-Werror'
]
if areCustomCxxflagsPresent:
missingFlags = [x for x in defaultFlags if x not in conf.env.CXXFLAGS]
if len(missingFlags) > 0:
Logs.warn("Selected debug mode, but CXXFLAGS is set to a custom value '%s'"
% " ".join(conf.env.CXXFLAGS))
Logs.warn("Default flags '%s' are not activated" % " ".join(missingFlags))
else:
conf.add_supported_cxxflags(defaultFlags)
else:
defaultFlags += ['-O2', '-g']
if not areCustomCxxflagsPresent:
conf.add_supported_cxxflags(defaultFlags)
示例5: auto_run_bootstrap
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def auto_run_bootstrap(ctx, section_name, option_name, value):
""" Configure automatic boostrap execution """
if not ctx.is_bootstrap_available():
return 'False'
if not _is_user_input_allowed(ctx, option_name, value):
Logs.info('\nUser Input disabled.\nUsing default value "%s" for option: "%s"' % (value, option_name))
return value
# Check for P4 support
# On failure: (i.e. no p4 available) Do not show if default has been 'False' in the first place
# On failure: (i.e. no p4 available) Do show option if default has been 'True'
(res, warning, error) = ATTRIBUTE_VERIFICATION_CALLBACKS['verify_auto_run_bootstrap'](ctx, option_name, 'True')
if not res and not _is_user_option_true(value):
return 'False';
info_str = ["Automatically execute Branch Bootstrap on each build?"]
info_str.append("[When disabled the user is responsible to keep their 3rdParty Folder up to date]")
# GUI
if not ctx.is_option_true('console_mode'):
return ctx.gui_get_attribute(section_name, option_name, value, '\n'.join(info_str))
info_str.append('\n(Press ENTER to keep the current default value shown in [])')
Logs.info('\n'.join(info_str))
while True:
value = _get_boolean_value(ctx, 'Enable Automatic Execution of Branch BootStrap', value)
(res, warning, error) = ATTRIBUTE_VERIFICATION_CALLBACKS['verify_auto_run_bootstrap'](ctx, option_name, value)
if res:
break
else:
Logs.warn(error)
return value
示例6: build_version_files
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def build_version_files(header_path, source_path, domain, major, minor, micro, exportname, visheader):
header_path = os.path.abspath(header_path)
source_path = os.path.abspath(source_path)
text = "int " + domain + "_major_version = " + str(major) + ";\n"
text += "int " + domain + "_minor_version = " + str(minor) + ";\n"
text += "int " + domain + "_micro_version = " + str(micro) + ";\n"
try:
o = open(source_path, 'w')
o.write(text)
o.close()
except IOError:
Logs.error('Failed to open %s for writing\n' % source_path)
sys.exit(-1)
text = "#ifndef __" + domain + "_version_h__\n"
text += "#define __" + domain + "_version_h__\n"
if visheader != '':
text += "#include \"" + visheader + "\"\n"
text += exportname + " extern const char* " + domain + "_revision;\n"
text += exportname + " extern int " + domain + "_major_version;\n"
text += exportname + " extern int " + domain + "_minor_version;\n"
text += exportname + " extern int " + domain + "_micro_version;\n"
text += "#endif /* __" + domain + "_version_h__ */\n"
try:
o = open(header_path, 'w')
o.write(text)
o.close()
except IOError:
Logs.warn('Failed to open %s for writing\n' % header_path)
sys.exit(-1)
return None
示例7: download_tool
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def download_tool(tool,force=False,ctx=None):
for x in Utils.to_list(Context.remote_repo):
for sub in Utils.to_list(Context.remote_locs):
url='/'.join((x,sub,tool+'.py'))
try:
web=urlopen(url)
try:
if web.getcode()!=200:
continue
except AttributeError:
pass
except Exception:
continue
else:
tmp=ctx.root.make_node(os.sep.join((Context.waf_dir,'waflib','extras',tool+'.py')))
tmp.write(web.read(),'wb')
Logs.warn('Downloaded %s from %s'%(tool,url))
download_check(tmp)
try:
module=Context.load_tool(tool)
except Exception:
Logs.warn('The tool %s from %s is unusable'%(tool,url))
try:
tmp.delete()
except Exception:
pass
continue
return module
raise Errors.WafError('Could not load the Waf tool')
示例8: load_device_list
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def load_device_list(self):
self.devices = {}
device_dir = os.path.join(Context.top_dir, '.devices')
try:
os.mkdir(device_dir, 0o700)
except OSError:
pass
localhost = False
for device_file in os.listdir(device_dir):
try:
with open(os.path.join(device_dir, device_file), 'rb') as device_file_object:
d = pickle.load(device_file_object)
except Exception as e:
Logs.warn('device file %s could not be opened: %s' % (device_file, e))
except IOError:
Logs.warn('device file %s could not be opened' % device_file)
else:
try:
self.devices[d.platform.__class__.__name__].append(d)
except KeyError:
self.devices[d.platform.__class__.__name__] = [d]
localhost = localhost or (d.name == 'localhost')
if not localhost:
localhost = device.Device('localhost', 'localhost://')
try:
self.devices[localhost.platform.__class__.__name__].append(localhost)
except KeyError:
self.devices[localhost.platform.__class__.__name__] = [localhost]
示例9: find_ifort_win32
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def find_ifort_win32(conf):
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.IFORT_MANIFEST=(compiler=='intel'and version>=11)
fc=conf.find_program(compiler_name,var='FC',path_list=path)
env=dict(conf.environ)
if path:env.update(PATH=';'.join(path))
if not conf.cmd_and_log(fc+['/nologo','/help'],env=env):
conf.fatal('not intel fortran compiler could not be identified')
v.FC_NAME='IFORT'
if not v.LINK_FC:
conf.find_program(linker_name,var='LINK_FC',path_list=path,mandatory=True)
if not v.AR:
conf.find_program(lib_name,path_list=path,var='AR',mandatory=True)
v.ARFLAGS=['/nologo']
if v.IFORT_MANIFEST:
conf.find_program('MT',path_list=path,var='MT')
v.MTFLAGS=['/nologo']
try:
conf.load('winres')
except Errors.WafError:
Logs.warn('Resource compiler not found. Compiling resource file is disabled')
示例10: configure
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def configure(conf):
areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
defaultFlags = ['-std=c++0x', '-std=c++11',
'-stdlib=libc++', # clang on OSX < 10.9 by default uses gcc's
# libstdc++, which is not C++11 compatible
'-pedantic', '-Wall']
if conf.options.debug:
conf.define('_DEBUG', 1)
defaultFlags += ['-O0',
'-Og', # gcc >= 4.8
'-g3',
'-fcolor-diagnostics', # clang
'-fdiagnostics-color', # gcc >= 4.9
'-Werror',
'-Wno-error=maybe-uninitialized',
]
if areCustomCxxflagsPresent:
missingFlags = [x for x in defaultFlags if x not in conf.env.CXXFLAGS]
if len(missingFlags) > 0:
Logs.warn("Selected debug mode, but CXXFLAGS is set to a custom value '%s'"
% " ".join(conf.env.CXXFLAGS))
Logs.warn("Default flags '%s' are not activated" % " ".join(missingFlags))
else:
conf.add_supported_cxxflags(defaultFlags)
else:
defaultFlags += ['-O2', '-g']
if not areCustomCxxflagsPresent:
conf.add_supported_cxxflags(defaultFlags)
# clang on OSX < 10.9 by default uses gcc's libstdc++, which is not C++11 compatible
conf.add_supported_linkflags(['-stdlib=libc++'])
示例11: execute
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def execute(self):
if not Configure.autoconfig:
return execute_method(self)
env = ConfigSet.ConfigSet()
do_config = False
try:
env.load(os.path.join(Context.top_dir, Options.lockfile))
except Exception:
Logs.warn("Configuring the project")
do_config = True
else:
if env.run_dir != Context.run_dir:
do_config = True
else:
h = 0
for f in env["files"]:
h = hash((h, Utils.readf(f, "rb")))
do_config = h != env.hash
if do_config:
Options.commands.insert(0, self.cmd)
Options.commands.insert(0, "configure")
return
return execute_method(self)
示例12: postfun
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def postfun(self):
if self.failure:
build_show_failure(self)
elif not len(self.targets):
Logs.warn('makefile export failed: no C/C++ targets found')
else:
build_postfun(self)
示例13: write_files
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def write_files(self):
if self.all_projects:
# Generate the sln config|plat for this variant
prop = msvs.build_property()
prop.platform_tgt = self.env.CSPLATFORM
prop.platform = self.get_platform(self.env)
prop.platform_sln = prop.platform_tgt.replace('AnyCPU', 'Any CPU')
prop.configuration = self.get_config(self, self.env)
prop.variant = self.variant
idegen.sln_configs[prop.variant] = prop
idegen.all_projs[self.variant] = self.all_projects
idegen.depth -= 1
if idegen.depth == 0:
self.all_projects = self.flatten_projects()
if Logs.verbose == 0:
sys.stderr.write('\n')
for p in self.all_projects:
p.write()
self.make_sln_configs()
# and finally write the solution file
node = self.get_solution_node()
node.parent.mkdir()
Logs.warn('Creating %r' % node)
template1 = msvs.compile_template(msvs.SOLUTION_TEMPLATE)
sln_str = template1(self)
sln_str = msvs.rm_blank_lines(sln_str)
node.stealth_write(sln_str)
示例14: post_test
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def post_test(ctx,appname,dirs=['src'],remove=['*boost*','c++*']):
diropts=''
for i in dirs:
diropts+=' -d '+i
coverage_log=open('lcov-coverage.log','w')
coverage_lcov=open('coverage.lcov','w')
coverage_stripped_lcov=open('coverage-stripped.lcov','w')
try:
try:
base='.'
if g_is_child:
base='..'
subprocess.call(('lcov -c %s -b %s'%(diropts,base)).split(),stdout=coverage_lcov,stderr=coverage_log)
subprocess.call(['lcov','--remove','coverage.lcov']+remove,stdout=coverage_stripped_lcov,stderr=coverage_log)
if not os.path.isdir('coverage'):
os.makedirs('coverage')
subprocess.call('genhtml -o coverage coverage-stripped.lcov'.split(),stdout=coverage_log,stderr=coverage_log)
except:
Logs.warn('Failed to run lcov, no coverage report will be generated')
finally:
coverage_stripped_lcov.close()
coverage_lcov.close()
coverage_log.close()
print('')
Logs.pprint('GREEN',"Waf: Leaving directory `%s'"%os.path.abspath(os.getcwd()))
top_level=(len(ctx.stack_path)>1)
if top_level:
cd_to_orig_dir(ctx,top_level)
print('')
Logs.pprint('BOLD','Coverage:',sep='')
print('<file://%s>\n\n'%os.path.abspath('coverage/index.html'))
示例15: compile
# 需要导入模块: from waflib import Logs [as 别名]
# 或者: from waflib.Logs import warn [as 别名]
def compile(self):
if not self.files:
Logs.warn('Add a pattern for the debug build, for example "waf step --files=main.c,app"')
BuildContext.compile(self)
return
for g in self.groups:
for tg in g:
try:
f=tg.post
except AttributeError:
pass
else:
f()
for pat in self.files.split(','):
matcher=self.get_matcher(pat)
for tg in g:
if isinstance(tg,Task.TaskBase):
lst=[tg]
else:
lst=tg.tasks
for tsk in lst:
do_exec=False
for node in getattr(tsk,'inputs',[]):
if matcher(node,output=False):
do_exec=True
break
for node in getattr(tsk,'outputs',[]):
if matcher(node,output=True):
do_exec=True
break
if do_exec:
ret=tsk.run()
Logs.info('%s -> exit %r'%(str(tsk),ret))