Conceal gccdeps/msvcdeps errors on inaccessible/unreadable files

This commit is contained in:
Thomas Nagy 2020-06-25 00:55:46 +02:00
parent 8b6786623d
commit a01652d3c2
2 changed files with 37 additions and 16 deletions

View File

@ -15,7 +15,7 @@ Usage::
conf.load('compiler_cxx gccdeps')
"""
import errno, os, re, threading
import os, re, threading
from waflib import Task, Logs, Utils, Errors
from waflib.Tools import c_preproc
from waflib.TaskGen import before_method, feature
@ -163,14 +163,25 @@ def post_run(self):
def sig_implicit_deps(self):
if not self.__class__.__name__ in self.env.ENABLE_GCCDEPS:
return super(self.derived_gccdeps, self).sig_implicit_deps()
bld = self.generator.bld
try:
return Task.Task.sig_implicit_deps(self)
except Errors.WafError:
return Utils.SIG_NIL
except EnvironmentError as e:
if e.errno == errno.ENOENT:
return Utils.SIG_NIL
raise
return self.compute_sig_implicit_deps()
except Errors.TaskNotReady:
raise ValueError("Please specify the build order precisely with gccdeps (asm/c/c++ tasks)")
except EnvironmentError:
# If a file is renamed, assume the dependencies are stale and must be recalculated
for x in bld.node_deps.get(self.uid(), []):
if not x.is_bld() and not x.exists():
try:
del x.parent.children[x.name]
except KeyError:
pass
key = self.uid()
bld.node_deps[key] = []
bld.raw_deps[key] = []
return Utils.SIG_NIL
def wrap_compiled_task(classname):
derived_class = type(classname, (Task.classes[classname],), {})

View File

@ -25,7 +25,7 @@ Usage::
conf.load('compiler_cxx msvcdeps')
'''
import errno, os, sys, tempfile, threading
import os, sys, tempfile, threading
from waflib import Context, Errors, Logs, Task, Utils
from waflib.Tools import c_preproc, c, cxx, msvc
@ -150,15 +150,25 @@ def scan(self):
def sig_implicit_deps(self):
if self.env.CC_NAME not in supported_compilers:
return super(self.derived_msvcdeps, self).sig_implicit_deps()
bld = self.generator.bld
try:
return Task.Task.sig_implicit_deps(self)
except Errors.WafError:
return Utils.SIG_NIL
except EnvironmentError as e:
if e.errno == errno.ENOENT:
return Utils.SIG_NIL
raise
return self.compute_sig_implicit_deps()
except Errors.TaskNotReady:
raise ValueError("Please specify the build order precisely with msvcdeps (c/c++ tasks)")
except EnvironmentError:
# If a file is renamed, assume the dependencies are stale and must be recalculated
for x in bld.node_deps.get(self.uid(), []):
if not x.is_bld() and not x.exists():
try:
del x.parent.children[x.name]
except KeyError:
pass
key = self.uid()
bld.node_deps[key] = []
bld.raw_deps[key] = []
return Utils.SIG_NIL
def exec_command(self, cmd, **kw):
if self.env.CC_NAME not in supported_compilers: