Conceal gccdeps/msvcdeps errors on inaccessible/unreadable files

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

View File

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

View File

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