summaryrefslogtreecommitdiff
path: root/examples/python/list_resolvables.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/python/list_resolvables.py')
-rwxr-xr-xexamples/python/list_resolvables.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/examples/python/list_resolvables.py b/examples/python/list_resolvables.py
new file mode 100755
index 0000000..8138390
--- /dev/null
+++ b/examples/python/list_resolvables.py
@@ -0,0 +1,33 @@
+#! /usr/bin/python
+import zypp
+
+Z = zypp.ZYppFactory_instance().getZYpp()
+Z.initializeTarget( zypp.Pathname("/") )
+Z.target().load();
+
+repoManager = zypp.RepoManager()
+repos = repoManager.knownRepositories()
+
+for repo in repos:
+ if not repo.enabled():
+ continue
+ if not repoManager.isCached( repo ):
+ repoManager.buildCache( repo )
+ repoManager.loadFromCache( repo );
+
+print "Items: %d" % ( Z.pool().size() )
+
+for item in Z.pool():
+ if item.status().isInstalled():
+ t = "i"
+ else:
+ t = "*"
+
+ print "%s %s:%s-%s.%s\t(%s)" % ( t,
+ item.kind(),
+ item.name(),
+ item.edition(),
+ item.arch(),
+ item.repoInfo().alias() )
+ if zypp.isKindPackage( item ):
+ print " Group: %s" %(zypp.asKindPackage( item ).group( ) )