Changes from Version 1 of YumCodeSnippet/YumList

Show
Ignore:
Author:
james (IP: 65.172.155.230)
Timestamp:
02/02/09 15:43:18 (9 years ago)
Comment:

move from code snippets page

Legend:

Unmodified
Added
Removed
Modified
  • YumCodeSnippet/YumList

    v0 v1  
     1A simple version of the "yum list" command: 
     2 
     3{{{ 
     4#!python 
     5yb = yum.YumBase() 
     6yb.conf.cache = os.geteuid() != 1 
     7pl = yb.doPackageLists(patterns=sys.argv[1:]) 
     8if pl.installed: 
     9    print "Installed Packages" 
     10    for pkg in sorted(pl.installed): 
     11        print pkg 
     12if pl.available: 
     13    print "Available Packages" 
     14    for pkg in sorted(pl.available): 
     15        print pkg, pkg.repo 
     16if pl.reinstall_available: 
     17    print "Re-install Available Packages" 
     18    for pkg in sorted(pl.reinstall_available): 
     19        print pkg, pkg.repo 
     20}}}