summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-12-29 21:29:07 +0100
committerMax Kellermann <max@musicpd.org>2016-12-29 21:33:36 +0100
commit3dde62befed67332f46b74fed587ad88ecc0d6f3 (patch)
tree3cf5b856046b74b919ce125b81aefcb8eb14c314 /python
parent8bfabbe265c58a99d0eb80faa102940d6e59be72 (diff)
python/build/verify: move code to file_digest()
Diffstat (limited to 'python')
-rw-r--r--python/build/verify.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/python/build/verify.py b/python/build/verify.py
index 9b7aa911d..47edb6cb0 100644
--- a/python/build/verify.py
+++ b/python/build/verify.py
@@ -16,9 +16,14 @@ def feed_file_path(h, path):
with open(path, 'rb') as f:
feed_file(h, f)
-def file_md5(path):
- """Calculate the MD5 checksum of a file and return it in hexadecimal notation."""
+def file_digest(algorithm, path):
+ """Calculate the digest of a file and return it in hexadecimal notation."""
- h = hashlib.md5()
+ h = algorithm()
feed_file_path(h, path)
return h.hexdigest()
+
+def file_md5(path):
+ """Calculate the MD5 checksum of a file and return it in hexadecimal notation."""
+
+ return file_digest(hashlib.md5, path)