Alternative to pack_info and place_info in case of bug.
502952
def _get_info(self, layout):
        """"""
        info = str(self.tk.call(layout, 'info', self._w)).split("-")
        dic = {}
        for i in info:
            if i:
                key, val = i.strip().split()
                dic[key] = val
        return dic
322463
def _yum_pkginfo(output):
    '''
    
    '''
    cur = {}
    keys = itertools.cycle(('name', 'version', 'repoid'))
    values = salt.utils.itertools.split(_strip_headers(output))
    osarch = __grains__['osarch']
    for (key, value) in zip(keys, values):
        if key == 'name':
            try:
                cur['name'], cur['arch'] = value.rsplit('.', 1)
            except ValueError:
                cur['name'] = value
                cur['arch'] = osarch
            cur['name'] = salt.utils.pkg.rpm.resolve_name(cur['name'],
                                                          cur['arch'],
                                                          osarch)
        else:
            if key == 'version':
                # Suppport packages with no 'Release' parameter
                value = value.rstrip('-')
            elif key == 'repoid':
                # Installed packages show a '@' at the beginning
                value = value.lstrip('@')
            cur[key] = value
            if key == 'repoid':
                # We're done with this package, create the pkginfo namedtuple
                pkginfo = salt.utils.pkg.rpm.pkginfo(**cur)
                # Clear the dict for the next package
                cur = {}
                # Yield the namedtuple
                if pkginfo is not None:
                    yield pkginfo
824555
def packb(obj, **kwargs):
    """"""
    kwargs.setdefault('use_bin_type', True)
    return msgpack.packb(obj, **kwargs)
936714
def check_homepage(package_info, *args):
    
    reason = "Home page missing"
    result = False

    if package_info.get('home_page') not in BAD_VALUES:
        result = True

    return result, reason, HAS_HOMEPAGE
217502
def description(filename):
    """"""
    # This ends up in the Summary header for PKG-INFO and it should be a
    # one-liner.  It will get rendered on the package page just below the
    # package version header but above the long_description, which ironically
    # gets stuff into the Description header.  It should not include reST, so
    # pick out the first single line after the double header.
    with open(filename) as fp:
        for lineno, line in enumerate(fp):
            if lineno < 3:
                continue
            line = line.strip()
            if len(line) > 0:
                return line
1131034
def pack(args):
    "  "
    assert op.exists(args.source), "Does not exists: %s" % args.source
    zeta_pack(args)
1290586
def patched_packing_env(env):
  """"""
  old_env = pkg_resources.packaging.markers.default_environment
  new_env = lambda: env
  pkg_resources._vendor.packaging.markers.default_environment = new_env
  try:
    yield
  finally:
    pkg_resources._vendor.packaging.markers.default_environment = old_env
868820
def print_package_versions(self):
        """"""
        variants = self.context.get_tool_variants(self.tool_name)
        if variants:
            if len(variants) > 1:
                self._print_conflicting(variants)
                return 1
            else:
                from rez.packages_ import iter_packages
                variant = iter(variants).next()
                it = iter_packages(name=variant.name)
                rows = []
                colors = []

                for pkg in sorted(it, key=lambda x: x.version, reverse=True):
                    if pkg.version == variant.version:
                        name = "* %s" % pkg.qualified_name
                        col = heading
                    else:
                        name = "  %s" % pkg.qualified_name
                        col = local if pkg.is_local else None

                    label = "(local)" if pkg.is_local else ""
                    rows.append((name, pkg.path, label))
                    colors.append(col)

                _pr = Printer()
                for col, line in zip(colors, columnise(rows)):
                    _pr(line, col)
        return 0
116416
def _mod_info(modname, toskip=[], onlylocals=True):
    

    hascls = hasfunc = False

    for localnm, fqnm, obj in zip(*find_mod_objs(modname, onlylocals=onlylocals)):
        if localnm not in toskip:
            hascls = hascls or inspect.isclass(obj)
            hasfunc = hasfunc or inspect.isroutine(obj)
            if hascls and hasfunc:
                break

    # find_mod_objs has already imported modname
    # TODO: There is probably a cleaner way to do this, though this is pretty
    # reliable for all Python versions for most cases that we care about.
    pkg = sys.modules[modname]
    ispkg = (hasattr(pkg, '__file__') and isinstance(pkg.__file__, str) and
             os.path.split(pkg.__file__)[1].startswith('__init__.py'))

    return ispkg, hascls, hasfunc
1274432
def package_version(filename, varname):
    """"""
    _locals = {}
    with open(filename) as fp:
        exec(fp.read(), None, _locals)
    return _locals[varname]
