* fix pip!!

* make it work with old pip as well

* Added resiliency

* Don't need to check, just get the right name
This commit is contained in:
Thomas S Hatch 2016-05-11 14:39:30 -06:00 committed by Nicole Thomas
parent 43288b268d
commit 264ad34b3b

View File

@ -21,6 +21,7 @@ requisite to a pkg.installed state for the package which provides pip
# Import python libs # Import python libs
from __future__ import absolute_import from __future__ import absolute_import
import re
import logging import logging
# Import salt libs # Import salt libs
@ -163,8 +164,12 @@ def _check_pkg_version_format(pkg):
ret['version_spec'] = [] ret['version_spec'] = []
else: else:
ret['result'] = True ret['result'] = True
ret['prefix'] = install_req.req.project_name ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name)
ret['version_spec'] = install_req.req.specs if hasattr(install_req, "specifier"):
specifier = install_req.specifier
else:
specifier = install_req.req.specifier
ret['version_spec'] = [(spec.operator, spec.version) for spec in specifier]
return ret return ret