def _compute_classes_by_source(self, analysis_file=None): """Compute src->classes.""" if analysis_file is None: analysis_file = self._analysis_file if not os.path.exists(analysis_file): return {} buildroot = get_buildroot() products = Analysis.parse_products_from_path(analysis_file) classes_by_src = {} for src, classes in products.items(): relsrc = os.path.relpath(src, buildroot) classes_by_src[relsrc] = [os.path.relpath(cls, self._classes_dir) for cls in classes] return classes_by_src
def _get_deleted_sources(self): """Returns the list of sources present in the last analysis that have since been deleted. This is a global list. We have no way of associating them to individual targets. """ # We compute the list lazily. if self._deleted_sources is None: with self.context.new_workunit('find-deleted-sources'): if os.path.exists(self._analysis_file): products = Analysis.parse_products_from_path(self._analysis_file) buildroot = get_buildroot() old_sources = [os.path.relpath(src, buildroot) for src in products.keys()] self._deleted_sources = filter(lambda x: not os.path.exists(x), old_sources) else: self._deleted_sources = [] return self._deleted_sources