def _parse(self): glob_paths = {} inputs = {} for filename in self._config.sections(): if not self._config.get(filename, 'type'): raise Exception('%s: missing mandatory config "type"' % filename) config = dict((x[0], x[1]) for x in self._config.items(filename)) glob_paths[filename] = config globs = eglob(filename) if not globs: self._logger.info('Skipping glob due to no files found: %s' % filename) continue for globbed in globs: inputs[os.path.realpath(globbed)] = config return inputs, glob_paths
def update_files(self): ls = [] files = [] if len(self.args.globs) > 0: for name in self.args.globs: globbed = [os.path.realpath(filename) for filename in eglob(name)] files.extend(globbed) self.configfile.addglob(name, globbed) else: for name in self.listdir(): files.append(os.path.realpath(os.path.join(self.folder, name))) for absname in files: try: st = os.stat(absname) except EnvironmentError, err: if err.errno != errno.ENOENT: raise else: if not stat.S_ISREG(st.st_mode): continue fid = self.get_file_id(st) ls.append((fid, absname))