packaging/piptool: sort wheels and extras for deterministic output (#279)
diff --git a/packaging/piptool.py b/packaging/piptool.py index ffae941..9eab1cd 100644 --- a/packaging/piptool.py +++ b/packaging/piptool.py
@@ -105,6 +105,10 @@ 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 @@ 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 @@ 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 bfe5e69..95a73bc 100755 --- a/tools/piptool.par +++ b/tools/piptool.par Binary files differ