gets the item's package information file
437452
def packageInfo(self):
        """"""
        url = "%s/item.pkinfo" % self.root
        params = {'f' : 'json'}
        result = self._get(url=url,
                           param_dict=params,
                           securityHandler=self._securityHandler,
                           proxy_url=self._proxy_url,
                           proxy_port=self._proxy_port,
                           out_folder=tempfile.gettempdir())
        return result
467441
def get_version(package):
    
    init_py = readfile(os.path.join(package, '__init__.py'))
    return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
1044886
def _get_version():
    """"""

    with open(join(dirname(__file__), '{{project.package}}/VERSION'), 'rb') as f:
        version = f.read().decode('ascii').strip()
    return version
724337
def get_pkg_info(
    package_name, additional=("pip", "flit", "pbr", "setuptools", "wheel")
):
    """"""
    dist_index = build_dist_index(pkg_resources.working_set)
    root = dist_index[package_name]
    tree = construct_tree(dist_index)
    dependencies = {pkg.name: pkg.installed_version for pkg in tree[root]}
    # Add the initial package itself.
    root = root.as_requirement()
    dependencies[root.name] = root.installed_version
    # Retrieve information on additional packages such as build tools.
    for name in additional:
        try:
            pkg = dist_index[name].as_requirement()
            dependencies[pkg.name] = pkg.installed_version
        except KeyError:
            continue
    return dependencies
1354465
def info(package, long_description, classifiers, license):
    
    client = requests.Session()
    for name_or_url in package:
        package = get_package(name_or_url, client)
        if not package:
            secho(u'Invalid name or URL: "{name}"'.format(name=name_or_url),
                  fg='red', file=sys.stderr)
            continue

        # Name and summary
        try:
            info = package.data['info']
        except NotFoundError:
            secho(u'No versions found for "{0}". '
                  u'Skipping. . .'.format(package.name),
                  fg='red', file=sys.stderr)
            continue
        echo_header(name_or_url)
        if package.summary:
            echo(package.summary)

        # Version info
        echo()
        echo('Latest release:   {version:12}'.format(version=info['version']))

        # Long description
        if long_description:
            echo()
            echo(package.description)

        # Download info
        echo()
        echo_download_summary(package)

        # Author info
        echo()
        author, author_email = package.author, package.author_email
        if author:
            echo(u'Author:   {author:12}'.format(**locals()))
        if author_email:
            echo(u'Author email: {author_email:12}'.format(**locals()))

        # Maintainer info
        maintainer, maintainer_email = (package.maintainer,
                                        package.maintainer_email)
        if maintainer or maintainer_email:
            echo()
        if maintainer:
            echo(u'Maintainer:   {maintainer:12}'.format(**locals()))
        if maintainer_email:
            echo(u'Maintainer email: {maintainer_email:12}'.format(**locals()))

        # URLS
        echo()
        echo(u'PyPI URL:  {pypi_url:12}'.format(pypi_url=package.package_url))
        if package.home_page:
            echo(u'Home Page: {home_page:12}'.format(
                home_page=package.home_page))
        if package.docs_url:
            echo(u'Documentation: {docs_url:12}'.format(
                docs_url=package.docs_url))

        # Classifiers
        if classifiers:
            echo()
            echo(u'Classifiers: ')
            for each in info.get('classifiers', []):
                echo('\t' + each)

        if license and package.license:
            echo()
            echo(u'License: ', nl=False)
            # license may be just a name, e.g. 'BSD' or the full license text
            # If a new line is found in the text, print a new line
            if package.license.find('\n') >= 0 or len(package.license) > 80:
                echo()
            echo(package.license)
        echo()
1340894
def getPackages(self, distribution = "rawhide"):
		
		if self._packages == {}:
			file_location = "%s/data/distribution_packages.json" % getScriptDir(__file__)
			with open(file_location, "r") as f:
				packages = json.load(f)
			for pkg in packages:
				for distro in pkg["distributions"]:
					try:
						self._packages[distro].append(pkg["package"])
					except KeyError:
						self._packages[distro] = [pkg["package"]]

		return self._packages[distribution]
