(distributions, list_files=False, verbose=False)
return results_printed
Print the informations from installed distributions found.
Print the informations from installed distributions found.
Print the informations from installed distributions found .
def print_results(distributions, list_files=False, verbose=False):
    """
    Print the informations from installed distributions found.
    """
    results_printed = False
    for i, dist in enumerate(distributions):
        results_printed = True
        if i > 0:
            logger.info("---")

        name = dist.get('name', '')
        required_by = [
            pkg.project_name for pkg in pkg_resources.working_set
            if name in [required.name for required in pkg.requires()]
        ]

        logger.info("Name: %s", name)
        logger.info("Version: %s", dist.get('version', ''))
        logger.info("Summary: %s", dist.get('summary', ''))
        logger.info("Home-page: %s", dist.get('home-page', ''))
        logger.info("Author: %s", dist.get('author', ''))
        logger.info("Author-email: %s", dist.get('author-email', ''))
        logger.info("License: %s", dist.get('license', ''))
        logger.info("Location: %s", dist.get('location', ''))
        logger.info("Requires: %s", ', '.join(dist.get('requires', [])))
        logger.info("Required-by: %s", ', '.join(required_by))

        if verbose:
            logger.info("Metadata-Version: %s",
                        dist.get('metadata-version', ''))
            logger.info("Installer: %s", dist.get('installer', ''))
            logger.info("Classifiers:")
            for classifier in dist.get('classifiers', []):
                logger.info("  %s", classifier)
            logger.info("Entry-points:")
            for entry in dist.get('entry_points', []):
                logger.info("  %s", entry.strip())
        if list_files:
            logger.info("Files:")
            for line in dist.get('files', []):
                logger.info("  %s", line.strip())
            if "files" not in dist:
                logger.info("Cannot locate installed-files.txt")
    return results_printed
def print_results ( distributions , list_files = False , verbose = False ) : results_printed = False for i , dist in enumerate ( distributions ) : results_printed = True if i > 0 : logger . info ( "---" ) name = dist . get ( 'name' , '' ) required_by = [ pkg . project_name for pkg in pkg_resources . working_set if name in [ required . name for required in pkg . requires ( ) ] ] logger . info ( "Name: %s" , name ) logger . info ( "Version: %s" , dist . get ( 'version' , '' ) ) logger . info ( "Summary: %s" , dist . get ( 'summary' , '' ) ) logger . info ( "Home-page: %s" , dist . get ( 'home-page' , '' ) ) logger . info ( "Author: %s" , dist . get ( 'author' , '' ) ) logger . info ( "Author-email: %s" , dist . get ( 'author-email' , '' ) ) logger . info ( "License: %s" , dist . get ( 'license' , '' ) ) logger . info ( "Location: %s" , dist . get ( 'location' , '' ) ) logger . info ( "Requires: %s" , ', ' . join ( dist . get ( 'requires' , [ ] ) ) ) logger . info ( "Required-by: %s" , ', ' . join ( required_by ) ) if verbose : logger . info ( "Metadata-Version: %s" , dist . get ( 'metadata-version' , '' ) ) logger . info ( "Installer: %s" , dist . get ( 'installer' , '' ) ) logger . info ( "Classifiers:" ) for classifier in dist . get ( 'classifiers' , [ ] ) : logger . info ( "  %s" , classifier ) logger . info ( "Entry-points:" ) for entry in dist . get ( 'entry_points' , [ ] ) : logger . info ( "  %s" , entry . strip ( ) ) if list_files : logger . info ( "Files:" ) for line in dist . get ( 'files' , [ ] ) : logger . info ( "  %s" , line . strip ( ) ) if "files" not in dist : logger . info ( "Cannot locate installed-files.txt" ) return results_printed