From d6dfdd46da51a08b65afd3bf17cfcde08df935fd Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sun, 13 Sep 2015 12:26:03 -0500 Subject: [PATCH] Future proof a little bit --- twine/package.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/twine/package.py b/twine/package.py index a3fbae2c..230e5acf 100644 --- a/twine/package.py +++ b/twine/package.py @@ -52,13 +52,16 @@ def __init__(self, filename, comment, metadata, python_version, filetype): self.gpg_signature = None md5_hash = hashlib.md5() + sha2_hash = hashlib.sha256() with open(filename, "rb") as fp: content = fp.read(4096) while content: md5_hash.update(content) + sha2_hash.update(content) content = fp.read(4096) self.md5_digest = md5_hash.hexdigest() + self.sha2_digest = sha2_hash.hexdigest() @classmethod def from_filename(cls, filename, comment): @@ -114,6 +117,11 @@ def metadata_dictionary(self): "comment": self.comment, "md5_digest": self.md5_digest, + # When https://github.com/pypa/warehouse/issues/681 is closed and + # warehouse is deployed, uncomment the line below to start sending + # a more up-to-date digest. + # "sha256_digest": self.sha256_digest, + # PEP 314 "provides": meta.provides, "requires": meta.requires,