'Process a category package.'

def process_category_package(self, category, name=None, distribution=None):

    cat_desc = None
    category = asmodule(category)
    if hasattr(category, 'widget_discovery'):
        widget_discovery = getattr(category, 'widget_discovery')
        self.process_loader(widget_discovery)
        return
    elif hasattr(category, 'category_description'):
        category_description = getattr(category, 'category_description')
        try:
            cat_desc = category_description()
        except Exception:
            log.error("Error    calling    'category_description'    in    %r.", category, exc_info=True)
            cat_desc = default_category_for_module(category)
    else:
        try:
            cat_desc = CategoryDescription.from_package(category)
        except (CategorySpecificationError, Exception) as ex:
            log.info('Package    %r    does    not    describe    a    category.', category, exc_info=True)
            cat_desc = default_category_for_module(category)
    if (name is not None):
        cat_desc.name = name
    if (distribution is not None):
        cat_desc.project_name = distribution.project_name
    self.handle_category(cat_desc)
    desc_iter = self.iter_widget_descriptions(category, category_name=cat_desc.name, distribution=distribution)
    for desc in desc_iter:
        self.handle_widget(desc)
