From 491fa333b1cf13b352407b499d39b3a8295bbfe7 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Tue, 27 Oct 2020 18:29:51 +0800 Subject: [PATCH] fix the hash value --- pipenv/patched/piptools/repositories/pypi.py | 5 ++++- tasks/vendoring/patches/patched/piptools.patch | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pipenv/patched/piptools/repositories/pypi.py b/pipenv/patched/piptools/repositories/pypi.py index 8dbed6ea..8f742713 100644 --- a/pipenv/patched/piptools/repositories/pypi.py +++ b/pipenv/patched/piptools/repositories/pypi.py @@ -80,7 +80,10 @@ class HashCache(SafeFileCache): can_hash = new_location.hash if can_hash: # hash url WITH fragment - hash_value = self.get(new_location.url) or new_location.hash.encode('utf8') + hash_value = self.get(new_location.url) + if not hash_value: + hash_value = "{}:{}".format(new_location.hash_name, new_location.hash) + hash_value = hash_value.encode('utf8') if not hash_value: hash_value = self._get_file_hash(new_location) if not new_location.url.startswith("ssh") else None hash_value = hash_value.encode('utf8') if hash_value else None diff --git a/tasks/vendoring/patches/patched/piptools.patch b/tasks/vendoring/patches/patched/piptools.patch index edf81325..7470e133 100644 --- a/tasks/vendoring/patches/patched/piptools.patch +++ b/tasks/vendoring/patches/patched/piptools.patch @@ -282,7 +282,10 @@ index ef5ba4e..b96acf6 100644 + can_hash = new_location.hash + if can_hash: + # hash url WITH fragment -+ hash_value = self.get(new_location.url) or new_location.hash.encode('utf8') ++ hash_value = self.get(new_location.url) ++ if not hash_value: ++ hash_value = "{}:{}".format(new_location.hash_name, new_location.hash) ++ hash_value = hash_value.encode('utf8') + if not hash_value: + hash_value = self._get_file_hash(new_location) if not new_location.url.startswith("ssh") else None + hash_value = hash_value.encode('utf8') if hash_value else None