diff --git a/packaging/piptool.py b/packaging/piptool.py index ffae941064..9eab1cd7d4 100644 --- a/packaging/piptool.py +++ b/packaging/piptool.py @@ -105,6 +105,10 @@ def pip_main(argv): parser.add_argument('--extra_pip_args', action='store', help=('Extra arguments to pass down to pip.')) +def sort_wheels(whls): + """Sorts a list of wheels deterministically.""" + return sorted(whls, key=lambda w: w.distribution() + '_' + w.version()) + def determine_possible_extras(whls): """Determines the list of possible "extras" for each .whl @@ -153,7 +157,7 @@ def is_possible(distro, extra): return { whl: [ extra - for extra in whl.extras() + for extra in sorted(whl.extras()) if is_possible(whl.distribution(), extra) ] for whl in whls @@ -177,7 +181,7 @@ def list_whls(): if fname.endswith('.whl'): yield os.path.join(root, fname) - whls = [Wheel(path) for path in list_whls()] + whls = sort_wheels(Wheel(path) for path in list_whls()) possible_extras = determine_possible_extras(whls) def repository_name(wheel): diff --git a/tools/piptool.par b/tools/piptool.par index bfe5e69112..95a73bc900 100755 Binary files a/tools/piptool.par and b/tools/piptool.par differ