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 | d15ac8e41dd1a8d0e94bbcd5ad3a0c13081309eb (patch) | |
tree | ac086f5682f7b044abf268e231c7b935dd7f9a64 /lib | |
parent | 6f325f1bfa926946f81e1e682153ad3725ec18dc (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')
-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 |