launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25731
[Merge] ~cjwatson/launchpad:py3-archivepublisher-bytes into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-archivepublisher-bytes into launchpad:master.
Commit message:
Fix some bytes handling errors in lp.archivepublisher
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394416
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-archivepublisher-bytes into launchpad:master.
diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py
index 5908ccc..1edd38d 100644
--- a/lib/lp/archivepublisher/publishing.py
+++ b/lib/lp/archivepublisher/publishing.py
@@ -1574,8 +1574,9 @@ class DirectoryHash:
hashobj.update(chunk)
for (checksum_file, hashobj) in hashes:
- checksum_file.write("%s *%s\n" %
- (hashobj.hexdigest(), path[len(self.root) + 1:]))
+ checksum_line = "%s *%s\n" % (
+ hashobj.hexdigest(), path[len(self.root) + 1:])
+ checksum_file.write(checksum_line.encode("UTF-8"))
def add_dir(self, path):
"""Recursively add a directory path to be checksummed."""
diff --git a/lib/lp/archivepublisher/signing.py b/lib/lp/archivepublisher/signing.py
index 0425242..ffa1464 100644
--- a/lib/lp/archivepublisher/signing.py
+++ b/lib/lp/archivepublisher/signing.py
@@ -583,7 +583,7 @@ class SigningUpload(CustomUpload):
old_mask = os.umask(0o077)
try:
with tempfile.NamedTemporaryFile(suffix='.keygen') as tf:
- print(genkey_text, file=tf)
+ tf.write(genkey_text.encode('UTF-8'))
# Close out the underlying file so we know it is complete.
tf.file.close()
diff --git a/lib/lp/archivepublisher/tests/test_signing.py b/lib/lp/archivepublisher/tests/test_signing.py
index b4abc0e..183365e 100644
--- a/lib/lp/archivepublisher/tests/test_signing.py
+++ b/lib/lp/archivepublisher/tests/test_signing.py
@@ -1929,7 +1929,8 @@ class TestSigningUploadWithSigningService(TestSigningHelpers):
SigningKeyType.FIT: SigningMode.ATTACHED,
}
expected_signed_contents = [
- b"signed with key_type=%s mode=%s" % (k.name, modes[k].name)
+ ("signed with key_type=%s mode=%s" % (
+ k.name, modes[k].name)).encode("UTF-8")
for k in key_types]
self.assertItemsEqual(expected_signed_contents, contents)