ViktorOgnev
10/30/2015 - 8:08 AM

Copmare output of 2 pip freeze commands

Copmare output of 2 pip freeze commands

def compare_deps(freeze1, freeze2):
    freeze1 = freeze1.splitlines()
    freeze2 = freeze2.splitlines()
    print('arg1 contains {} items, arg2 contains {} items'.format(len(freeze1), len(freeze2)))
    for item1 in freeze1:
        if '==' not in item1:
            continue
        name1, ver1 = item1.split('==')
        for item2 in freeze2:
            if '==' not in item2:
                continue
            name2, ver2 = item2.split('==')
            if name1 == name2 and ver1 != ver2:
                print('Mismatch {} {}'.format(item1, item2))