Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit abc4869

Browse filesBrowse files
authored
packaging/piptool: sort wheels and extras for deterministic output (#279)
1 parent 17dba4b commit abc4869
Copy full SHA for abc4869

File tree

Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-2
lines changed

‎packaging/piptool.py

Copy file name to clipboardExpand all lines: packaging/piptool.py
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ def pip_main(argv):
105105
parser.add_argument('--extra_pip_args', action='store',
106106
help=('Extra arguments to pass down to pip.'))
107107

108+
def sort_wheels(whls):
109+
"""Sorts a list of wheels deterministically."""
110+
return sorted(whls, key=lambda w: w.distribution() + '_' + w.version())
111+
108112
def determine_possible_extras(whls):
109113
"""Determines the list of possible "extras" for each .whl
110114
@@ -153,7 +157,7 @@ def is_possible(distro, extra):
153157
return {
154158
whl: [
155159
extra
156-
for extra in whl.extras()
160+
for extra in sorted(whl.extras())
157161
if is_possible(whl.distribution(), extra)
158162
]
159163
for whl in whls
@@ -177,7 +181,7 @@ def list_whls():
177181
if fname.endswith('.whl'):
178182
yield os.path.join(root, fname)
179183

180-
whls = [Wheel(path) for path in list_whls()]
184+
whls = sort_wheels(Wheel(path) for path in list_whls())
181185
possible_extras = determine_possible_extras(whls)
182186

183187
def repository_name(wheel):

‎tools/piptool.par

Copy file name to clipboard
334 Bytes
Binary file not shown.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.