How to use the distutils2.database function in Distutils2

To help you get started, we’ve selected a few Distutils2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github osupython / pip2 / pip2 / commands / _freeze.py View on Github external
def run(args):
    """
    Prints a list of all currently installed distributions. Checks the args
    variable for display options.
    """
    print("Recieved {0}".format(args))
    
    distributions = distutils2.database.get_distributions()
    
    print("---------- Installed Packages ----------\n")
    
    #display distribution name and version
    if args.long:
        for dis in distributions:
            print('{:<25}'.format(dis.name) + '{:>15}'.format(dis.version))
    #just display the name
    else:
        for dis in distributions:
            print(dis.name)