comparison contrib/check-py3-compat.py @ 27331:35e69407b1ac

contrib: ignore empty files in check-py3-compat.py
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 12 Dec 2015 13:27:31 -0500
parents 40eb385f798f
children ae522fb493d4
comparison
equal deleted inserted replaced
27330:6fbf1159a85a 27331:35e69407b1ac
14 14
15 def check_compat(f): 15 def check_compat(f):
16 """Check Python 3 compatibility for a file.""" 16 """Check Python 3 compatibility for a file."""
17 with open(f, 'rb') as fh: 17 with open(f, 'rb') as fh:
18 content = fh.read() 18 content = fh.read()
19
20 # Ignore empty files.
21 if not content.strip():
22 return
19 23
20 root = ast.parse(content) 24 root = ast.parse(content)
21 futures = set() 25 futures = set()
22 haveprint = False 26 haveprint = False
23 for node in ast.walk(root): 27 for node in ast.walk(root):