Skip to content

Commit

Permalink
Replace pkg_resources.parse_version with packaging.version.parse (#3693)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstufft committed May 17, 2016
1 parent 4627ef1 commit 5685e01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions pip/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pip.utils.logging import indent_log
from pip.exceptions import CommandError
from pip.status_codes import NO_MATCHES_FOUND
from pip._vendor.packaging.version import parse as parse_version
from pip._vendor import pkg_resources
from pip._vendor.six.moves import xmlrpc_client

Expand Down Expand Up @@ -140,6 +141,4 @@ def print_results(hits, name_column_width=None, terminal_width=None):


def highest_version(versions):
return next(iter(
sorted(versions, key=pkg_resources.parse_version, reverse=True)
))
return max(versions, key=parse_version)
6 changes: 2 additions & 4 deletions pip/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from pip._vendor.packaging.markers import Marker
from pip._vendor.packaging.requirements import InvalidRequirement, Requirement
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.packaging.version import Version
from pip._vendor.packaging.version import Version, parse as parse_version
from pip._vendor.six.moves import configparser

import pip.wheel
Expand Down Expand Up @@ -425,9 +425,7 @@ def run_egg_info(self):
command_desc='python setup.py egg_info')

if not self.req:
if isinstance(
pkg_resources.parse_version(self.pkg_info()["Version"]),
Version):
if isinstance(parse_version(self.pkg_info()["Version"]), Version):
op = "=="
else:
op = "==="
Expand Down

0 comments on commit 5685e01

Please sign in to comment.