Mailinglist Archive: zypp-commit (185 mails)
| < Previous | Next > |
[zypp-commit] r10748 - in /trunk/sat-solver/bindings: python/tests/repo.py relation.i repo.i solvable.i
- From: kkaempf@xxxxxxxxxxxxxxxx
- Date: Tue, 05 Aug 2008 10:37:23 -0000
- Message-id: <20080805103723.B4A4239C4A@xxxxxxxxxxxxxxxx>
Author: kkaempf
Date: Tue Aug 5 12:37:23 2008
New Revision: 10748
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10748&view=rev
Log:
add __str__() to 'stringify' for Python
Modified:
trunk/sat-solver/bindings/python/tests/repo.py
trunk/sat-solver/bindings/relation.i
trunk/sat-solver/bindings/repo.i
trunk/sat-solver/bindings/solvable.i
Modified: trunk/sat-solver/bindings/python/tests/repo.py
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/python/tests/repo.py?rev=10748&r1=10747&r2=10748&view=diff
==============================================================================
--- trunk/sat-solver/bindings/python/tests/repo.py (original)
+++ trunk/sat-solver/bindings/python/tests/repo.py Tue Aug 5 12:37:23 2008
@@ -58,8 +58,8 @@
assert pool
pool.set_arch("i686")
repo = pool.add_solv( "os11-biarch.solv" )
-# for s in repo:
-# print s
+ for i in range(0,repo.size()):
+ print repo.get(i)
assert True
Modified: trunk/sat-solver/bindings/relation.i
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/relation.i?rev=10748&r1=10747&r2=10748&view=diff
==============================================================================
--- trunk/sat-solver/bindings/relation.i (original)
+++ trunk/sat-solver/bindings/relation.i Tue Aug 5 12:37:23 2008
@@ -27,8 +27,14 @@
~Relation()
{ relation_free( $self ); }
- %rename("to_s") asString();
- const char *asString()
+#if defined(SWIGRUBY)
+ %rename("to_s") string();
+#endif
+#if defined(SWIGPYTHON)
+ %rename("__str__") string();
+#endif
+
+ const char *string()
{ return dep2str( $self->pool, $self->id ); }
Pool *pool()
Modified: trunk/sat-solver/bindings/repo.i
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/repo.i?rev=10748&r1=10747&r2=10748&view=diff
==============================================================================
--- trunk/sat-solver/bindings/repo.i (original)
+++ trunk/sat-solver/bindings/repo.i Tue Aug 5 12:37:23 2008
@@ -83,19 +83,6 @@
{ repo_xsolvables_iterate( $self, generic_xsolvables_iterate_callback ); }
#endif
-#if defined(SWIGPYTHON)
- PyObject *__iter__()
- {
- fprintf(stderr," Repo.iter()\n");
- return NULL;
- }
- PyObject *next()
- {
- fprintf(stderr," Repo.next()\n");
- return NULL;
- }
-#endif
-
#if defined(SWIGRUBY)
/* %rename is rejected by swig for [] */
%alias get "[]";
Modified: trunk/sat-solver/bindings/solvable.i
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/solvable.i?rev=10748&r1=10747&r2=10748&view=diff
==============================================================================
--- trunk/sat-solver/bindings/solvable.i (original)
+++ trunk/sat-solver/bindings/solvable.i Tue Aug 5 12:37:23 2008
@@ -207,9 +207,12 @@
{ xsolvable_solvable($self)->vendor = str2id( $self->pool, vendor, 1 ); }
#if defined(SWIGRUBY)
- %rename("to_s") asString();
+ %rename("to_s") string();
#endif
- const char *asString()
+#if defined(SWIGPYTHON)
+ %rename("__str__") string();
+#endif
+ const char *string()
{
if ( $self->id == ID_NULL ) return "";
return solvable2str( $self->pool, xsolvable_solvable( $self ) );
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx
Date: Tue Aug 5 12:37:23 2008
New Revision: 10748
URL: http://svn.opensuse.org/viewcvs/zypp?rev=10748&view=rev
Log:
add __str__() to 'stringify' for Python
Modified:
trunk/sat-solver/bindings/python/tests/repo.py
trunk/sat-solver/bindings/relation.i
trunk/sat-solver/bindings/repo.i
trunk/sat-solver/bindings/solvable.i
Modified: trunk/sat-solver/bindings/python/tests/repo.py
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/python/tests/repo.py?rev=10748&r1=10747&r2=10748&view=diff
==============================================================================
--- trunk/sat-solver/bindings/python/tests/repo.py (original)
+++ trunk/sat-solver/bindings/python/tests/repo.py Tue Aug 5 12:37:23 2008
@@ -58,8 +58,8 @@
assert pool
pool.set_arch("i686")
repo = pool.add_solv( "os11-biarch.solv" )
-# for s in repo:
-# print s
+ for i in range(0,repo.size()):
+ print repo.get(i)
assert True
Modified: trunk/sat-solver/bindings/relation.i
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/relation.i?rev=10748&r1=10747&r2=10748&view=diff
==============================================================================
--- trunk/sat-solver/bindings/relation.i (original)
+++ trunk/sat-solver/bindings/relation.i Tue Aug 5 12:37:23 2008
@@ -27,8 +27,14 @@
~Relation()
{ relation_free( $self ); }
- %rename("to_s") asString();
- const char *asString()
+#if defined(SWIGRUBY)
+ %rename("to_s") string();
+#endif
+#if defined(SWIGPYTHON)
+ %rename("__str__") string();
+#endif
+
+ const char *string()
{ return dep2str( $self->pool, $self->id ); }
Pool *pool()
Modified: trunk/sat-solver/bindings/repo.i
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/repo.i?rev=10748&r1=10747&r2=10748&view=diff
==============================================================================
--- trunk/sat-solver/bindings/repo.i (original)
+++ trunk/sat-solver/bindings/repo.i Tue Aug 5 12:37:23 2008
@@ -83,19 +83,6 @@
{ repo_xsolvables_iterate( $self, generic_xsolvables_iterate_callback ); }
#endif
-#if defined(SWIGPYTHON)
- PyObject *__iter__()
- {
- fprintf(stderr," Repo.iter()\n");
- return NULL;
- }
- PyObject *next()
- {
- fprintf(stderr," Repo.next()\n");
- return NULL;
- }
-#endif
-
#if defined(SWIGRUBY)
/* %rename is rejected by swig for [] */
%alias get "[]";
Modified: trunk/sat-solver/bindings/solvable.i
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/solvable.i?rev=10748&r1=10747&r2=10748&view=diff
==============================================================================
--- trunk/sat-solver/bindings/solvable.i (original)
+++ trunk/sat-solver/bindings/solvable.i Tue Aug 5 12:37:23 2008
@@ -207,9 +207,12 @@
{ xsolvable_solvable($self)->vendor = str2id( $self->pool, vendor, 1 ); }
#if defined(SWIGRUBY)
- %rename("to_s") asString();
+ %rename("to_s") string();
#endif
- const char *asString()
+#if defined(SWIGPYTHON)
+ %rename("__str__") string();
+#endif
+ const char *string()
{
if ( $self->id == ID_NULL ) return "";
return solvable2str( $self->pool, xsolvable_solvable( $self ) );
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx
| < Previous | Next > |