maintain the fallabck because I am totally sick of this crap

This commit is contained in:
Thomas S Hatch 2016-05-19 16:33:15 -06:00
parent 2b5ad128bf
commit 081e6c5b83

View file

@ -155,21 +155,24 @@ def _check_pkg_version_format(pkg):
)
)
return ret
if install_req.req is None:
# This is most likely an url and there's no way to know what will
# be installed before actually installing it.
ret['result'] = True
ret['prefix'] = ''
ret['version_spec'] = []
else:
ret['result'] = True
ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name)
if hasattr(install_req, "specifier"):
specifier = install_req.specifier
try:
ret['prefix'] = install_req.req.project_name
ret['version_spec'] = install_req.req.specs
except Exception:
if install_req.req is None:
# This is most likely an url and there's no way to know what will
# be installed before actually installing it.
ret['result'] = True
ret['prefix'] = ''
ret['version_spec'] = []
else:
specifier = install_req.req.specifier
ret['version_spec'] = [(spec.operator, spec.version) for spec in specifier]
ret['result'] = True
ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name)
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