]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/lilypond-book.py
Use hashlib instead of deprecated md5 module if Python >= 2.5 is present
[lilypond.git] / scripts / lilypond-book.py
index e851a40662c134302f7e5bb9508e1a103fd6e83f..ebea918cb46640396ff4f1a0938d36ce0706ba73 100644 (file)
@@ -29,7 +29,6 @@ TODO:
 '''
 
 import glob
-import md5
 import os
 import re
 import stat
@@ -1235,7 +1234,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]