Let the Python binding return a bool from Solver.solve() as described in
the documentation.
Signed-off-by: Jan Blunck
---
bindings/python/tests/solvable.py | 5 +++--
bindings/solver.i | 5 +++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/bindings/python/tests/solvable.py b/bindings/python/tests/solvable.py
index d25a389..7c53659 100644
--- a/bindings/python/tests/solvable.py
+++ b/bindings/python/tests/solvable.py
@@ -76,9 +76,10 @@ class TestSequenceFunctions(unittest.TestCase):
transaction = self.pool.create_transaction()
transaction.install( solv1 )
- solver = self.pool.create_solver( self.pool.create_repo( "system" ) )
+ solver = self.pool.create_solver()
# self.pool.debug = 255
- solver.solve( transaction )
+ res = solver.solve( transaction )
+ assert res.__class__.__name__ == 'bool', res.__class__.__name__
# solver.each_to_install { |s|
# puts "Install #{s}"
# }
diff --git a/bindings/solver.i b/bindings/solver.i
index 768793d..ea9c3c3 100644
--- a/bindings/solver.i
+++ b/bindings/solver.i
@@ -785,6 +785,11 @@ typedef struct solver {} Solver;
%typemap(out) int solve
"$result = $1 ? Qtrue : Qfalse;";
#endif
+#if defined(SWIGPYTHON)
+%typemap(out) int solve {
+ $result = PyBool_FromLong((long) ($1 ? 1 : 0));
+}
+#endif
/*
* Solve the given Transaction
*
--
1.6.1.3
--
To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-devel+help@opensuse.org