mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
deal with lack of hashes for vcs dependencies
This commit is contained in:
+21
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user