More naturally sort requirements.

This commit is contained in:
Anthony Sottile 2015-02-12 07:51:34 -08:00
parent a4ba3ca567
commit 151d485a81
2 changed files with 5 additions and 1 deletions

View file

@ -18,7 +18,10 @@ class Requirement(object):
elif requirement.value == b'\n':
return False
else:
return self.value < requirement.value
return (
self.value.partition(b'==') <
requirement.value.partition(b'==')
)
def fix_requirements(f):

View file

@ -15,6 +15,7 @@ TESTS = (
(b'#comment\n\nbar\nfoo\n', 0, b'#comment\n\nbar\nfoo\n'),
(b'\nfoo\nbar\n', 1, b'bar\n\nfoo\n'),
(b'\nbar\nfoo\n', 0, b'\nbar\nfoo\n'),
(b'pyramid==1\npyramid-foo==2\n', 0, b'pyramid==1\npyramid-foo==2\n'),
)