def walk_python_files():
u'''
Generator that yields all CKAN Python source files.
Yields 2-tuples containing the filename in absolute and relative (to
the project root) form.
'''
def _is_dir_ignored(root, d):
if d.startswith(u'.'):
return True
return os.path.join(rel_root, d) in IGNORED_DIRS
for abs_root, dirnames, filenames in os.walk(PROJECT_ROOT):
rel_root = os.path.relpath(abs_root, PROJECT_ROOT)
if rel_root == u'.':
rel_root = u''
dirnames[:] = [d for d in dirnames if not _is_dir_ignored(rel_root, d)]
for filename in filenames:
if not filename.endswith(u'.py'):
continue
abs_name = os.path.join(abs_root, filename)
rel_name = os.path.join(rel_root, filename)
yield abs_name, rel_name
评论列表
文章目录