# Path: elbepack/treeutils.py
# class etree(ebase):
#     def __init__(self, fname):
#         if fname is not None:
#             parser = XMLParser(huge_tree=True, remove_comments=False)
#             et = parse(fname, parser=parser)
#         else:
#             et = ElementTree(file=None)
# 
#         ebase.__init__(self, et)
# 
#     def write(self, fname, encoding=None):
#         # Make sure, that we end with a newline
#         self.et.getroot().tail = '\n'
#         self.et.write(fname, encoding=encoding)
# 
#     def tostring(self):
#         return self.et.tostring()
# 
#     def ensure_child(self, tag):
#         retval = self.et.find("./" + tag)
#         if retval is not None:
#             return elem(retval)
#         return elem(SubElement(self.et.getroot(), tag))
# 
#     def set_child_position(self, child, pos):
#         root = self.et.getroot()
#         root.remove(child.et)
#         root.insert(pos, child.et)
# 
#     def setroot(self, tag):
#         retval = elem(Element(tag))
#         # pylint: disable=protected-access
#         self.et._setroot(retval.et)
#         return retval
# 
#     @property
#     def root(self):
#         return elem(self.et.getroot())
# 
# Path: elbepack/log.py
# @contextmanager
# def elbe_logging(*args, **kwargs):
#     try:
#         open_logging(*args, **kwargs)
#         yield
#     finally:
#         close_logging()


import logging
import sys
import apt
import apt.progress
from optparse import OptionParser
from elbepack.treeutils import etree
from elbepack.log import elbe_logging
        cache.open(None)

        for p in cache:
            if not p.is_installed:
                continue
            if p.is_auto_removable:
                p.mark_delete(purge=True)
                logging.info("MARKED AS AUTOREMOVE %s", p.name)

    cache.commit(apt.progress.base.AcquireProgress(),
                 apt.progress.base.InstallProgress())

    return errors


def run_command(argv):
    oparser = OptionParser(usage="usage: %prog adjustpkgs [options] <xmlfile>")

    oparser.add_option("-o", "--output", dest="output",
                       help="name of logfile")
    oparser.add_option("-n", "--name", dest="name",
                       help="name of the project (included in the report)")
    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        print("Wrong number of arguments")
        oparser.print_help()
        sys.exit(20)

    if not opt.output:

# Path: elbepack/treeutils.py
# class etree(ebase):
#     def __init__(self, fname):
#         if fname is not None:
#             parser = XMLParser(huge_tree=True, remove_comments=False)
#             et = parse(fname, parser=parser)
#         else:
#             et = ElementTree(file=None)
# 
#         ebase.__init__(self, et)
# 
#     def write(self, fname, encoding=None):
#         # Make sure, that we end with a newline
#         self.et.getroot().tail = '\n'
#         self.et.write(fname, encoding=encoding)
# 
#     def tostring(self):
#         return self.et.tostring()
# 
#     def ensure_child(self, tag):
#         retval = self.et.find("./" + tag)
#         if retval is not None:
#             return elem(retval)
#         return elem(SubElement(self.et.getroot(), tag))
# 
#     def set_child_position(self, child, pos):
#         root = self.et.getroot()
#         root.remove(child.et)
#         root.insert(pos, child.et)
# 
#     def setroot(self, tag):
#         retval = elem(Element(tag))
#         # pylint: disable=protected-access
#         self.et._setroot(retval.et)
#         return retval
# 
#     @property
#     def root(self):
#         return elem(self.et.getroot())
# 
# Path: elbepack/log.py
# @contextmanager
# def elbe_logging(*args, **kwargs):
#     try:
#         open_logging(*args, **kwargs)
#         yield
#     finally:
#         close_logging()


# Path: elbepack/commands/adjustpkgs.py
import logging
import sys
import apt
import apt.progress
from optparse import OptionParser
from elbepack.treeutils import etree
from elbepack.log import elbe_logging

        cache.open(None)

        for p in cache:
            if not p.is_installed:
                continue
            if p.is_auto_removable:
                p.mark_delete(purge=True)
                logging.info("MARKED AS AUTOREMOVE %s", p.name)

    cache.commit(apt.progress.base.AcquireProgress(),
                 apt.progress.base.InstallProgress())

    return errors


def run_command(argv):
    oparser = OptionParser(usage="usage: %prog adjustpkgs [options] <xmlfile>")

    oparser.add_option("-o", "--output", dest="output",
                       help="name of logfile")
    oparser.add_option("-n", "--name", dest="name",
                       help="name of the project (included in the report)")
    (opt, args) = oparser.parse_args(argv)

    if len(args) != 1:
        print("Wrong number of arguments")
        oparser.print_help()
        sys.exit(20)

    if not opt.output:

        return 0