]> git.donarmstrong.com Git - lilypond.git/commitdiff
Use hashlib instead of deprecated md5 module if Python >= 2.5 is present
authorMaximilian Albert <maximilian.albert@gmail.com>
Sun, 12 Jul 2009 03:22:16 +0000 (12:22 +0900)
committerPatrick McCarty <pnorcks@gmail.com>
Fri, 17 Jul 2009 20:21:07 +0000 (13:21 -0700)
(cherry picked from commit 5ae228386f748633b7f66375852fd52d52822ab4)

scripts/lilypond-book.py

index c2e1a97c8dd350e488d928a7bc0d31f68ba7c0c8..e1d1824d75b013f51d6c0736c579ed469c7d4722 100644 (file)
@@ -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]