rename checked_spec_clauses() to spec_clauses()

This commit is contained in:
Todd Gamblin 2021-07-24 12:40:49 -07:00
parent ad5d632eeb
commit 7abe4ab309

View file

@ -808,7 +808,7 @@ def condition(self, required_spec, imposed_spec=None, name=None):
self.gen.fact(fn.condition(condition_id))
# requirements trigger the condition
requirements = self.checked_spec_clauses(
requirements = self.spec_clauses(
named_cond, body=True, required_from=name)
for pred in requirements:
self.gen.fact(
@ -816,7 +816,7 @@ def condition(self, required_spec, imposed_spec=None, name=None):
)
if imposed_spec:
imposed_constraints = self.checked_spec_clauses(
imposed_constraints = self.spec_clauses(
imposed_spec, body=False, required_from=name)
for pred in imposed_constraints:
# imposed "node"-like conditions are no-ops
@ -1006,13 +1006,13 @@ def flag_defaults(self):
self.gen.fact(fn.compiler_version_flag(
compiler.name, compiler.version, name, flag))
def checked_spec_clauses(self, *args, **kwargs):
"""Wrap a call to spec clauses into a try/except block that raise
a comprehensible error message in case of failure.
def spec_clauses(self, *args, **kwargs):
"""Wrap a call to `_spec_clauses()` into a try/except block that
raises a comprehensible error message in case of failure.
"""
requestor = kwargs.pop('required_from', None)
try:
clauses = self.spec_clauses(*args, **kwargs)
clauses = self._spec_clauses(*args, **kwargs)
except RuntimeError as exc:
msg = str(exc)
if requestor:
@ -1020,7 +1020,7 @@ def checked_spec_clauses(self, *args, **kwargs):
raise RuntimeError(msg)
return clauses
def spec_clauses(self, spec, body=False, transitive=True):
def _spec_clauses(self, spec, body=False, transitive=True):
"""Return a list of clauses for a spec mandates are true.
Arguments:
@ -1133,7 +1133,7 @@ class Body(object):
# add all clauses from dependencies
if transitive:
for dep in spec.traverse(root=False):
clauses.extend(self.spec_clauses(dep, body, transitive=False))
clauses.extend(self._spec_clauses(dep, body, transitive=False))
return clauses