276779
def _find_pkg_info(self):
        
        dist = pkg_resources.require(self.package_name)[0]
        self._pkg_resources_locations = [dist.location]
        ver, url = self._dist_version_url(dist)
        return {'version': ver, 'url': url}
1204698
def check_description(package_info, *args):
    
    reason = "Description missing"
    result = False

    if package_info.get('description') not in BAD_VALUES:
        result = True

    return result, reason, HAS_DESCRIPTION
815443
def info():
    """"""
    rc = texinfo()
    print('Running Texinfo files through makeinfo...')
    builddir = os.path.join(BUILDDIR, 'texinfo')
    subprocess.call(['make', '-C', builddir, 'info'])
    print('makeinfo finished; the Info files are in {}.'.format(builddir))
1228042
def info(package, conn=None):
    '''
    
    '''
    close = False
    if conn is None:
        close = True
        conn = init()

    fields = (
        'package',
        'version',
        'release',
        'installed',
        'os',
        'os_family',
        'dependencies',
        'os_dependencies',
        'os_family_dependencies',
        'summary',
        'description',
    )
    data = conn.execute(
        'SELECT {0} FROM packages WHERE package=?'.format(','.join(fields)),
        (package, )
    )
    row = data.fetchone()
    if close:
        conn.close()
    if not row:
        return None

    formula_def = dict(list(zip(fields, row)))
    formula_def['name'] = formula_def['package']

    return formula_def
716829
def do_pack(self):
        """"""
        verbosity = self._args.verbose - self._args.quiet
        cache = cmsis_pack_manager.Cache(verbosity < 0, False)
        
        if self._args.clean:
            LOG.info("Removing all pack data...")
            cache.cache_clean()
        
        if self._args.update:
            LOG.info("Updating pack index...")
            cache.cache_descriptors()
        
        if self._args.show:
            packs = pack_target.ManagedPacks.get_installed_packs()
            pt = self._get_pretty_table(["Vendor", "Pack", "Version"])
            for ref in packs:
                pt.add_row([
                            ref.vendor,
                            ref.pack,
                            ref.version,
                            ])
            print(pt)

        if self._args.find_devices or self._args.install_devices:
            if not cache.index:
                LOG.info("No pack index present, downloading now...")
                cache.cache_descriptors()
            
            patterns = self._args.find_devices or self._args.install_devices
            
            # Find matching part numbers.
            matches = set()
            for pattern in patterns:
                # Using fnmatch.fnmatch() was failing to match correctly.
                pat = re.compile(fnmatch.translate(pattern + "*"), re.IGNORECASE)
                results = {name for name in cache.index.keys() if pat.match(name)}
                matches.update(results)
            
            if not matches:
                LOG.warning("No matching devices. Please make sure the pack index is up to date.")
                return
            
            if self._args.find_devices:
                pt = self._get_pretty_table(["Part", "Vendor", "Pack", "Version"])
                for name in sorted(matches):
                    info = cache.index[name]
                    ref, = cache.packs_for_devices([info])
                    pt.add_row([
                                info['name'],
                                ref.vendor,
                                ref.pack,
                                ref.version,
                                ])
                print(pt)
            elif self._args.install_devices:
                devices = [cache.index[dev] for dev in matches]
                packs = cache.packs_for_devices(devices)
                if not self._args.no_download:
                    print("Downloading packs (press Control-C to cancel):")
                else:
                    print("Would download packs:")
                for pack in packs:
                    print("    " + str(pack))
                if not self._args.no_download:
                    cache.download_pack_list(packs)
19039
public void addPackageDeprecationInfo(Content li, PackageDoc pkg) {
        Tag[] deprs;
        if (Util.isDeprecated(pkg)) {
            deprs = pkg.tags("deprecated");
            HtmlTree deprDiv = new HtmlTree(HtmlTag.DIV);
            deprDiv.addStyle(HtmlStyle.deprecatedContent);
            Content deprPhrase = HtmlTree.SPAN(HtmlStyle.deprecatedLabel, deprecatedPhrase);
            deprDiv.addContent(deprPhrase);
            if (deprs.length > 0) {
                Tag[] commentTags = deprs[0].inlineTags();
                if (commentTags.length > 0) {
                    addInlineDeprecatedComment(pkg, deprs[0], deprDiv);
                }
            }
            li.addContent(deprDiv);
        }
    }
797816
def parse_info(raw_info, apply_tag=None):
    
    parse_releases(raw_info)
    parse_packages(raw_info, apply_tag=apply_tag)
    return raw_info