1096891
def pkg_info():
    """"""
    try:
        doc = __doc__.decode("UTF-8")
    except (AttributeError, UnicodeError):
        doc = __doc__ # Python3, or some strangeness

    return dict(
        # project data & layout
        name = __name__.split('.')[0],
        ## TODO: version = re.search(r"(?<=\()[^)]+(?=\))", changelog).group(),
        package_dir = {"": "src"},
        ## TODO: packages = find_packages(projectdir / "src", exclude=["tests"]),
        test_suite = "nose.collector",
        zip_safe = True,
        include_package_data = True,
        data_files = [
            ("EGG-INFO", [
                "README.md", "LICENSE", "debian/changelog",
            ]),
        ],
        entry_points = {
            "console_scripts": [
                "infrascope = infrascope.cli:run",
            ],
            "infrascope.cli": [
                "repo versions = infrascope.repositories:Versions",
            ],
        },

        # dependency management
        install_requires = [
        ],
        setup_requires = [
            "docutils",
            "Sphinx",
        ],
        extras_require = {
        },

        # PyPI
        url = "https://github.com/1and1/infrascope",
        license = "Apache License Version 2.0",
        keywords = "python tool automation continuous.integration continuous.delivery devops reporting visualops",
        author = u"Jürgen Hermann",
        author_email = "jh@web.de",
        description = doc.split('.')[0].strip(),
        long_description = doc.split('.', 1)[1].strip(),
        classifiers = [
            # values at http://pypi.python.org/pypi?:action=list_classifiers
            "Development Status :: 3 - Alpha",
            #"Development Status :: 4 - Beta",
            #"Development Status :: 5 - Production/Stable",
            "Operating System :: OS Independent",
            "Environment :: Console",
            "Intended Audience :: Developers",
            "Intended Audience :: Information Technology",
            "Intended Audience :: System Administrators",
            "License :: OSI Approved :: Apache Software License",
            "Natural Language :: English",
            "Operating System :: OS Independent",
            "Programming Language :: Python :: 2.7",
            "Topic :: Documentation",
            "Topic :: System :: Software Distribution",
            "Topic :: Utilities",
        ],
    )
972626
public Content getPackageLink(PackageDoc pkg, String label) {
        return getPackageLink(pkg, new StringContent(label));
    }
970876
function findPackage(filename) {
    if (!ctr)
        return;
    filename = filename || require.main.filename;
    var parsed = path_1.parse(filename);
    var curPath = path_1.join(parsed.dir, 'package.json');
    if (!fs_1.existsSync(curPath)) {
        ctr--;
        return findPackage(parsed.dir);
    }
    else {
        return chek_1.tryRequire(curPath, {});
    }
}
879021
function pkginfo() {
	var root, file;
	root = resolve();
	file = path.join( root, 'package.json' );
	return readJSON.sync( file );
}
294850
function getPackageInfoFrom(string) {
  if (string[0] === '@') {
    const [scope, rawName] = string.split('/');
    const { name, version } = getVersionFromString(rawName);
    return {
      name: `${scope}/${name}`,
      version,
    };
  }

  return getVersionFromString(string);
}
771721
def get_package_data(filename, mode='rb'):
    ''''''
    if os.path.exists(filename):
        with open(filename, mode=mode) as in_file:
            return in_file.read()
    else:
        parts = os.path.normpath(filename).split(os.sep)

        for part, index in zip(parts, range(len(parts))):
            if part.endswith('.zip'):
                zip_path = os.sep.join(parts[:index + 1])
                member_path = os.sep.join(parts[index + 1:])
                break

        if platform.system() == 'Windows':
            member_path = member_path.replace('\\', '/')

        with zipfile.ZipFile(zip_path) as zip_file:
            return zip_file.read(member_path)
