pull a package from the registry
775057
function get (url, cb) {
  var urls = [], end
  _get(url, cb)
  function _get (url) {
    urls.push(url)
    if(end) return
    if(urls.length > 5)
      cb(end = new Error('too many redirects\n'+JSON.stringify(urls)))

    console.error('GET', url)
    ;(/^https/.test(url) ? https : http).get(url, function next (res) {

      if(res.statusCode >= 300 && res.statusCode < 400)
        _get(res.headers.location)
      else {
        end = true,
        cb(null, res)
      }
    })
    .on('error', function (err) {
      if(!end)
        cb(end = err)
    })
  }
}
8731
def register_packages(ctx, repo=None, dry_run=False):
    """"""
    original_ctx = ctx
    if repo is None:
        repo = ctx.project.repo or "pypi"
    if dry_run:
        ctx = DryRunContext(ctx)

    packages = ensure_packages_exist(original_ctx)
    print_packages(packages)
    for artifact in packages:
        ctx.run("twine register --repository={repo} {artifact}".format(
                artifact=artifact, repo=repo))
812564
def activate():
    """"""

    global PathFinder, FileFinder, ff_path_hook

    path_hook_index = len(sys.path_hooks)
    sys.path_hooks.append(ff_path_hook)
    # Resetting sys.path_importer_cache values,
    # to support the case where we have an implicit package inside an already loaded package,
    # since we need to replace the default importer.
    sys.path_importer_cache.clear()

    # Setting up the meta_path to change package finding logic
    pathfinder_index = len(sys.meta_path)
    sys.meta_path.append(PathFinder)

    return path_hook_index, pathfinder_index
120279
function (source) {
            packageUrl = source;

            if (source && source.indexOf(bower.config.rhodecode.repo) != -1) {
                return true;
            }

            return Q.nfcall(registryClient.lookup.bind(registryClient), source)
                .then(function (entry) {

                    if (entry && entry.url && entry.url.indexOf(bower.config.rhodecode.repo) != -1) {
                        packageUrl = entry.url;
                        return true
                    }

                    return false;
                });

        }
178972
def cli(parser):
    '''
    
    '''
    parser.add_argument('-n', '--dry-run', action='store_true', help='Print uninstall actions without running')
    parser.add_argument('packages', nargs='+', help='Packages to install')
    opts = parser.parse_args()

    for package in opts.packages:
        install(package, execute=not opts.dry_run)
129146
def _get_package(auth, owner, package_name):
    
    package = (
        Package.query
        .filter_by(owner=owner, name=package_name)
        .join(Package.access)
        .filter(_access_filter(auth))
        .one_or_none()
    )
    if package is None:
        raise PackageNotFoundException(owner, package_name, auth.is_logged_in)
    return package
456467
def collect(package='perch.migrations'):
    
    package = importlib.import_module(package)

    for loader, name, is_pkg in pkgutil.walk_packages(package.__path__):
        importlib.import_module(package.__name__ + '.' + name)

    return _migrations
1000529
def install_remote(self):
        """"""
        package, pkg_folder = None, None
        try:
            package = self._download()
            pkg_folder = self._extract(package)
            napp_folder = self._get_local_folder(pkg_folder)
            dst = self._installed / self.user / self.napp
            self._check_module(dst.parent)
            shutil.move(str(napp_folder), str(dst))
        finally:
            # Delete temporary files
            if package:
                Path(package).unlink()
            if pkg_folder and pkg_folder.exists():
                shutil.rmtree(str(pkg_folder))
637922
def pull_dependencies(collector, image, **kwargs):
    """"""
    for dep in image.commands.dependent_images:
        kwargs["image"] = dep
        pull_arbitrary(collector, **kwargs)
823646
def delete(package):
    
    team, owner, pkg = parse_package(package)

    answer = input(
        "Are you sure you want to delete this package and its entire history? "
        "Type '%s' to confirm: " % package
    )

    if answer != package:
        print("Not deleting.")
        return 1

    session = _get_session(team)

    session.delete("%s/api/package/%s/%s/" % (get_registry_url(team), owner, pkg))
    print("Deleted.")
1020324
def package_remove(name):
    '''
    
    '''
    DETAILS = _load_state()
    DETAILS['packages'].pop(name)
    _save_state(DETAILS)
    return DETAILS['packages']
1335250
def get():
    """"""
    pkgnames = find_packages()

    if len(pkgnames) == 0:
        raise ValueError("Can't find any packages")

    pkgname = pkgnames[0]

    content = open(join(pkgname, '__init__.py')).read()
    c = re.compile(r"__version__ *= *('[^']+'|\"[^\"]+\")")
    m = c.search(content)

    if m is None:
        raise ValueError("Can't find __version__ = ... in __init__.py")

    return m.groups()[0][1: -1]
586123
def _rmv_pkg(self, package):
        
        removes = []
        if GetFromInstalled(package).name() and package not in self.skip:
            ver = GetFromInstalled(package).version()
            removes.append(package + ver)
            self._removepkg(package)
        return removes
584483
def _splitting_packages(self, pkg, repo, name):
        
        if name and repo != "sbo":
            pkg = split_package(pkg)[0]
        elif not name and repo != "sbo":
            pkg = pkg[:-4]
        return pkg
1057097
def to_package(self, repo_url):
        """"""
        return Package(name=self.name, url=repo_url + self.name)
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
1150966
def pull(self):
        
        if not os.path.exists(self.repo_dir):
            yield from self.initialize_repo()
        else:
            yield from self.update()