def _get_layout_xmls(layout_dir, anchor): for root, dirs, files in os.walk(layout_dir): if '.svn' in dirs: dirs.remove('.svn') for f in files: if f.endswith('.xml'): full_path = os.path.join(root, f) relative_path = os.path.relpath(full_path, anchor) yield pathutils.normalize_path(relative_path)
def __init__(self, **kwarg): u''' dir include exclude ''' self._logger = logging.getLogger(__name__) self._dir = pathutils.normalize_path(kwarg['dir']) includes = kwarg.get('include', self._default_includes) self._include_pattern = _PathPattern(includes) excludes = self._default_excludes + kwarg.get('exclude', []) self._exclude_pattern = _PathPattern(excludes) self._logger.debug('dir = [%s], include = [%s], exclude = [%s]', self._dir, self._include_pattern._pattern.pattern, self._exclude_pattern._pattern.pattern)
def _filter(self, path): path = pathutils.normalize_path(path) return self._match(path) and path or None