From bf1b36a23237987786395546a0289f58dbb1e53e Mon Sep 17 00:00:00 2001 From: Maximilian Albert Date: Sun, 12 Jul 2009 12:22:16 +0900 Subject: [PATCH] Use hashlib instead of deprecated md5 module if Python >= 2.5 is present (cherry picked from commit 5ae228386f748633b7f66375852fd52d52822ab4) --- scripts/lilypond-book.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index c2e1a97c8d..e1d1824d75 100644 --- a/scripts/lilypond-book.py +++ b/scripts/lilypond-book.py @@ -29,7 +29,6 @@ TODO: ''' import glob -import md5 import os import re import stat @@ -1234,7 +1233,13 @@ class LilypondSnippet (Snippet): def get_checksum (self): if not self.checksum: - hash = md5.md5 (self.relevant_contents (self.full_ly ())) + # Work-around for md5 module deprecation warning in python 2.5+: + try: + from hashlib import md5 + except ImportError: + from md5 import md5 + + hash = md5 (self.relevant_contents (self.full_ly ())) ## let's not create too long names. self.checksum = hash.hexdigest ()[:10] -- 2.39.2