Warn on bad syntax in supposed requirements.txt (e.g. a webpage or json document)

This commit is contained in:
Nate Prewitt
2017-10-22 16:17:15 -07:00
parent a8a33847c0
commit e7fb56ffa3
+8
View File
@@ -1772,6 +1772,14 @@ 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:
click.echo(
crayons.red(
u'Unexpected syntax in {0}. Are you sure this is a '
'requirements.txt style file?'.format(project.path_to(requirements))
)
)
sys.exit(1)
finally:
# If requirements file was provided by remote url delete the temporary file
if remote: