update semver module for python 3.5

Python 3 does not allow comparison between integers and strings. The
semver RulesTest class includes a case where the most recent tag is an
EOL name tag, and the comparison breaks under Python 3. This patch
modifies the comparison to skip over tags that can't be compared to only
look at numerical versions.

Depends-On: I9e56e1e5b0171f8ed4ae05c6aba36c4c733486fa
Change-Id: Id9ad068a279653ffb20c60d1752e41bb0e7bc5d1
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-06-02 11:50:19 -04:00 committed by Davanum Srinivas (dims)
parent 287ac21f16
commit 3425b3ee64
1 changed files with 9 additions and 6 deletions

View File

@ -99,10 +99,13 @@ def sanity_check_version(new_version, existing_versions):
% format_version(new_version)
)
if existing_versions:
latest_version = existing_versions[-1]
if new_version[0] > latest_version[0]:
warnings.append(
'%r is a major version increment over %r' %
(format_version(new_version), format_version(latest_version))
)
for latest_numerical_version in reversed(existing_versions):
if type(latest_numerical_version[0]) != int:
continue
if new_version[0] > latest_numerical_version[0]:
warnings.append(
'%r is a major version increment over %r' %
(format_version(new_version), format_version(latest_numerical_version))
)
break
return warnings