def __call__(self, args): buildout_dir = self.develop.buildout_dir packages = self.get_packages(getattr(args, 'package-regexp'), checked_out=True) packages = packages - self.develop.auto_checkout packages = packages - set(self.develop.develeggs) force = args.force force_all = False workingcopies = self.get_workingcopies(self.develop.sources) if args.dry_run: logger.info("Dry run, nothing will be removed.") for name in packages: source = self.develop.sources[name] path = source['path'] if path.startswith(buildout_dir): path = path[len(buildout_dir) + 1:] need_force = False if source['kind'] != 'svn': need_force = True logger.warn( "The directory of package '%s' at '%s' might contain unrecoverable files and will not be removed without --force." % (name, path)) if workingcopies.status(source) != 'clean': need_force = True logger.warn( "The package '%s' is dirty and will not be removed without --force." % name) if need_force: if not force: continue # We only get here when a --force is needed and we # have actually added the --force argument on the # command line. if not force_all: answer = yesno("Do you want to purge it anyway?", default=False, all=True) if not answer: logger.info("Skipped purge of '%s'." % name) continue if answer == 'all': force_all = True logger.info("Removing package '%s' at '%s'." % (name, path)) if not args.dry_run: shutil.rmtree(source['path'], ignore_errors=False, onerror=self.handle_remove_readonly)
def __call__(self, args): buildout_dir = self.develop.buildout_dir packages = self.get_packages(getattr(args, 'package-regexp'), checked_out=True) packages = packages - self.develop.auto_checkout packages = packages - set(self.develop.develeggs) force = args.force force_all = False workingcopies = self.get_workingcopies(self.develop.sources) if args.dry_run: logger.info("Dry run, nothing will be removed.") for name in packages: source = self.develop.sources[name] path = source['path'] if path.startswith(buildout_dir): path = path[len(buildout_dir) + 1:] need_force = False if source['kind'] != 'svn': need_force = True logger.warn("The directory of package '%s' at '%s' might contain unrecoverable files and will not be removed without --force." % (name, path)) if workingcopies.status(source) != 'clean': need_force = True logger.warn("The package '%s' is dirty and will not be removed without --force." % name) if need_force: if not force: continue # We only get here when a --force is needed and we # have actually added the --force argument on the # command line. if not force_all: answer = yesno("Do you want to purge it anyway?", default=False, all=True) if not answer: logger.info("Skipped purge of '%s'." % name) continue if answer == 'all': force_all = True logger.info("Removing package '%s' at '%s'." % (name, path)) if not args.dry_run: shutil.rmtree(source['path'], ignore_errors=False, onerror=self.handle_remove_readonly)