diff options
author | Florian Weimer <fw@deneb.enyo.de> | 2009-05-24 20:22:36 +0000 |
---|---|---|
committer | Florian Weimer <fw@deneb.enyo.de> | 2009-05-24 20:22:36 +0000 |
commit | 30cc8ef4c749a15437d78dbe2600e5255eb56811 (patch) | |
tree | 1f50fa58c7a7b9cd973043ca3e717368924a80fa /lib/python/debian_support.py | |
parent | 827e221924b93f7369c512e0e37568172f5064ef (diff) |
lib/python/debian_support.py (updateFile): fix the fix
Also support both the hashlib and sha modules.
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@11971 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'lib/python/debian_support.py')
-rw-r--r-- | lib/python/debian_support.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/python/debian_support.py b/lib/python/debian_support.py index 4920272113..b546464e68 100644 --- a/lib/python/debian_support.py +++ b/lib/python/debian_support.py @@ -17,10 +17,15 @@ """This module implements facilities to deal with Debian-specific metadata.""" +import types import os import re -import hashlib -import types + +try: + import sha + sha = sha.new +except ImportError: + from hashlib import sha import apt_pkg apt_pkg.init() @@ -185,7 +190,7 @@ def internRelease(name, releases=listReleases()): del listReleases def readLinesSHA1(lines): - m = hashlib.sha() + m = sha() for l in lines: m.update(l) return m.hexdigest() @@ -391,8 +396,8 @@ def updateFile(remote, local, verbose=None): if new_hash <> remote_hash: if verbose: print "updateFile: patch failed, got %s instead of %s" \ - % (new_hash, remote_hash)) - return return downloadFile(remote, local) + % (new_hash, remote_hash) + return downloadFile(remote, local) replaceFile(lines, local) return lines |