Skip to content

Commit

Permalink
Modify pypi PKG-INFO parse
Browse files Browse the repository at this point in the history
Reference: #2943
Do not return 2 PackageData objects when there are PKG-INFO files.

Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
  • Loading branch information
AyanSinhaMahapatra committed May 12, 2022
1 parent ca7fb71 commit 55f547e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 219 deletions.
8 changes: 8 additions & 0 deletions src/packagedcode/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,14 @@ class PythonSdistPkgInfoFile(BaseExtractedPythonLayout):
description = 'PyPI extracted sdist PKG-INFO'
documentation_url = 'https://peps.python.org/pep-0314/'

@classmethod
def is_datafile(cls, location):
return (
super().is_datafile(location) and
not PythonEggPkgInfoFile.is_datafile(location) and
not PythonEditableInstallationPkgInfoFile.is_datafile(location)
)

@classmethod
def parse(cls, location):
yield parse_metadata(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -725,225 +725,6 @@
"api_data_url": "https://pypi.org/pypi/pip/22.0.4/json",
"datasource_id": "pypi_editable_egg_pkginfo",
"purl": "pkg:pypi/[email protected]"
},
{
"type": "pypi",
"namespace": null,
"name": "pip",
"version": "22.0.4",
"qualifiers": {},
"subpath": null,
"primary_language": "Python",
"description": "The PyPA recommended tool for installing Python packages.\npip - The Python Package Installer\n==================================\n\n.. image:: https://img.shields.io/pypi/v/pip.svg\n :target: https://pypi.org/project/pip/\n\n.. image:: https://readthedocs.org/projects/pip/badge/?version=latest\n :target: https://pip.pypa.io/en/latest\n\npip is the `package installer`_ for Python. You can use pip to install packages from the `Python Package Index`_ and other indexes.\n\nPlease take a look at our documentation for how to install and use pip:\n\n* `Installation`_\n* `Usage`_\n\nWe release updates regularly, with a new version every 3 months. Find more details in our documentation:\n\n* `Release notes`_\n* `Release process`_\n\nIn pip 20.3, we've `made a big improvement to the heart of pip`_; `learn more`_. We want your input, so `sign up for our user experience research studies`_ to help us do it right.\n\n**Note**: pip 21.0, in January 2021, removed Python 2 support, per pip's `Python 2 support policy`_. Please migrate to Python 3.\n\nIf you find bugs, need help, or want to talk to the developers, please use our mailing lists or chat rooms:\n\n* `Issue tracking`_\n* `Discourse channel`_\n* `User IRC`_\n\nIf you want to get involved head over to GitHub to get the source code, look at our development documentation and feel free to jump on the developer mailing lists and chat rooms:\n\n* `GitHub page`_\n* `Development documentation`_\n* `Development mailing list`_\n* `Development IRC`_\n\nCode of Conduct\n---------------\n\nEveryone interacting in the pip project's codebases, issue trackers, chat\nrooms, and mailing lists is expected to follow the `PSF Code of Conduct`_.\n\n.. _package installer: https://packaging.python.org/guides/tool-recommendations/\n.. _Python Package Index: https://pypi.org\n.. _Installation: https://pip.pypa.io/en/stable/installation/\n.. _Usage: https://pip.pypa.io/en/stable/\n.. _Release notes: https://pip.pypa.io/en/stable/news.html\n.. _Release process: https://pip.pypa.io/en/latest/development/release-process/\n.. _GitHub page: https://github.com/pypa/pip\n.. _Development documentation: https://pip.pypa.io/en/latest/development\n.. _made a big improvement to the heart of pip: https://pyfound.blogspot.com/2020/11/pip-20-3-new-resolver.html\n.. _learn more: https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020\n.. _sign up for our user experience research studies: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html\n.. _Python 2 support policy: https://pip.pypa.io/en/latest/development/release-process/#python-2-support\n.. _Issue tracking: https://github.com/pypa/pip/issues\n.. _Discourse channel: https://discuss.python.org/c/packaging\n.. _Development mailing list: https://mail.python.org/mailman3/lists/distutils-sig.python.org/\n.. _User IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa\n.. _Development IRC: https://kiwiirc.com/nextclient/#ircs://irc.libera.chat:+6697/pypa-dev\n.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md",
"release_date": null,
"parties": [
{
"type": "person",
"role": "author",
"name": "The pip developers",
"email": "[email protected]",
"url": null
}
],
"keywords": [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy"
],
"homepage_url": "https://pip.pypa.io/",
"download_url": null,
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"bug_tracking_url": null,
"code_view_url": "Source, https://github.com/pypa/pip",
"vcs_url": null,
"copyright": null,
"license_expression": "mit AND mit",
"declared_license": {
"license": "MIT",
"classifiers": [
"License :: OSI Approved :: MIT License"
]
},
"notice_text": null,
"source_packages": [],
"file_references": [
{
"path": "AUTHORS.txt",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "LICENSE.txt",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "MANIFEST.in",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "NEWS.rst",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "README.rst",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "pyproject.toml",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "setup.cfg",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "setup.py",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip/__init__.py",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip/__main__.py",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip/py.typed",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip.egg-info/PKG-INFO",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip.egg-info/SOURCES.txt",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip.egg-info/dependency_links.txt",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip.egg-info/entry_points.txt",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip.egg-info/not-zip-safe",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
},
{
"path": "src/pip.egg-info/top_level.txt",
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"extra_data": {}
}
],
"extra_data": {
"Documentation": "Documentation, https://pip.pypa.io",
"Changelog": "Changelog, https://pip.pypa.io/en/stable/news/"
},
"dependencies": [],
"repository_homepage_url": "https://pypi.org/project/pip",
"repository_download_url": "https://pypi.org/packages/source/p/pip/pip-22.0.4.tar.gz",
"api_data_url": "https://pypi.org/pypi/pip/22.0.4/json",
"datasource_id": "pypi_sdist_pkginfo",
"purl": "pkg:pypi/[email protected]"
}
],
"for_packages": [
Expand Down

0 comments on commit 55f547e

Please sign in to comment.