[zypp-devel] [PATCH 1/3] Let Solver.solve() return a bool in Python
Let the Python binding return a bool from Solver.solve() as described in
the documentation.
Signed-off-by: Jan Blunck
This patch adds installs(), updates() and removes() methods to the Python
interface for the Solver.
Signed-off-by: Jan Blunck
On Tue, Mar 17, 2009 at 02:36:46PM +0100, Jan Blunck wrote:
This patch adds installs(), updates() and removes() methods to the Python interface for the Solver.
Uh, this is gonna be obsolete in a week or two... Cheers, Michael. -- Michael Schroeder mls@suse.de SUSE LINUX Products GmbH, GF Markus Rex, HRB 16746 AG Nuernberg main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);} -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Tue, Mar 17, Michael Schroeder wrote:
On Tue, Mar 17, 2009 at 02:36:46PM +0100, Jan Blunck wrote:
This patch adds installs(), updates() and removes() methods to the Python interface for the Solver.
Uh, this is gonna be obsolete in a week or two...
That means the solver will not install, update or remove any packages in the future? I'm aware that the API isn't stable yet but the basic functionality will be there in the future as well, right? Cheers, Jan -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
* Michael Schroeder
On Tue, Mar 17, 2009 at 02:36:46PM +0100, Jan Blunck wrote:
This patch adds installs(), updates() and removes() methods to the Python interface for the Solver.
Uh, this is gonna be obsolete in a week or two...
Why ? Whats the planned replacement ? Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
* Jan Blunck
This patch adds installs(), updates() and removes() methods to the Python interface for the Solver.
Applied to head, thanks for the patch ! Klaus -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
Ask the Solver for a specific provider instead of the Solvable id in the
pool.
Signed-off-by: Jan Blunck
* Jan Blunck
Ask the Solver for a specific provider instead of the Solvable id in the pool.
Thanks for your patch. I will take your additional testcase (assertion that only one product is in the pool) but keep the deleted (test 'get' and test 'pool iterator') ones. Klaus
Signed-off-by: Jan Blunck
--- bindings/python/tests/solvable.py | 20 ++++---------------- 1 files changed, 4 insertions(+), 16 deletions(-) diff --git a/bindings/python/tests/solvable.py b/bindings/python/tests/solvable.py index 720bfd2..141368f 100644 --- a/bindings/python/tests/solvable.py +++ b/bindings/python/tests/solvable.py @@ -34,22 +34,10 @@ class TestSequenceFunctions(unittest.TestCase): self.pool.set_arch("i686") self.pool.add_solv( "os11-biarch.solv" ) assert self.pool.size() > 0 - - def test_solvable(self): - solv = self.pool.get(2) - assert solv - print solv - print "%s-%s.%s[%s]" % (solv.name(),solv.evr(),solv.arch(),solv.vendor()) - - def test_deps(self): - return - for s in pool: - print s - show_dep( "Provides", s.provides()) - show_dep( "Requires", s.requires()) - show_dep( "Obsoletes", s.obsoletes()) - show_dep( "Conflicts", s.conflicts())
+ def test_solvable(self): + solv = list(self.pool.providers( 'product:openSUSE' )) + assert len(solv) == 1, len(solv)
def test_creation(self): repo = self.pool.create_repo( 'test' ) @@ -67,7 +55,7 @@ class TestSequenceFunctions(unittest.TestCase): assert solv2.evr() == "2.0-0" solv2.set_vendor("Ruby") assert solv2.vendor() == "Ruby" - + rel = satsolver.Relation( self.pool, "two", satsolver.REL_GE, "2.0-0" ) assert rel solv1.requires().add(rel) -- 1.6.1.3
-- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
--- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Tue, Mar 17, Klaus Kaempf wrote:
* Jan Blunck
[Mar 17. 2009 14:46]: Ask the Solver for a specific provider instead of the Solvable id in the pool.
Thanks for your patch. I will take your additional testcase (assertion that only one product is in the pool) but keep the deleted (test 'get' and test 'pool iterator') ones.
Actually there is not get() method anymore. I don't think that the pool iterator belongs to the solvable testcase. Since it started with a return statement it wasn't actually testing anything at all. What would make sense would be: def test_pool_iterate: for s in self.pool: assert s.pool() == self.pool Cheers, Jan -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Tue, Mar 17, Jan Blunck wrote:
What would make sense would be:
def test_pool_iterate: for s in self.pool: assert s.pool() == self.pool
That must read as follows: assert str(s.pool()) == str(self.pool) SWIG is creating proxy objects for the real pool. Since the address of the pool is included in the string representation this actually works. -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
* Jan Blunck
On Tue, Mar 17, Jan Blunck wrote:
What would make sense would be:
def test_pool_iterate: for s in self.pool: assert s.pool() == self.pool
That must read as follows:
assert str(s.pool()) == str(self.pool)
No! If you need workarounds like this, its a bug in the bindings. (Missing 'equality' function for Pool in Python)
SWIG is creating proxy objects for the real pool. Since the address of the pool is included in the string representation this actually works.
Yeah, but thats ugly ;-) Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Tue, Mar 17, Klaus Kaempf wrote:
* Jan Blunck
[Mar 17. 2009 15:50]: On Tue, Mar 17, Jan Blunck wrote:
What would make sense would be:
def test_pool_iterate: for s in self.pool: assert s.pool() == self.pool
That must read as follows:
assert str(s.pool()) == str(self.pool)
No! If you need workarounds like this, its a bug in the bindings.
Right.
(Missing 'equality' function for Pool in Python)
That should be done by SWIG automagically. It knows that it is working with _Pool pointers so it should implement a __cmp()__ method for comparing them. -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
* Jan Blunck
(Missing 'equality' function for Pool in Python)
That should be done by SWIG automagically.
Somehow, it doesn't.
It knows that it is working with _Pool pointers so it should implement a __cmp()__ method for comparing them.
Exactly. Its already implemented for Solvable and Relation. I'll add Pool and Repo soon. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Tue, Mar 17, Klaus Kaempf wrote:
* Jan Blunck
[Mar 17. 2009 17:32]: (Missing 'equality' function for Pool in Python)
That should be done by SWIG automagically.
Somehow, it doesn't.
It knows that it is working with _Pool pointers so it should implement a __cmp()__ method for comparing them.
Exactly. Its already implemented for Solvable and Relation. I'll add Pool and Repo soon.
Relax. I'm already working on that. Cheers, Jan -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
* Jan Blunck
On Tue, Mar 17, Klaus Kaempf wrote:
* Jan Blunck
[Mar 17. 2009 17:32]: (Missing 'equality' function for Pool in Python)
That should be done by SWIG automagically.
Somehow, it doesn't.
It knows that it is working with _Pool pointers so it should implement a __cmp()__ method for comparing them.
Exactly. Its already implemented for Solvable and Relation. I'll add Pool and Repo soon.
Relax. I'm already working on that.
Too late. Just committed ;-) Klaus -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
* Jan Blunck
- - def test_solvable(self): - solv = self.pool.get(2) - assert solv - print solv - print "%s-%s.%s[%s]" % (solv.name(),solv.evr(),solv.arch(),solv.vendor())
The 'get' function was replaced by 'solvable' in HEAD in order to make it more self-explanatory. Klaus --- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
On Tue, Mar 17, Klaus Kaempf wrote:
* Jan Blunck
[Mar 17. 2009 14:46]: - - def test_solvable(self): - solv = self.pool.get(2) - assert solv - print solv - print "%s-%s.%s[%s]" % (solv.name(),solv.evr(),solv.arch(),solv.vendor())
The 'get' function was replaced by 'solvable' in HEAD in order to make it more self-explanatory.
Ah, ok. Thanks, Jan -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
* Jan Blunck
Let the Python binding return a bool from Solver.solve() as described in the documentation.
Committed. Thanks ! Klaus -- To unsubscribe, e-mail: zypp-devel+unsubscribe@opensuse.org For additional commands, e-mail: zypp-devel+help@opensuse.org
participants (3)
-
Jan Blunck
-
Klaus Kaempf
-
Michael Schroeder