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/... ============================================================================== --- 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?re... ============================================================================== --- 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=10... ============================================================================== --- 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?re... ============================================================================== --- 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@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org