Author: mlandres Date: Wed Dec 5 17:11:11 2007 New Revision: 8037 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8037&view=rev Log: add "zypper lu" in python Added: trunk/libzypp-bindings/examples/python/list_updates.py (with props) Added: trunk/libzypp-bindings/examples/python/list_updates.py URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-bindings/examples/python/list_updates.py?rev=8037&view=auto ============================================================================== --- trunk/libzypp-bindings/examples/python/list_updates.py (added) +++ trunk/libzypp-bindings/examples/python/list_updates.py Wed Dec 5 17:11:11 2007 @@ -0,0 +1,39 @@ +#! /usr/bin/python + +import os, sys, types, string, re + +try: + import zypp +except ImportError: + print 'Dummy Import Error: Unable to import zypp bindings' + +print 'Reading repositories...' + +Z = zypp.ZYppFactory_instance().getZYpp() + +Z.initializeTarget( zypp.Pathname("/") ) + +repoManager = zypp.RepoManager() +repos = repoManager.knownRepositories() + +for repo in repos: + if repo.enabled() and repo.autorefresh(): + try: + repoManager.refreshMetadata(repo, zypp.RepoManager.RefreshIfNeeded) # or RefreshIfNeeded == 0 + except: + repoManager.buildCache( repo ) + + Z.addResolvables( repoManager.createFromCache( repo ).resolvables()) + +Z.addResolvables( Z.target().resolvables(), True ) + +# currently not swigged +Z.applyLocks() +Z.resolver().establishPool(); + +print 'List Upadtes:' +for item in Z.pool().byKindIterator(zypp.KindOfPatch()): + if item.status().isNeeded(): + resolvable = zypp.asKindPatch( item ) + print '%s | %s-%s | %s | %s' % (resolvable.repository().info().alias(), resolvable.name(), resolvable.edition(), resolvable.category(), item.status() ) + -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org