Fix UI build for python 3
Make write_ui_dist_file_map.py python3-friendly
Also remove the multiprocess: it's not measurably
faster and I suspect causes hanging in ninja if
something goes wrong.
Bug: https://github.com/google/perfetto/issues/26
Test: manual
Change-Id: I56568aae3469b749e11fbb5f88dd12aff1dcd40d
diff --git a/gn/standalone/write_ui_dist_file_map.py b/gn/standalone/write_ui_dist_file_map.py
index 8ea5aff..999bea5 100644
--- a/gn/standalone/write_ui_dist_file_map.py
+++ b/gn/standalone/write_ui_dist_file_map.py
@@ -30,7 +30,6 @@
import argparse
import base64
import hashlib
-import multiprocessing
import os
import sys
@@ -60,15 +59,14 @@
parser.add_argument('file_list', nargs=argparse.REMAINDER)
args = parser.parse_args()
- # Compute the hash of each file (in parallel).
- pool = multiprocessing.Pool(multiprocessing.cpu_count() * 2)
- digests = dict(pool.map(hash_file, args.file_list))
+ # Compute the hash of each file.
+ digests = dict(map(hash_file, args.file_list))
contents = '// __generated_by %s\n' % __file__
contents += 'export const UI_DIST_MAP = {\n'
contents += ' files: {\n'
strip = args.strip + ('' if args.strip[-1] == os.path.sep else os.path.sep)
- for fname, digest in digests.iteritems():
+ for fname, digest in digests.items():
if not fname.startswith(strip):
raise Exception('%s must start with %s (--strip arg)' % (fname, strip))
fname = fname[len(strip):]