Purge one or more packages.
188137
def apt_autoremove(purge=True, fatal=False):
    """"""
    cmd = ['apt-get', '--assume-yes', 'autoremove']
    if purge:
        cmd.append('--purge')
    _run_apt_command(cmd, fatal)
443804
def _CleanupInstall(self):
    """"""
    if os.path.exists(self.install_path):
      shutil.rmtree(self.install_path)
      if os.path.exists(self.install_path):
        raise RuntimeError("Install path still exists: %s" % self.install_path)

    # Deliberately don't check return code, since service may not be installed.
    subprocess.call(["sc", "stop", self.service_name])
1236743
def _cleanup(self):
        """"""
        for filename in os.listdir(self._storage_dir):
            file_path = path.join(self._storage_dir, filename)
            file_stat = os.stat(file_path)
            evaluate = max(file_stat.st_ctime, file_stat.st_mtime)
            if evaluate + self._duration < time.time():
                LOGGER.debug('Removing stale file: %s', file_path)
                os.unlink(file_path)
958339
def cleanup():
    """"""
    for sck in list(Wdb._sockets):
        try:
            sck.close()
        except Exception:
            log.warn('Error in cleanup', exc_info=True)
970855
def do_purge(bare=False, downloads=False, allow_global=False):
    """"""

    if downloads:
        if not bare:
            click.echo(crayons.normal(fix_utf8("Clearing out downloads directory…"), bold=True))
        vistir.path.rmtree(project.download_location)
        return

    # Remove comments from the output, if any.
    installed = set([
        pep423_name(pkg.project_name) for pkg in project.environment.get_installed_packages()
    ])
    bad_pkgs = set([pep423_name(pkg) for pkg in BAD_PACKAGES])
    # Remove setuptools, pip, etc from targets for removal
    to_remove = installed - bad_pkgs

    # Skip purging if there is no packages which needs to be removed
    if not to_remove:
        if not bare:
            click.echo("Found 0 installed package, skip purging.")
            click.echo(crayons.green("Environment now purged and fresh!"))
        return installed

    if not bare:
        click.echo(
            fix_utf8("Found {0} installed package(s), purging…".format(len(to_remove)))
        )

    command = "{0} uninstall {1} -y".format(
        escape_grouped_arguments(which_pip(allow_global=allow_global)),
        " ".join(to_remove),
    )
    if environments.is_verbose():
        click.echo("$ {0}".format(command))
    c = delegator.run(command)
    if c.return_code != 0:
        raise exceptions.UninstallError(installed, command, c.out + c.err, c.return_code)
    if not bare:
        click.echo(crayons.blue(c.out))
        click.echo(crayons.green("Environment now purged and fresh!"))
    return installed
1281497
def uninstall(pkg):
    '''
    
    '''
    ret = {'result': None, 'output': ''}

    out = __salt__['cmd.run_all'](FLATPAK_BINARY_NAME + ' uninstall ' + pkg)

    if out['retcode'] and out['stderr']:
        ret['stderr'] = out['stderr'].strip()
        ret['result'] = False
    else:
        ret['stdout'] = out['stdout'].strip()
        ret['result'] = True

    return ret
640275
def delete_package(self, cache, pkg):
        
        if self.is_virtual_package(pkg):
            log("Package '%s' appears to be virtual - purging provides" %
                pkg.name, level=DEBUG)
            for _p in pkg.provides_list:
                self.delete_package(cache, _p[2].parent_pkg)
        elif not pkg.current_ver:
            log("Package '%s' not installed" % pkg.name, level=DEBUG)
            return
        else:
            log("Purging package '%s'" % pkg.name, level=DEBUG)
            apt_purge(pkg.name)
45309
def snap_remove(packages, *flags):
    
    if type(packages) is not list:
        packages = [packages]

    flags = list(flags)

    message = 'Removing snap(s) "%s"' % ', '.join(packages)
    if flags:
        message += ' with options "%s"' % ', '.join(flags)

    log(message, level='INFO')
    return _snap_exec(['remove'] + flags + packages)
704430
def package_remove(name):
    '''
    
    '''
    cmd = 'pkg_remove ' + name

    # Send the command to execute
    out, err = DETAILS['server'].sendline(cmd)

    # "scrape" the output and return the right fields as a dict
    return parse(out)
920355
def cleanup_repo(self):
        """"""
        if self.source and path.isdir(self.source):
            self.log.debug('Cleaning up source repo from %s', self.source)
            shutil.rmtree(self.source)
329285
public function uninstall_cleanup() {
        global $CFG;
        require_once($CFG->dirroot.'/repository/lib.php');

        $repo = \repository::get_type_by_typename($this->name);
        if ($repo) {
            $repo->delete(true);
        }

        parent::uninstall_cleanup();
    }
14010
private void cleanup() {
        final String methodName = "cleanup(): ";
        try {
            final Bundle b = bundle.getAndSet(null);
            if (b != null) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(tc, methodName + "Uninstalling bundle location: " + b.getLocation() + ", bundle id: " + b.getBundleId());
                }
                SecurityManager sm = System.getSecurityManager();
                if (sm != null) {
                    AccessController.doPrivileged(new PrivilegedAction<Void>() {
                        @Override
                        public Void run() {
                            try {
                                b.uninstall();
                                return null;
                            } catch (BundleException ignored) {
                                return null;
                            }
                        }
                    });
                } else {
                    b.uninstall();
                }
            }
        } catch (BundleException ignored) {
        } catch (IllegalStateException ignored) {

        }
    }
349308
def purge(self):
        
        logging.warning("Purging all services from space %s" %
                (self.name))

        service = predix.admin.cf.services.Service()
        for service_name in self.get_instances():
            service.purge(service_name)

        apps = predix.admin.cf.apps.App()
        for app_name in self.get_apps():
            apps.delete_app(app_name)
1172935
function cleanup() {
  const artifacts = ['.requirements'];
  if (this.options.zip) {
    if (this.serverless.service.package.individually) {
      this.targetFuncs.forEach(f => {
        artifacts.push(path.join(f.module, '.requirements.zip'));
        artifacts.push(path.join(f.module, 'unzip_requirements.py'));
      });
    } else {
      artifacts.push('.requirements.zip');
      artifacts.push('unzip_requirements.py');
    }
  }

  return BbPromise.all(
    artifacts.map(artifact =>
      fse.removeAsync(path.join(this.servicePath, artifact))
    )
  );
}
876337
def cleanup_tmpdir(dirname):
    """"""
    if dirname is not None and os.path.exists(dirname):
        shutil.rmtree(dirname)
312191
def exclude_package(self, package):
        """"""

        pfx = package + '.'
        if self.packages:
            self.packages = [
                p for p in self.packages
                if p != package and not p.startswith(pfx)
            ]

        if self.py_modules:
            self.py_modules = [
                p for p in self.py_modules
                if p != package and not p.startswith(pfx)
            ]

        if self.ext_modules:
            self.ext_modules = [
                p for p in self.ext_modules
                if p.name != package and not p.name.startswith(pfx)
            ]
1090803
def cleanup(self):
        """"""
        shutil.rmtree(self.name, onerror=lambda *a: os.chmod(a[1], __import__('stat').S_IWRITE) or os.unlink(a[1]))
        if os.path.exists(self.name):
            raise IOError(17, "File exists: '{}'".format(self.name))