Merge lp:~maxb/launchpad/use-hashlib into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Graham Binns on 2010-02-11 |
| Approved revision: | not available |
| Merged at revision: | not available |
| Proposed branch: | lp:~maxb/launchpad/use-hashlib |
| Merge into: | lp:launchpad |
| Diff against target: |
902 lines (+110/-178) 27 files modified
lib/canonical/base.py (+3/-3) lib/canonical/buildd/slave.py (+3/-3) lib/canonical/launchpad/database/emailaddress.py (+3/-2) lib/canonical/launchpad/database/temporaryblobstorage.py (+4/-3) lib/canonical/launchpad/helpers.py (+4/-3) lib/canonical/launchpad/mailman/monkeypatches/lphandler.py (+3/-2) lib/canonical/launchpad/scripts/logger.py (+4/-2) lib/canonical/launchpad/webapp/authentication.py (+3/-3) lib/canonical/launchpad/webapp/login.py (+5/-4) lib/canonical/launchpad/webapp/tests/test_encryptor.py (+10/-5) lib/canonical/librarian/client.py (+7/-6) lib/canonical/librarian/ftests/test_storage.py (+5/-4) lib/canonical/librarian/storage.py (+3/-4) lib/canonical/librarian/tests/test_storage.py (+0/-1) lib/canonical/librarian/utils.py (+3/-3) lib/lp/archivepublisher/library.py (+4/-2) lib/lp/archivepublisher/publishing.py (+8/-34) lib/lp/archivepublisher/tests/test_librarianwrapper.py (+2/-2) lib/lp/archivepublisher/tests/test_pool.py (+4/-4) lib/lp/archivepublisher/tests/test_publisher.py (+2/-66) lib/lp/archiveuploader/nascentuploadfile.py (+3/-4) lib/lp/services/mail/sendmail.py (+7/-4) lib/lp/soyuz/doc/soyuz-upload.txt.disabled (+2/-2) lib/lp/soyuz/scripts/ftpmaster.py (+2/-2) lib/lp/soyuz/scripts/gina/library.py (+5/-2) lib/lp/soyuz/scripts/queue.py (+3/-3) lib/lp/soyuz/scripts/tests/test_queue.py (+8/-5) |
| To merge this branch: | bzr merge lp:~maxb/launchpad/use-hashlib |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Graham Binns (community) | code | 2010-02-09 | Approve on 2010-02-11 |
|
Review via email:
|
|||
Commit Message
Switch from using sha and md5 to hashlib. Also use hashlib.sha256 instead of the python-apt implementation.
| Max Bowsher (maxb) wrote : | # |
| Graham Binns (gmb) wrote : | # |
Hi Max,
Great branch, and I'm happy for it to land.
| Max Bowsher (maxb) wrote : | # |
This somehow ended up with this in ec2test, despite working fine in plain old make check locally:
Error in test testAptSHA256 (lp.archivepubl
Traceback (most recent call last):
File "/usr/lib/
testMethod()
File "/var/launchpad
text, file = _getSHA256(
File "/var/launchpad
file = hashlib.
TypeError: sha256() argument 1 must be string or read-only buffer, not file
Back to "Work in progress" whilst I try to figure out why.
| Max Bowsher (maxb) wrote : | # |
" This test only runs on Ubuntu/hardy systems. "
Well, meh.
| Max Bowsher (maxb) wrote : | # |
It turns out the entire test is no longer relevant, because it tests for the presence of a bug in apt_pkg.sha256sum, which the first revision in this branch removes all uses of. Hence, the fix is to simply delete the test.
Incremental diff: just the deletion of the entire method lp.archivepubli
This is ready for re-review and landing now.

Python 2.5 introduced the hashlib module as the new home of hash functions.
Python 2.6 deprecated the old md5 and sha modules.
To help in clearing the way for a future migration to Python 2.6, here is a branch substituting the use of hashlib for md5 and sha. It also replaces the usage of python-apt's sha256 function (formerly necessary since Python 2.4 offered no sha256 implementation) with hashlib.sha256, allowing a removal of compatibility code.
These changes were originally authored by Barry during the Python 2.5/2.6 sprint, and left on a branch including Python-2.6-only changes at the end of the sprint. I've disentangled them for landing on mainline.