def remove(self, pattern, src=None, build_ids=None, package_ids_filter=None, force=False): """ Remove local/remote conans, package folders, etc. @param pattern: it could be OpenCV* or OpenCV @param package_ids_filter: Lists with ids or empty for all. (Its a filter) @param force: if True, it will be deleted without requesting anything """ has_remote = self._remote_proxy._remote_name if has_remote: if build_ids is not None or src: raise ConanException( "Remotes don't have 'build' or 'src' folder, just packages" ) search_info = self._remote_proxy.search(pattern) else: search_info = self._file_manager.search(pattern) if not search_info: self._user_io.out.warn( "No package recipe reference matches with %s pattern" % pattern) return for conan_ref in search_info: if self._ask_permission(conan_ref, src, build_ids, package_ids_filter, force): if has_remote: if package_ids_filter is None: self._remote_proxy.remove(conan_ref) else: self._remote_proxy.remove_packages( conan_ref, package_ids_filter) else: remover = DiskRemover(self._file_manager.paths) if src: remover.remove_src(conan_ref) if build_ids is not None: remover.remove_builds(conan_ref, build_ids) if package_ids_filter is not None: remover.remove_packages(conan_ref, package_ids_filter) if not src and build_ids is None and package_ids_filter is None: remover.remove(conan_ref) registry = self._remote_proxy.registry registry.remove_ref(conan_ref) if not has_remote: delete_empty_dirs(self._file_manager.paths.store)
def remove_packages(self, reference, package_ids_filter): assert isinstance(reference, ConanFileReference) assert isinstance(package_ids_filter, list) if not package_ids_filter: # Remove all packages packages_folder = self.paths.packages(reference) self._file_adapter.delete_folder(packages_folder) else: for package_id in package_ids_filter: package_ref = PackageReference(reference, package_id) package_folder = self.paths.package(package_ref) self._file_adapter.delete_folder(package_folder) delete_empty_dirs(self.paths.store) return
def remove(self, pattern, src=None, build_ids=None, package_ids_filter=None, force=False): """ Remove local/remote conans, package folders, etc. @param pattern: it could be OpenCV* or OpenCV @param package_ids_filter: Lists with ids or empty for all. (Its a filter) @param force: if True, it will be deleted without requesting anything """ has_remote = self._remote_proxy._remote_name if has_remote: if build_ids is not None or src: raise ConanException("Remotes don't have 'build' or 'src' folder, just packages") search_info = self._remote_proxy.search(pattern) else: search_info = self._file_manager.search(pattern) if not search_info: self._user_io.out.warn("No package recipe reference matches with %s pattern" % pattern) return for conan_ref in search_info: if self._ask_permission(conan_ref, src, build_ids, package_ids_filter, force): if has_remote: if package_ids_filter is None: self._remote_proxy.remove(conan_ref) else: self._remote_proxy.remove_packages(conan_ref, package_ids_filter) else: remover = DiskRemover(self._file_manager.paths) if src: remover.remove_src(conan_ref) if build_ids is not None: remover.remove_builds(conan_ref, build_ids) if package_ids_filter is not None: remover.remove_packages(conan_ref, package_ids_filter) if not src and build_ids is None and package_ids_filter is None: remover.remove(conan_ref) registry = self._remote_proxy.registry registry.remove_ref(conan_ref, quiet=True) if not has_remote: delete_empty_dirs(self._file_manager.paths.store)
def remove_conanfile(self, reference): assert isinstance(reference, ConanFileReference) result = self._file_adapter.delete_folder(self.paths.conan(reference)) delete_empty_dirs(self.paths.store) return result