From fd5d7dd0fa84939aec0bb478d54b0a7c8f09ed08 Mon Sep 17 00:00:00 2001 From: Jeff Tratner Date: Mon, 26 Feb 2018 23:11:08 -0800 Subject: [PATCH] Always try to generate a hash for packages in Pipfile.lock Even for custom package indexes! --- HISTORY.txt | 1 + pipenv/utils.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/HISTORY.txt b/HISTORY.txt index 8003cf1c..7fab18c2 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -1,5 +1,6 @@ next: - Assume `PIPENV_VENV_IN_PROJECT` if `./.venv/` already exists. + - Use and generate hashes for PyPI mirrors and custom indexes. 10.1.0: - Default dependencies now take precidence over Develop dependencies when creating a Pipfile.lock. diff --git a/pipenv/utils.py b/pipenv/utils.py index 9e41a0c0..e7058026 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -391,17 +391,21 @@ def resolve_deps(deps, which, which_pip, project, sources=None, verbose=False, p for release in cleaned_releases[version]: collected_hashes.append(release['digests']['sha256']) - collected_hashes = ['sha256:' + s for s in collected_hashes] - # Collect un-collectable hashes. - if not collected_hashes: - collected_hashes = list(list(resolver.resolve_hashes([result]).items())[0][1]) except (ValueError, KeyError, ConnectionError): if verbose: print('Error fetching {}'.format(name)) + # Collect un-collectable hashes (should work with devpi). + if not collected_hashes: + try: + collected_hashes = list(list(resolver.resolve_hashes([result]).items())[0][1]) + except (ValueError, KeyError, ConnectionError, IndexError): + if verbose: + print('Error generating hash for {}'.format(name)) + d = {'name': name, 'version': version, 'hashes': collected_hashes} if index: