Fix scripts/extract.py for Python3

Bug: None
Change-Id: I460d054be6f54b7724e5cadbd41e485125a97472
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/79060
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Corentin Wallez 2022-02-03 10:32:14 +00:00 committed by Dawn LUCI CQ
parent 7c5000abea
commit e0db2b9baf
1 changed files with 5 additions and 5 deletions

View File

@ -110,7 +110,7 @@ def main(args):
if os.path.exists(stamp_path): if os.path.exists(stamp_path):
with open(stamp_path) as f: with open(stamp_path) as f:
if f.read().strip() == digest: if f.read().strip() == digest:
print "Already up-to-date." print("Already up-to-date.")
return 0 return 0
if archive.endswith('.zip'): if archive.endswith('.zip'):
@ -124,10 +124,10 @@ def main(args):
try: try:
if os.path.exists(output): if os.path.exists(output):
print "Removing %s" % (output, ) print("Removing %s" % (output, ))
shutil.rmtree(output) shutil.rmtree(output)
print "Extracting %s to %s" % (archive, output) print("Extracting %s to %s" % (archive, output))
prefix = None prefix = None
num_extracted = 0 num_extracted = 0
for entry in entries: for entry in entries:
@ -167,14 +167,14 @@ def main(args):
# Print every 100 files, so bots do not time out on large archives. # Print every 100 files, so bots do not time out on large archives.
num_extracted += 1 num_extracted += 1
if num_extracted % 100 == 0: if num_extracted % 100 == 0:
print "Extracted %d files..." % (num_extracted, ) print("Extracted %d files..." % (num_extracted, ))
finally: finally:
entries.close() entries.close()
with open(stamp_path, 'w') as f: with open(stamp_path, 'w') as f:
f.write(digest) f.write(digest)
print "Done. Extracted %d files." % (num_extracted, ) print("Done. Extracted %d files." % (num_extracted, ))
return 0 return 0