def _inspect(self, rel_path): if not file_util.is_pyfile(rel_path): log.debug("ignoring non-python file: %s" % (rel_path,)) return if rel_path in self._seen: debug("visited file twice: %s" % (rel_path)) return self._seen.add(rel_path) with self.state.lock: if rel_path in self.state or self.state.resurrect(rel_path): self._check_for_change(rel_path) else: self._add(rel_path)
def _inspect(self, rel_path): if not file_util.is_pyfile(rel_path): log.debug("ignoring non-python file: %s" % (rel_path, )) return if rel_path in self._seen: debug("visited file twice: %s" % (rel_path)) return self._seen.add(rel_path) with self.state.lock: if rel_path in self.state or self.state.resurrect(rel_path): self._check_for_change(rel_path) else: self._add(rel_path)
def update(self): """ updates state by visiting all python files in `base` """ self.reset() self.removed = set(self.dependencies) for root, dirs, files in os.walk(base): for dir_ in dirs: if dir_.startswith('.'): dirs.remove(dir_) for file_ in files: rel_path = file_util.relative(os.path.join(root, file_), None) if rel_path is not None and file_util.is_pyfile(rel_path): self.inspect(rel_path, known_exists = True) else: debug("skipped non-python or non-cwd file: %s" % (file_,)) for removed_file in self.removed: info("removed: %s" % removed_file.path) del self.dependencies[removed_file.path]