summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/solver/asp.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/spack/spack/solver/asp.py b/lib/spack/spack/solver/asp.py
index 969e1997df..7701f38620 100644
--- a/lib/spack/spack/solver/asp.py
+++ b/lib/spack/spack/solver/asp.py
@@ -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 @@ class AspFunction(AspObject):
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 @@ class AspGenerator(object):
*self.spec_clauses(named_cond, body=True)
)
)
+ self.out.write('\n')
# virtual preferences
self.virtual_preferences(