From 3dde62befed67332f46b74fed587ad88ecc0d6f3 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Thu, 29 Dec 2016 21:29:07 +0100
Subject: [PATCH] python/build/verify: move code to file_digest()

---
 python/build/verify.py | 11 ++++++++---
 1 file 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_digest(algorithm, path):
+    """Calculate the digest of a file and return it in hexadecimal notation."""
+
+    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."""
 
-    h = hashlib.md5()
-    feed_file_path(h, path)
-    return h.hexdigest()
+    return file_digest(hashlib.md5, path)