improve messaging for failed requirements.txt install

This commit is contained in:
Nate Prewitt
2017-10-22 20:21:11 -07:00
parent addfd52ac4
commit d89696e36d
+5 -2
View File
@@ -1771,13 +1771,16 @@ def install(
click.echo(crayons.normal(u'Requirements file provided! Importing into Pipfile…', bold=True), err=True)
try:
import_requirements(r=project.path_to(requirements), dev=dev)
except UnicodeDecodeError:
except (UnicodeDecodeError, pip.exceptions.PipError) as e:
# Don't print the temp file path if remote since it will be deleted.
req_path = requirements_url if remote else project.path_to(requirements)
click.echo(
crayons.red(
u'Unexpected syntax in {0}. Are you sure this is a '
'requirements.txt style file?'.format(project.path_to(requirements))
'requirements.txt style file?'.format(req_path)
)
)
click.echo(crayons.blue(str(e)), err=True)
sys.exit(1)
finally:
# If requirements file was provided by remote url delete the temporary file