aboutsummaryrefslogtreecommitdiffstats
path: root/src/scripts/dist.py
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2017-12-21 12:30:30 -0500
committerJack Lloyd <[email protected]>2017-12-21 12:30:30 -0500
commitdebde1bc9cce3d564afa0bbf1474dc23cd1a8540 (patch)
treed6c3fd61a470b049839b3dae497417cdabbece39 /src/scripts/dist.py
parent50795d21c069d8dd090f85e93b290d83d820cde7 (diff)
Binary file IO for the UTF-8 gods
When reading a binary file, unless 'b' is specified Python3 tries parsing the file as UTF-8 and gets cranky when it fails.
Diffstat (limited to 'src/scripts/dist.py')
-rwxr-xr-xsrc/scripts/dist.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/scripts/dist.py b/src/scripts/dist.py
index 2e7fa521d..e589f6641 100755
--- a/src/scripts/dist.py
+++ b/src/scripts/dist.py
@@ -239,11 +239,11 @@ def write_archive(output_basename, archive_type, rel_epoch, all_files, hash_file
tarinfo.uname = "botan"
tarinfo.gname = "botan"
tarinfo.mtime = rel_epoch
- archive.addfile(tarinfo, open(f))
+ archive.addfile(tarinfo, open(f, 'rb'))
archive.close()
sha256 = hashlib.new('sha256')
- sha256.update(open(output_archive).read())
+ sha256.update(open(output_archive, 'rb').read())
archive_hash = sha256.hexdigest().upper()
logging.info('SHA-256(%s) = %s' % (output_archive, archive_hash))