concretizer bugfix: fix generations of conditionals for dependencies
Spack was generating the same dependency connstraints twice in the output ASP: ``` declared_dependency("abinit", "hdf5", "link") :- node("abinit"), variant_value("abinit", "mpi", "True"), variant_value("abinit", "mpi", "True"). ``` This was because `AspFunction` was modifying itself when called. - [x] fix `AspFunction` so that every call returns a new object
This commit is contained in:
parent
e31be3da56
commit
9b1f05df00
1 changed files with 7 additions and 4 deletions
|
@ -73,13 +73,12 @@ def _id(thing):
|
|||
|
||||
|
||||
class AspFunction(AspObject):
|
||||
def __init__(self, name):
|
||||
def __init__(self, name, args=None):
|
||||
self.name = name
|
||||
self.args = []
|
||||
self.args = [] if args is None else args
|
||||
|
||||
def __call__(self, *args):
|
||||
self.args[:] = args
|
||||
return self
|
||||
return AspFunction(self.name, args)
|
||||
|
||||
def __getitem___(self, *args):
|
||||
self.args[:] = args
|
||||
|
@ -89,6 +88,9 @@ def __str__(self):
|
|||
return "%s(%s)" % (
|
||||
self.name, ', '.join(_id(arg) for arg in self.args))
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
|
||||
|
||||
class AspAnd(AspObject):
|
||||
def __init__(self, *args):
|
||||
|
@ -394,6 +396,7 @@ def pkg_rules(self, pkg):
|
|||
*self.spec_clauses(named_cond, body=True)
|
||||
)
|
||||
)
|
||||
self.out.write('\n')
|
||||
|
||||
# virtual preferences
|
||||
self.virtual_preferences(
|
||||
|
|
Loading…
Reference in a new issue