mirror of https://gitlab.com/ita1024/waf.git
remove more except: lines
This commit is contained in:
parent
d8f192fbc2
commit
63d3442ad2
|
@ -196,12 +196,12 @@ class Node(object):
|
||||||
shutil.rmtree(self.abspath())
|
shutil.rmtree(self.abspath())
|
||||||
else:
|
else:
|
||||||
os.unlink(self.abspath())
|
os.unlink(self.abspath())
|
||||||
except:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
delattr(self, 'children')
|
delattr(self, 'children')
|
||||||
except:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def suffix(self):
|
def suffix(self):
|
||||||
|
@ -234,7 +234,7 @@ class Node(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.parent.mkdir()
|
self.parent.mkdir()
|
||||||
except:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.name:
|
if self.name:
|
||||||
|
@ -248,7 +248,7 @@ class Node(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.children
|
self.children
|
||||||
except:
|
except AttributeError:
|
||||||
self.children = {}
|
self.children = {}
|
||||||
|
|
||||||
self.cache_isdir = True
|
self.cache_isdir = True
|
||||||
|
@ -271,17 +271,21 @@ class Node(object):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if x in cur.children:
|
ch = cur.children
|
||||||
|
except AttributeError:
|
||||||
|
cur.children = {}
|
||||||
|
else:
|
||||||
|
try:
|
||||||
cur = cur.children[x]
|
cur = cur.children[x]
|
||||||
continue
|
continue
|
||||||
except:
|
except KeyError:
|
||||||
cur.children = {}
|
pass
|
||||||
|
|
||||||
# optimistic: create the node first then look if it was correct to do so
|
# optimistic: create the node first then look if it was correct to do so
|
||||||
cur = self.__class__(x, cur)
|
cur = self.__class__(x, cur)
|
||||||
try:
|
try:
|
||||||
os.stat(cur.abspath())
|
os.stat(cur.abspath())
|
||||||
except:
|
except OSError:
|
||||||
del cur.parent.children[x]
|
del cur.parent.children[x]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -289,7 +293,7 @@ class Node(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.stat(ret.abspath())
|
os.stat(ret.abspath())
|
||||||
except:
|
except OSError:
|
||||||
del ret.parent.children[ret.name]
|
del ret.parent.children[ret.name]
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -338,15 +342,15 @@ class Node(object):
|
||||||
lst = [x for x in split_path(lst) if x and x != '.']
|
lst = [x for x in split_path(lst) if x and x != '.']
|
||||||
|
|
||||||
cur = self
|
cur = self
|
||||||
try:
|
|
||||||
for x in lst:
|
for x in lst:
|
||||||
if x == '..':
|
if x == '..':
|
||||||
cur = cur.parent or cur
|
cur = cur.parent or cur
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
cur = cur.children[x]
|
cur = cur.children[x]
|
||||||
|
except (AttributeError, KeyError):
|
||||||
|
return None
|
||||||
return cur
|
return cur
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def path_from(self, node):
|
def path_from(self, node):
|
||||||
"""
|
"""
|
||||||
|
@ -398,7 +402,7 @@ class Node(object):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return self.cache_abspath
|
return self.cache_abspath
|
||||||
except:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
# think twice before touching this (performance + complexity + correctness)
|
# think twice before touching this (performance + complexity + correctness)
|
||||||
|
|
||||||
|
@ -460,11 +464,12 @@ class Node(object):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
lst = set(self.children.keys())
|
lst = set(self.children.keys())
|
||||||
|
except AttributeError:
|
||||||
|
self.children = {}
|
||||||
|
else:
|
||||||
if remove:
|
if remove:
|
||||||
for x in lst - set(dircont):
|
for x in lst - set(dircont):
|
||||||
del self.children[x]
|
del self.children[x]
|
||||||
except:
|
|
||||||
self.children = {}
|
|
||||||
|
|
||||||
for name in dircont:
|
for name in dircont:
|
||||||
npats = accept(name, pats)
|
npats = accept(name, pats)
|
||||||
|
@ -677,12 +682,8 @@ class Node(object):
|
||||||
if not node:
|
if not node:
|
||||||
self = self.get_src()
|
self = self.get_src()
|
||||||
node = self.find_node(lst)
|
node = self.find_node(lst)
|
||||||
try:
|
if os.path.isdir(node.abspath()):
|
||||||
pat = node.abspath()
|
|
||||||
if os.path.isdir(pat):
|
|
||||||
return None
|
return None
|
||||||
except:
|
|
||||||
pass
|
|
||||||
return node
|
return node
|
||||||
|
|
||||||
def find_or_declare(self, lst):
|
def find_or_declare(self, lst):
|
||||||
|
@ -704,7 +705,7 @@ class Node(object):
|
||||||
node.sig = None
|
node.sig = None
|
||||||
try:
|
try:
|
||||||
node.parent.mkdir()
|
node.parent.mkdir()
|
||||||
except:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
return node
|
return node
|
||||||
self = self.get_src()
|
self = self.get_src()
|
||||||
|
@ -714,7 +715,7 @@ class Node(object):
|
||||||
node.sig = None
|
node.sig = None
|
||||||
try:
|
try:
|
||||||
node.parent.mkdir()
|
node.parent.mkdir()
|
||||||
except:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
return node
|
return node
|
||||||
node = self.get_bld().make_node(lst)
|
node = self.get_bld().make_node(lst)
|
||||||
|
|
|
@ -10,7 +10,7 @@ Runner.py: Task scheduling and execution
|
||||||
import random, atexit
|
import random, atexit
|
||||||
try:
|
try:
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
except:
|
except ImportError:
|
||||||
from Queue import Queue
|
from Queue import Queue
|
||||||
from waflib import Utils, Task, Errors, Logs
|
from waflib import Utils, Task, Errors, Logs
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class TaskConsumer(Utils.threading.Thread):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self.loop()
|
self.loop()
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def loop(self):
|
def loop(self):
|
||||||
|
@ -70,7 +70,7 @@ def get_pool():
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return pool.get(False)
|
return pool.get(False)
|
||||||
except:
|
except Exception:
|
||||||
return TaskConsumer()
|
return TaskConsumer()
|
||||||
|
|
||||||
def put_pool(x):
|
def put_pool(x):
|
||||||
|
@ -176,7 +176,7 @@ class Parallel(object):
|
||||||
elif self.frozen:
|
elif self.frozen:
|
||||||
try:
|
try:
|
||||||
cond = self.deadlock == self.processed
|
cond = self.deadlock == self.processed
|
||||||
except:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if cond:
|
if cond:
|
||||||
|
@ -268,7 +268,7 @@ class Parallel(object):
|
||||||
self.out.put(self)
|
self.out.put(self)
|
||||||
try:
|
try:
|
||||||
pool = self.pool
|
pool = self.pool
|
||||||
except:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for x in pool:
|
for x in pool:
|
||||||
|
|
|
@ -230,7 +230,7 @@ class TaskBase(evil):
|
||||||
# in case of failure the task will be executed again
|
# in case of failure the task will be executed again
|
||||||
try:
|
try:
|
||||||
del self.generator.bld.task_sigs[self.uid()]
|
del self.generator.bld.task_sigs[self.uid()]
|
||||||
except:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -707,7 +707,7 @@ class Task(TaskBase):
|
||||||
try:
|
try:
|
||||||
if prev == self.compute_sig_implicit_deps():
|
if prev == self.compute_sig_implicit_deps():
|
||||||
return prev
|
return prev
|
||||||
except:
|
except Exception:
|
||||||
# when a file was renamed (IOError usually), remove the stale nodes (headers in folders without source files)
|
# when a file was renamed (IOError usually), remove the stale nodes (headers in folders without source files)
|
||||||
# this will break the order calculation for headers created during the build in the source directory (should be uncommon)
|
# this will break the order calculation for headers created during the build in the source directory (should be uncommon)
|
||||||
# the behaviour will differ when top != out
|
# the behaviour will differ when top != out
|
||||||
|
@ -715,10 +715,10 @@ class Task(TaskBase):
|
||||||
if x.is_child_of(bld.srcnode):
|
if x.is_child_of(bld.srcnode):
|
||||||
try:
|
try:
|
||||||
os.stat(x.abspath())
|
os.stat(x.abspath())
|
||||||
except:
|
except OSErrror:
|
||||||
try:
|
try:
|
||||||
del x.parent.children[x.name]
|
del x.parent.children[x.name]
|
||||||
except:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
del bld.task_sigs[(key, 'imp')]
|
del bld.task_sigs[(key, 'imp')]
|
||||||
raise Errors.TaskRescan('rescan')
|
raise Errors.TaskRescan('rescan')
|
||||||
|
@ -738,12 +738,12 @@ class Task(TaskBase):
|
||||||
# recompute the signature and return it
|
# recompute the signature and return it
|
||||||
try:
|
try:
|
||||||
bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps()
|
bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps()
|
||||||
except:
|
except Exception:
|
||||||
if Logs.verbose:
|
if Logs.verbose:
|
||||||
for k in bld.node_deps.get(self.uid(), []):
|
for k in bld.node_deps.get(self.uid(), []):
|
||||||
try:
|
try:
|
||||||
k.get_bld_sig()
|
k.get_bld_sig()
|
||||||
except:
|
except Exception:
|
||||||
Logs.warn('Missing signature for node %r (may cause rebuilds)' % k)
|
Logs.warn('Missing signature for node %r (may cause rebuilds)' % k)
|
||||||
else:
|
else:
|
||||||
return sig
|
return sig
|
||||||
|
@ -780,7 +780,7 @@ class Task(TaskBase):
|
||||||
bld = self.generator.bld
|
bld = self.generator.bld
|
||||||
try:
|
try:
|
||||||
cache = bld.dct_implicit_nodes
|
cache = bld.dct_implicit_nodes
|
||||||
except:
|
except AttributeError:
|
||||||
bld.dct_implicit_nodes = cache = {}
|
bld.dct_implicit_nodes = cache = {}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -878,7 +878,7 @@ class Task(TaskBase):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(dname)
|
shutil.rmtree(dname)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -888,7 +888,7 @@ class Task(TaskBase):
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(tmpdir)
|
shutil.rmtree(tmpdir)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
@ -896,12 +896,12 @@ class Task(TaskBase):
|
||||||
except OSError:
|
except OSError:
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(tmpdir)
|
shutil.rmtree(tmpdir)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
os.chmod(dname, Utils.O755)
|
os.chmod(dname, Utils.O755)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def is_before(t1, t2):
|
def is_before(t1, t2):
|
||||||
|
|
|
@ -1127,6 +1127,9 @@ class cfgtask(Task.TaskBase):
|
||||||
def runnable_status(self):
|
def runnable_status(self):
|
||||||
return Task.RUN_ME
|
return Task.RUN_ME
|
||||||
|
|
||||||
|
def uid(self):
|
||||||
|
return Utils.SIG_NIL
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
conf = self.conf
|
conf = self.conf
|
||||||
bld = Build.BuildContext(top_dir=conf.srcnode.abspath(), out_dir=conf.bldnode.abspath())
|
bld = Build.BuildContext(top_dir=conf.srcnode.abspath(), out_dir=conf.bldnode.abspath())
|
||||||
|
@ -1152,6 +1155,7 @@ def multicheck(self, *k, **kw):
|
||||||
self.cache_global = Options.cache_global
|
self.cache_global = Options.cache_global
|
||||||
self.nocache = Options.options.nocache
|
self.nocache = Options.options.nocache
|
||||||
self.returned_tasks = []
|
self.returned_tasks = []
|
||||||
|
self.task_sigs = {}
|
||||||
def total(self):
|
def total(self):
|
||||||
return len(tasks)
|
return len(tasks)
|
||||||
def to_log(self, *k, **kw):
|
def to_log(self, *k, **kw):
|
||||||
|
|
Loading…
Reference in New Issue