2009/7/11 Neil Puttock <n.putt...@gmail.com>: > How about using a `try' block to import conditionally?
Thanks for the suggestion. Here is an updated patch, in case peope want to have this (otherwise please ignore). Cheers, Max
From 5066717052db35b69af549e1189a88090e12fb78 Mon Sep 17 00:00:00 2001 From: Maximilian Albert <maximilian.alb...@gmail.com> Date: Sun, 12 Jul 2009 12:22:16 +0900 Subject: [PATCH] Use hashlib instead of deprecated md5 module if Python >= 2.5 is present --- scripts/lilypond-book.py | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py index e851a40..ebea918 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 @@ -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] -- 1.6.0.4
_______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel