def eclean_pkg(destructive=False, package_names=False, time_limit=0, exclude_file='/etc/eclean/packages.exclude'):
 if (exclude_file is None):
  exclude = None
 else:
  try:
   exclude = _parse_exclude(exclude_file)
  except excludemod.ParseExcludeFileException as e:
   ret = {e: 'Invalid exclusion file: {0}'.format(exclude_file)}
   return ret
 if (time_limit != 0):
  time_limit = cli.parseTime(time_limit)
 clean_size = 0
 clean_me = search.findPackages(None, destructive=destructive, package_names=package_names, time_limit=time_limit, exclude=exclude, pkgdir=search.pkgdir)
 cleaned = dict()
 def _eclean_progress_controller(size, key, *args):
  cleaned[key] = _pretty_size(size)
  return True
 if clean_me:
  cleaner = clean.CleanUp(_eclean_progress_controller)
  clean_size = cleaner.clean_pkgs(clean_me, search.pkgdir)
 ret = {'cleaned': cleaned, 'total_cleaned': _pretty_size(clean_size)}
 return ret

def eclean_pkg ( destructive = False , package_names = False , time_limit = 0 , exclude_file = '/etc/eclean/packages.exclude' ) : if ( exclude_file is None ) : exclude = None else : try : exclude = _parse_exclude ( exclude_file ) except excludemod . ParseExcludeFileException as e : ret = { e : 'Invalid exclusion file: {0}' . format ( exclude_file ) } return ret if ( time_limit != 0 ) : time_limit = cli . parseTime ( time_limit ) clean_size = 0 clean_me = search . findPackages ( None , destructive = destructive , package_names = package_names , time_limit = time_limit , exclude = exclude , pkgdir = search . pkgdir ) cleaned = dict ( ) def _eclean_progress_controller ( size , key , * args ) : cleaned [ key ] = _pretty_size ( size ) return True if clean_me : cleaner = clean . CleanUp ( _eclean_progress_controller ) clean_size = cleaner . clean_pkgs ( clean_me , search . pkgdir ) ret = { 'cleaned' : cleaned , 'total_cleaned' : _pretty_size ( clean_size ) } return ret
clean obsolete binary packages destructive only keep minimum for reinstallation package_names protect all versions of installed packages .