Update conf.check_waf_version to 1.9

This commit is contained in:
Thomas Nagy 2016-06-04 09:33:13 +02:00
parent e64061f6d2
commit 062a5263a0
No known key found for this signature in database
GPG Key ID: 67A565EDFDF90E64
8 changed files with 28 additions and 28 deletions

View File

@ -35,7 +35,7 @@ def lock_maxjob(self):
try:
self.lockfd = os.open(self.generator.bld.lockfile, os.O_TRUNC | os.O_CREAT | os.O_RDWR)
fcntl.flock(self.lockfd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except (OSError, IOError), e:
except EnvironmentError as e:
if e.errno in (errno.EACCES, errno.EAGAIN):
time.sleep(0.3)
continue

View File

@ -410,8 +410,8 @@ class BuildContext(Context.Context):
:param value: value to depend on
:type value: :py:class:`waflib.Node.Node`, string, or function returning a string
"""
if path is None:
raise ValueError('Invalid input')
if not path:
raise ValueError('Invalid input path %r' % path)
if isinstance(path, waflib.Node.Node):
node = path
@ -419,6 +419,8 @@ class BuildContext(Context.Context):
node = self.root.find_resource(path)
else:
node = self.path.find_resource(path)
if not node:
raise ValueError('Could not find the path %r' % path)
if isinstance(value, list):
self.deps_man[node].extend(value)
@ -441,6 +443,8 @@ class BuildContext(Context.Context):
def build(bld):
bld.hash_env_vars(bld.env, ['CXX', 'CC'])
This method uses an internal cache.
:param env: Configuration Set
:type env: :py:class:`waflib.ConfigSet.ConfigSet`
:param vars_lst: list of variables
@ -464,11 +468,8 @@ class BuildContext(Context.Context):
pass
lst = [env[a] for a in vars_lst]
ret = Utils.h_list(lst)
cache[idx] = ret = Utils.h_list(lst)
Logs.debug('envhash: %s %r', Utils.to_hex(ret), lst)
cache[idx] = ret
return ret
def get_tgen_by_name(self, name):
@ -509,7 +510,7 @@ class BuildContext(Context.Context):
pc = (100.*state)/total
eta = str(self.timer)
fs = "[%%%dd/%%%dd][%%s%%2d%%%%%%s][%s][" % (n, n, ind)
fs = "[%%%dd/%%d][%%s%%2d%%%%%%s][%s][" % (n, ind)
left = fs % (state, total, col1, pc, col2)
right = '][%s%s%s]' % (col1, eta, col2)
@ -592,7 +593,14 @@ class BuildContext(Context.Context):
self.get_group(group).append(tgen)
def get_group_name(self, g):
"""name for the group g (utility)"""
"""
Return the name of the input build group
:param g: build group object or build group index
:type g: integer or list
:return: name
:rtype: string
"""
if not isinstance(g, list):
g = self.groups[g]
for x in self.group_names:
@ -620,15 +628,14 @@ class BuildContext(Context.Context):
def add_group(self, name=None, move=True):
"""
Add a new group of tasks/task generators. By default the new group becomes the default group for new task generators.
Add a new group of tasks/task generators. By default the new group becomes
the default group for new task generators. Make sure to create build groups in order.
:param name: name for this group
:type name: string
:param move: set the group created as default group (True by default)
:type move: bool
"""
#if self.groups and not self.groups[0].tasks:
# error('add_group: an empty group is already present')
if name and name in self.group_names:
Logs.error('add_group: name %s already present', name)
g = []
@ -750,7 +757,7 @@ class BuildContext(Context.Context):
for tg in self.groups[idx]:
try:
tasks.extend(tg.tasks)
except AttributeError: # not a task generator, can be the case for installation tasks
except AttributeError: # not a task generator
tasks.append(tg)
return tasks

View File

@ -368,11 +368,11 @@ def cmd_to_list(self, cmd):
return cmd
@conf
def check_waf_version(self, mini='1.7.99', maxi='1.9.0', **kw):
def check_waf_version(self, mini='1.8.99', maxi='2.0.0', **kw):
"""
Raise a Configuration error if the Waf version does not strictly match the given bounds::
conf.check_waf_version(mini='1.8.0', maxi='1.9.0')
conf.check_waf_version(mini='1.8.99', maxi='2.0.0')
:type mini: number, tuple or string
:param mini: Minimum required version
@ -552,9 +552,7 @@ def run_build(self, *k, **kw):
if cachemode == 1:
try:
proj = ConfigSet.ConfigSet(os.path.join(dir, 'cache_run_build'))
except OSError:
pass
except IOError:
except EnvironmentError:
pass
else:
ret = proj['cache_run_build']
@ -576,11 +574,9 @@ def run_build(self, *k, **kw):
bld.all_envs.update(self.all_envs) # not really necessary
bld.env = kw['env']
# OMG huge hack
bld.kw = kw
bld.conf = self
kw['build_fun'](bld)
ret = -1
try:
try:
@ -598,7 +594,6 @@ def run_build(self, *k, **kw):
proj.store(os.path.join(dir, 'cache_run_build'))
else:
shutil.rmtree(dir)
return ret
@conf

View File

@ -96,7 +96,7 @@ class store_context(type):
super(store_context, cls).__init__(name, bases, dict)
name = cls.__name__
if name == 'ctx' or name == 'Context':
if name in ('ctx', 'Context'):
return
try:

View File

@ -312,9 +312,7 @@ def distclean(ctx):
if proj['out_dir'] != proj['top_dir']:
try:
shutil.rmtree(proj['out_dir'])
except IOError:
pass
except OSError as e:
except EnvironmentError as e:
if e.errno != errno.ENOENT:
Logs.warn('Could not remove %r', proj['out_dir'])
else:

View File

@ -720,7 +720,7 @@ class Task(TaskBase):
# recompute the signature and return it
try:
bld.imp_sigs[key] = self.compute_sig_implicit_deps()
except (OSError, IOError):
except EnvironmentError:
for k in bld.node_deps.get(self.uid(), []):
if not k.exists():
Logs.warn('Dependency %r for %r is missing: check the task declaration and the build order!', k, self)

View File

@ -663,7 +663,7 @@ def process_lib(self):
if node:
try:
Utils.h_file(node.abspath())
except (IOError, OSError):
except EnvironmentError:
raise ValueError('Could not read %r' % y)
break
else:

View File

@ -562,7 +562,7 @@ def h_fun(fun):
except AttributeError:
try:
h = inspect.getsource(fun)
except IOError:
except EnvironmentError:
h = "nocode"
try:
fun.code = h