Switch DEPS actions on bots to Python 3.
In doing so, I think this fixes a bug on Windows where extract.py was
digesting the archive in text mode. (Doesn't particularly matter, though
by using the correct digest, we will end up re-extracting the files
once.)
Change-Id: Ia7effe5f9c228c1a702cba8e6380975b59261808
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/50166
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/util/bot/extract.py b/util/bot/extract.py
index 4680cfe..9b1b88a 100644
--- a/util/bot/extract.py
+++ b/util/bot/extract.py
@@ -96,7 +96,7 @@
# Skip archives that weren't downloaded.
return 0
- with open(archive) as f:
+ with open(archive, 'rb') as f:
sha256 = hashlib.sha256()
while True:
chunk = f.read(1024 * 1024)
@@ -109,7 +109,7 @@
if os.path.exists(stamp_path):
with open(stamp_path) as f:
if f.read().strip() == digest:
- print "Already up-to-date."
+ print("Already up-to-date.")
return 0
if archive.endswith('.zip'):
@@ -123,10 +123,10 @@
try:
if os.path.exists(output):
- print "Removing %s" % (output, )
+ print("Removing %s" % (output, ))
shutil.rmtree(output)
- print "Extracting %s to %s" % (archive, output)
+ print("Extracting %s to %s" % (archive, output))
prefix = None
num_extracted = 0
for entry in entries:
@@ -166,14 +166,14 @@
# Print every 100 files, so bots do not time out on large archives.
num_extracted += 1
if num_extracted % 100 == 0:
- print "Extracted %d files..." % (num_extracted,)
+ print("Extracted %d files..." % (num_extracted,))
finally:
entries.close()
with open(stamp_path, 'w') as f:
f.write(digest)
- print "Done. Extracted %d files." % (num_extracted,)
+ print("Done. Extracted %d files." % (num_extracted,))
return 0