From d2fe7a236f88dec6a8487d65e0609a272090d355 Mon Sep 17 00:00:00 2001 From: Nate Prewitt Date: Fri, 24 Feb 2017 21:12:56 -0700 Subject: [PATCH] deal with lack of hashes for vcs dependencies --- pipenv/cli.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/pipenv/cli.py b/pipenv/cli.py index 9e606c40..d2494425 100644 --- a/pipenv/cli.py +++ b/pipenv/cli.py @@ -220,7 +220,7 @@ def do_install_dependencies(dev=False, only=False, bare=False, requirements=Fals # pip install: with spinner(): - c = pip_install(r=deps_path, allow_global=allow_global) + c = pip_install(r=hashed_deps_path, require_hashes=True, allow_global=allow_global) if c.return_code != 0: click.echo(crayons.red('An error occured while installing!')) @@ -228,7 +228,18 @@ def do_install_dependencies(dev=False, only=False, bare=False, requirements=Fals sys.exit(c.return_code) if not bare: - click.echo(crayons.blue(format_pip_output(c.out, r=deps_path))) + click.echo(crayons.blue(format_pip_output(c.out, r=hashed_deps_path))) + + with spinner(): + c = pip_install(r=vcs_deps_path, allow_global=allow_global) + + if c.return_code != 0: + click.echo(crayons.red('An error occured while installing!')) + click.echo(crayons.blue(format_pip_error(c.err))) + sys.exit(c.return_code) + + if not bare: + click.echo(crayons.blue(format_pip_output(c.out, r=vcs_deps_path))) # Cleanup the temp requirements file. if requirements: @@ -545,13 +556,18 @@ def do_init(dev=False, requirements=False, skip_virtualenv=False, allow_global=F do_activate_virtualenv() -def pip_install(package_name=None, r=None, allow_global=False): +def pip_install(package_name=None, r=None, allow_global=False, require_hashes=False): # try installing for each source in project.sources for source in project.sources: if r: - c = delegator.run('"{0}" install -r {1} --require-hashes -i {2}'.format(which_pip(allow_global=allow_global), r, source['url'])) + install_reqs = ' -r {0}'.format(r) else: - c = delegator.run('"{0}" install "{1}" -i {2}'.format(which_pip(allow_global=allow_global), package_name, source['url'])) + install_reqs = ' "{0}"'.format(package_name) + + if require_hashes: + install_reqs += ' --require-hashes' + + c = delegator.run('"{0}" install {1} -i {2}'.format(which_pip(allow_global=allow_global), install_reqs, source['url'])) if c.return_code == 0: break