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 e6d0f1b

Browse filesBrowse files
andrew-dgpratte-outbox
authored andcommitted
packaging/piptool: sort wheels and extras for deterministic output (#279)
1 parent 1f367c8 commit e6d0f1b
Copy full SHA for e6d0f1b

File tree

Expand file treeCollapse file tree

3 files changed

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

3 files changed

+8
-2
lines changed

‎packaging/piptool.py

Copy file name to clipboardExpand all lines: packaging/piptool.py
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ def pip_main(argv):
101101
parser.add_argument('--directory', action='store',
102102
help=('The directory into which to put .whl files.'))
103103

104+
105+
def sort_wheels(whls):
106+
"""Sorts a list of wheels deterministically."""
107+
return sorted(whls, key=lambda w: w.distribution() + '_' + w.version())
108+
109+
104110
def determine_possible_extras(whls):
105111
"""Determines the list of possible "extras" for each .whl
106112
@@ -149,7 +155,7 @@ def is_possible(distro, extra):
149155
return {
150156
whl: [
151157
extra
152-
for extra in whl.extras()
158+
for extra in sorted(whl.extras())
153159
if is_possible(whl.distribution(), extra)
154160
]
155161
for whl in whls
@@ -170,7 +176,7 @@ def list_whls():
170176
if fname.endswith('.whl'):
171177
yield os.path.join(root, fname)
172178

173-
whls = [Wheel(path) for path in list_whls()]
179+
whls = sort_wheels(Wheel(path) for path in list_whls())
174180
possible_extras = determine_possible_extras(whls)
175181

176182
def whl_library(wheel):

‎tools/piptool.par

Copy file name to clipboard
1.68 KB
Binary file not shown.

‎tools/whltool.par

Copy file name to clipboard
1.35 KB
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.