add hash algorithm agility to RECORD

This commit is contained in:
Daniel Holth 2012-09-15 08:10:49 -04:00
parent 6a93f82c5d
commit dfb0975b38
1 changed files with 13 additions and 7 deletions

View File

@ -218,11 +218,17 @@ Each record is composed of three elements:
- an absolute path, using the local platform separator
- the **MD5** hash of the file, encoded in hex. Notice that `pyc` and `pyo`
generated files don't have any hash because they are automatically produced
from `py` files. So checking the hash of the corresponding `py` file is
enough to decide if the file and its associated `pyc` or `pyo` files have
changed.
- a hash of the file's contents.
Notice that `pyc` and `pyo` generated files don't have any hash because
they are automatically produced from `py` files. So checking the hash
of the corresponding `py` file is enough to decide if the file and
its associated `pyc` or `pyo` files have changed.
The hash is either the empty string, the **MD5** hash of
the file, encoded in hex, or the hash algorithm as named in
``hashlib.algorithms_guaranteed``, followed by the equals character
``=``, followed by the urlsafe-base64-nopad encoding of the digest
(``base64.urlsafe_b64encode(digest)`` with trailing ``=`` removed).
- the file's size in bytes
@ -391,9 +397,9 @@ contained in `METADATA` when it is instantiated.
And following methods:
- ``get_installed_files(local=False)`` -> iterator of (path, md5, size)
- ``get_installed_files(local=False)`` -> iterator of (path, hash, size)
Iterates over the `RECORD` entries and return a tuple ``(path, md5, size)``
Iterates over the `RECORD` entries and return a tuple ``(path, hash, size)``
for each line. If ``local`` is ``True``, the path is transformed into a
local absolute path. Otherwise the raw value from `RECORD` is returned.