Updated pip_state to work with pip 8.0 on 2015.8

This commit is contained in:
justinta89 2016-01-20 14:43:50 -07:00
parent 13add7d142
commit 9cb17332fa

View File

@ -47,6 +47,14 @@ if HAS_PIP is True:
del pip
if 'pip' in sys.modules:
del sys.modules['pip']
ver = pip.__version__.split('.')
pip_ver = tuple([int(x) for x in ver if x.isdigit()])
if pip_ver >= (8, 0, 0):
from pip.exceptions import InstallationError
else:
InstallationError = ValueError
# pylint: enable=import-error
logger = logging.getLogger(__name__)
@ -135,7 +143,7 @@ def _check_pkg_version_format(pkg):
break
else:
install_req = pip.req.InstallRequirement.from_line(pkg)
except ValueError as exc:
except (ValueError, InstallationError) as exc:
ret['result'] = False
if not from_vcs and '=' in pkg and '==' not in pkg:
ret['comment'] = (