1224461
def _get_pkg_info(*packages, **kwargs):
    '''
    
    '''
    kwargs = salt.utils.args.clean_kwargs(**kwargs)
    failhard = kwargs.pop('failhard', True)
    if kwargs:
        salt.utils.args.invalid_kwargs(kwargs)

    if __grains__['os'] == 'Ubuntu' and __grains__['osrelease_info'] < (12, 4):
        bin_var = '${binary}'
    else:
        bin_var = '${Package}'

    ret = []
    cmd = "dpkg-query -W -f='package:" + bin_var + "\\n" \
          "revision:${binary:Revision}\\n" \
          "arch:${Architecture}\\n" \
          "maintainer:${Maintainer}\\n" \
          "summary:${Summary}\\n" \
          "source:${source:Package}\\n" \
          "version:${Version}\\n" \
          "section:${Section}\\n" \
          "installed_size:${Installed-size}\\n" \
          "size:${Size}\\n" \
          "MD5:${MD5sum}\\n" \
          "SHA1:${SHA1}\\n" \
          "SHA256:${SHA256}\\n" \
          "origin:${Origin}\\n" \
          "homepage:${Homepage}\\n" \
          "status:${db:Status-Abbrev}\\n" \
          "======\\n" \
          "description:${Description}\\n" \
          "------\\n'"
    cmd += ' {0}'.format(' '.join(packages))
    cmd = cmd.strip()

    call = __salt__['cmd.run_all'](cmd, python_chell=False)
    if call['retcode']:
        if failhard:
            raise CommandExecutionError("Error getting packages information: {0}".format(call['stderr']))
        else:
            return ret

    for pkg_info in [elm for elm in re.split(r"------", call['stdout']) if elm.strip()]:
        pkg_data = {}
        pkg_info, pkg_descr = re.split(r"======", pkg_info)
        for pkg_info_line in [el.strip() for el in pkg_info.split(os.linesep) if el.strip()]:
            key, value = pkg_info_line.split(":", 1)
            if value:
                pkg_data[key] = value
        install_date, install_date_t = _get_pkg_install_time(pkg_data.get('package'), pkg_data.get('arch'))
        if install_date:
            pkg_data['install_date'] = install_date
            pkg_data['install_date_time_t'] = install_date_t  # Unix ticks
        build_date, build_date_t = _get_pkg_build_time(pkg_data.get('package'))
        if build_date:
            pkg_data['build_date'] = build_date
            pkg_data['build_date_time_t'] = build_date_t
        pkg_data['description'] = pkg_descr.split(":", 1)[-1]
        ret.append(pkg_data)

    return ret
110026
private Item findPackageItem(String pkgName) {
        if (packageToItemMap == null) {
            return null;
        }
        return packageToItemMap.get(pkgName);
    }
361426
def package_contents(self):
        ''

        if self.contents_cache:
            return self.contents_cache

        # Get a list of ZipInfo objects.
        files = self.zf.infolist()
        out_files = {}

        # Iterate through each file in the XPI.
        for file_ in files:

            file_doc = {'name': file_.filename,
                        'size': file_.file_size,
                        'name_lower': file_.filename.lower()}

            file_doc['extension'] = file_doc['name_lower'].split('.')[-1]

            out_files[file_.filename] = file_doc

        self.contents_cache = out_files
        return out_files
144924
def package_data(pkg, root_list):
    """"""
    data = []
    for root in root_list:
        for dirname, _, files in os.walk(os.path.join(pkg, root)):
            for fname in files:
                data.append(os.path.relpath(os.path.join(dirname, fname), pkg))

    return {pkg: data}
1290359
def _GetPkgResources(package_name, filepath):
  """"""
  requirement = pkg_resources.Requirement.parse(package_name)
  try:
    return pkg_resources.resource_filename(requirement, filepath)
  except pkg_resources.DistributionNotFound:
    # It may be that the working set is not in sync (e.g. if sys.path was
    # manipulated). Try to reload it just in case.
    pkg_resources.working_set = pkg_resources.WorkingSet()
    try:
      return pkg_resources.resource_filename(requirement, filepath)
    except pkg_resources.DistributionNotFound:
      logging.error("Distribution %s not found. Is it installed?", package_name)
      return None