diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-12-10 01:54:20 -0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2010-12-10 01:54:20 -0200 |
commit | a988eaa999422e20fe39fbdf27152cf4b94b18c2 (patch) | |
tree | cfc64ef4456e56b93a8592262e3652b1d5c97fa1 | |
parent | removed shebangs from tests (diff) | |
download | g-octave-a988eaa999422e20fe39fbdf27152cf4b94b18c2.tar.gz g-octave-a988eaa999422e20fe39fbdf27152cf4b94b18c2.tar.bz2 g-octave-a988eaa999422e20fe39fbdf27152cf4b94b18c2.zip |
added comments to the checksum module
-rw-r--r-- | g_octave/checksum.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/g_octave/checksum.py b/g_octave/checksum.py index 13be7ad..3ff8406 100644 --- a/g_octave/checksum.py +++ b/g_octave/checksum.py @@ -19,20 +19,21 @@ __all__ = [ 'sha1_check_db', ] -from hashlib import sha1 +import hashlib import json import os from .config import Config -from .compat import py3k config = Config() def sha1_compute(filename): + '''Computes the SHA1 checksum of a file''' with open(filename, 'rb') as fp: - return sha1(fp.read()).hexdigest() + return hashlib.sha1(fp.read()).hexdigest() def sha1_check(db, p): + '''Checks if the SHA1 checksum of the package is OK.''' description = db[p] manifest = {} with open(os.path.join(config.db, 'manifest.json')) as fp: @@ -42,6 +43,7 @@ def sha1_check(db, p): return manifest[p] == description.sha1sum() def sha1_check_db(db): + '''Checks if the SHA1 checksums of the package database are OK.''' for cat in db.pkg_list: for pkg in db.pkg_list[cat]: p = pkg['name']+'-'+pkg['version'] |