def _ReadLine(f):
while True:
- line = _RemoveComment(f.next())
+ line = _RemoveComment(next(f))
if line: return line
def _ReadFiles(deps_file, item, library_name):
line = None
current_type = None
while True:
- while not line: line = _RemoveComment(deps_file.next())
+ while not line: line = _RemoveComment(next(deps_file))
if line.startswith("library: "):
current_type = "library"
# nm shows a symbol class of "W" rather than "T".
_weak_destructors = set()
+def iteritems(items):
+ """Python 2/3-compatible iteritems"""
+ try:
+ for v in items.iteritems():
+ yield v
+ except AttributeError:
+ for v in items.items():
+ yield v
+
def _ReadObjFile(root_path, library_name, obj_name):
global _ignored_symbols, _obj_files, _symbols_to_files
global _virtual_classes, _weak_destructors
obj_imports = set()
obj_exports = set()
for line in nm_result.splitlines():
- fields = line.split("|")
+ fields = line.decode().split("|")
if len(fields) == 1: continue
name = fields[0].strip()
# Ignore symbols like '__cxa_pure_virtual',
global _ignored_symbols, _obj_files, _return_value
global _virtual_classes, _weak_destructors
dependencies.Load()
- for name_and_item in dependencies.items.iteritems():
+ for name_and_item in iteritems(dependencies.items):
name = name_and_item[0]
item = name_and_item[1]
system_symbols = item.get("system_symbols")