blast, put the try/except int he right place

This commit is contained in:
Thomas S Hatch 2016-05-19 17:00:16 -06:00
parent 081e6c5b83
commit 1d8b289db1

View File

@ -155,10 +155,6 @@ def _check_pkg_version_format(pkg):
) )
) )
return ret return ret
try:
ret['prefix'] = install_req.req.project_name
ret['version_spec'] = install_req.req.specs
except Exception:
if install_req.req is None: if install_req.req is None:
# This is most likely an url and there's no way to know what will # This is most likely an url and there's no way to know what will
# be installed before actually installing it. # be installed before actually installing it.
@ -167,6 +163,10 @@ def _check_pkg_version_format(pkg):
ret['version_spec'] = [] ret['version_spec'] = []
else: else:
ret['result'] = True ret['result'] = True
try:
ret['prefix'] = install_req.req.project_name
ret['version_spec'] = install_req.req.specs
except Exception:
ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name) ret['prefix'] = re.sub('[^A-Za-z0-9.]+', '-', install_req.name)
if hasattr(install_req, "specifier"): if hasattr(install_req, "specifier"):
specifier = install_req.specifier specifier = install_req.specifier