[SCM] morituri/master: * morituri/image/table.py: Fix deprecationwarning for python 2.6
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:09 UTC 2014
The following commit has been merged in the master branch:
commit d57cb7ad1518265a31f7e914b7b3a49965943c2e
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Wed Jun 24 19:18:41 2009 +0000
* morituri/image/table.py:
Fix deprecationwarning for python 2.6
diff --git a/ChangeLog b/ChangeLog
index a7d5770..7e60c83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-06-24 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/image/table.py:
+ Fix deprecationwarning for python 2.6
+
+2009-06-24 Thomas Vander Stichele <thomas at apestaart dot org>
+
* morituri/test/test_common_program.py (added):
* morituri/common/program.py:
Break verifyImage into two so we can test it.
diff --git a/morituri/image/table.py b/morituri/image/table.py
index 8c1b4da..217c5b3 100644
--- a/morituri/image/table.py
+++ b/morituri/image/table.py
@@ -276,18 +276,23 @@ class Table(object, log.Loggable):
values = self._getMusicBrainzValues()
# MusicBrainz disc id does not take into account data tracks
- import sha
+ # P2.3
+ try:
+ import hashlib
+ sha1 = hashlib.sha1
+ except ImportError:
+ from sha import sha as sha1
import base64
- sha1 = sha.new()
+ sha = sha1()
# number of first track
- sha1.update("%02X" % values[0])
+ sha.update("%02X" % values[0])
# number of last track
- sha1.update("%02X" % values[1])
+ sha.update("%02X" % values[1])
- sha1.update("%08X" % values[2])
+ sha.update("%08X" % values[2])
# offsets of tracks
for i in range(1, 100):
@@ -296,9 +301,9 @@ class Table(object, log.Loggable):
except IndexError:
#print 'track', i - 1, '0 offset'
offset = 0
- sha1.update("%08X" % offset)
+ sha.update("%08X" % offset)
- digest = sha1.digest()
+ digest = sha.digest()
assert len(digest) == 20, \
"digest should be 20 chars, not %d" % len(digest)
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list