home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / computerjanitor / plugins / autoremoval_plugin.py next >
Encoding:
Python Source  |  2009-04-17  |  1.5 KB  |  42 lines

  1. # autoremoval_plugin.py - remove packages apt has marked as auto-removable
  2. # Copyright (C) 2008  Canonical, Ltd.
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, version 3 of the License.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  15.  
  16.  
  17. import os
  18.  
  19. import computerjanitor
  20. import computerjanitorapp
  21. _ = computerjanitorapp.setup_gettext()
  22.  
  23.  
  24. class AutoRemovablePlugin(computerjanitor.Plugin):
  25.  
  26.     """Plugin for finding packages apt says are removable.
  27.     
  28.     Automatically removable packages are those that apt installed because
  29.     they were dependencies of something else, but which the user never
  30.     asked for specifically, and which further are no longer used by
  31.     anything, hopefully also not by the user.
  32.     
  33.     """
  34.  
  35.     description = _("Package was installed because another package "
  36.                     "required it, but now nothing requires it anymore.")
  37.  
  38.     def get_cruft(self):
  39.         for pkg in self.app.apt_cache:
  40.             if pkg.isAutoRemovable:
  41.                 yield computerjanitor.PackageCruft(pkg, self.description)
  42.