comparison contrib/import-checker.py @ 26221:ae65b1b4cb46

import-checker: use modern .endswith for multiple suffixes Suggested by Anton Shestakov <engored@ya.ru> on the list. Thanks!
author Augie Fackler <augie@google.com>
date Thu, 10 Sep 2015 09:52:17 -0400
parents bb6936bec727
children 1aee2ab0f902
comparison
equal deleted inserted replaced
26220:a43328baa2ac 26221:ae65b1b4cb46
198 or top == libpath and d in ('hgext', 'mercurial')): 198 or top == libpath and d in ('hgext', 'mercurial')):
199 del dirs[i] 199 del dirs[i]
200 for name in files: 200 for name in files:
201 if name == '__init__.py': 201 if name == '__init__.py':
202 continue 202 continue
203 if not (name.endswith('.py') 203 if not name.endswith(('.py', '.so', '.pyc', '.pyo', '.pyd')):
204 or name.endswith('.so')
205 or name.endswith('.pyc')
206 or name.endswith('.pyo')
207 or name.endswith('.pyd')):
208 continue 204 continue
209 full_path = os.path.join(top, name) 205 full_path = os.path.join(top, name)
210 rel_path = full_path[len(libpath) + 1:] 206 rel_path = full_path[len(libpath) + 1:]
211 mod = dotted_name_of_path(rel_path) 207 mod = dotted_name_of_path(rel_path)
212 yield mod 208 yield mod