Skip to content

Commit

Permalink
Merge pull request #3086 from pypa/debt/remove-pkg-resources
Browse files Browse the repository at this point in the history
Remove reliance on ensure_directory and parse_requirements from pkg_resources
  • Loading branch information
jaraco committed Feb 5, 2022
2 parents f1bb03e + 0e68232 commit d64fb2f
Show file tree
Hide file tree
Showing 109 changed files with 5,974 additions and 21 deletions.
1 change: 1 addition & 0 deletions changelog.d/3085.change.rst
@@ -0,0 +1 @@
Setuptools now vendors importlib_resources and importlib_metadata and jaraco.text. Setuptools no longer relies on pkg_resources for ensure_directory nor parse_requirements.
13 changes: 13 additions & 0 deletions setuptools/_importlib.py
@@ -0,0 +1,13 @@
import sys


if sys.version_info < (3, 10):
from setuptools.extern import importlib_metadata as metadata
else:
import importlib.metadata as metadata # noqa: F401


if sys.version_info < (3, 9):
from setuptools.extern import importlib_resources as resources
else:
import importlib.resources as resources # noqa: F401
7 changes: 7 additions & 0 deletions setuptools/_path.py
@@ -0,0 +1,7 @@
import os


def ensure_directory(path):
"""Ensure that the parent directory of `path` exists"""
dirname = os.path.dirname(path)
os.makedirs(dirname, exist_ok=True)
19 changes: 19 additions & 0 deletions setuptools/_reqs.py
@@ -0,0 +1,19 @@
import setuptools.extern.jaraco.text as text

from pkg_resources import Requirement


def parse_strings(strs):
"""
Yield requirement strings for each specification in `strs`.
`strs` must be a string, or a (possibly-nested) iterable thereof.
"""
return text.join_continuation(map(text.drop_comment, text.yield_lines(strs)))


def parse(strs):
"""
Deprecated drop-in replacement for pkg_resources.parse_requirements.
"""
return map(Requirement, parse_strings(strs))
@@ -0,0 +1 @@
pip
13 changes: 13 additions & 0 deletions setuptools/_vendor/importlib_metadata-4.10.1.dist-info/LICENSE
@@ -0,0 +1,13 @@
Copyright 2017-2019 Jason R. Coombs, Barry Warsaw

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
118 changes: 118 additions & 0 deletions setuptools/_vendor/importlib_metadata-4.10.1.dist-info/METADATA
@@ -0,0 +1,118 @@
Metadata-Version: 2.1
Name: importlib-metadata
Version: 4.10.1
Summary: Read metadata from Python packages
Home-page: https://github.com/python/importlib_metadata
Author: Jason R. Coombs
Author-email: jaraco@jaraco.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.7
License-File: LICENSE
Requires-Dist: zipp (>=0.5)
Requires-Dist: typing-extensions (>=3.6.4) ; python_version < "3.8"
Provides-Extra: docs
Requires-Dist: sphinx ; extra == 'docs'
Requires-Dist: jaraco.packaging (>=8.2) ; extra == 'docs'
Requires-Dist: rst.linker (>=1.9) ; extra == 'docs'
Provides-Extra: perf
Requires-Dist: ipython ; extra == 'perf'
Provides-Extra: testing
Requires-Dist: pytest (>=6) ; extra == 'testing'
Requires-Dist: pytest-checkdocs (>=2.4) ; extra == 'testing'
Requires-Dist: pytest-flake8 ; extra == 'testing'
Requires-Dist: pytest-cov ; extra == 'testing'
Requires-Dist: pytest-enabler (>=1.0.1) ; extra == 'testing'
Requires-Dist: packaging ; extra == 'testing'
Requires-Dist: pyfakefs ; extra == 'testing'
Requires-Dist: flufl.flake8 ; extra == 'testing'
Requires-Dist: pytest-perf (>=0.9.2) ; extra == 'testing'
Requires-Dist: pytest-black (>=0.3.7) ; (platform_python_implementation != "PyPy") and extra == 'testing'
Requires-Dist: pytest-mypy ; (platform_python_implementation != "PyPy") and extra == 'testing'
Requires-Dist: importlib-resources (>=1.3) ; (python_version < "3.9") and extra == 'testing'

.. image:: https://img.shields.io/pypi/v/importlib_metadata.svg
:target: `PyPI link`_

.. image:: https://img.shields.io/pypi/pyversions/importlib_metadata.svg
:target: `PyPI link`_

.. _PyPI link: https://pypi.org/project/importlib_metadata

.. image:: https://github.com/python/importlib_metadata/workflows/tests/badge.svg
:target: https://github.com/python/importlib_metadata/actions?query=workflow%3A%22tests%22
:alt: tests

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: Black

.. image:: https://readthedocs.org/projects/importlib-metadata/badge/?version=latest
:target: https://importlib-metadata.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/badge/skeleton-2021-informational
:target: https://blog.jaraco.com/skeleton


Library to access the metadata for a Python package.

This package supplies third-party access to the functionality of
`importlib.metadata <https://docs.python.org/3/library/importlib.metadata.html>`_
including improvements added to subsequent Python versions.


Compatibility
=============

New features are introduced in this third-party library and later merged
into CPython. The following table indicates which versions of this library
were contributed to different versions in the standard library:

.. list-table::
:header-rows: 1

* - importlib_metadata
- stdlib
* - 4.8
- 3.11
* - 4.4
- 3.10
* - 1.4
- 3.8


Usage
=====

See the `online documentation <https://importlib_metadata.readthedocs.io/>`_
for usage details.

`Finder authors
<https://docs.python.org/3/reference/import.html#finders-and-loaders>`_ can
also add support for custom package installers. See the above documentation
for details.


Caveats
=======

This project primarily supports third-party packages installed by PyPA
tools (or other conforming packages). It does not support:

- Packages in the stdlib.
- Packages installed without metadata.

Project details
===============

* Project home: https://github.com/python/importlib_metadata
* Report bugs at: https://github.com/python/importlib_metadata/issues
* Code hosting: https://github.com/python/importlib_metadata
* Documentation: https://importlib_metadata.readthedocs.io/


24 changes: 24 additions & 0 deletions setuptools/_vendor/importlib_metadata-4.10.1.dist-info/RECORD
@@ -0,0 +1,24 @@
importlib_metadata-4.10.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
importlib_metadata-4.10.1.dist-info/LICENSE,sha256=wNe6dAchmJ1VvVB8D9oTc-gHHadCuaSBAev36sYEM6U,571
importlib_metadata-4.10.1.dist-info/METADATA,sha256=-HDYj3iK6bcjwN5MAoO58Op6WQIYQfbhl6ZaPqL0IZI,3989
importlib_metadata-4.10.1.dist-info/RECORD,,
importlib_metadata-4.10.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
importlib_metadata-4.10.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
importlib_metadata-4.10.1.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
importlib_metadata/__init__.py,sha256=7WxDdbPPu4Wy3VeMTApd-JlPQoENgVDyDH6aqyE7acE,30175
importlib_metadata/__pycache__/__init__.cpython-310.pyc,,
importlib_metadata/__pycache__/_adapters.cpython-310.pyc,,
importlib_metadata/__pycache__/_collections.cpython-310.pyc,,
importlib_metadata/__pycache__/_compat.cpython-310.pyc,,
importlib_metadata/__pycache__/_functools.cpython-310.pyc,,
importlib_metadata/__pycache__/_itertools.cpython-310.pyc,,
importlib_metadata/__pycache__/_meta.cpython-310.pyc,,
importlib_metadata/__pycache__/_text.cpython-310.pyc,,
importlib_metadata/_adapters.py,sha256=B6fCi5-8mLVDFUZj3krI5nAo-mKp1dH_qIavyIyFrJs,1862
importlib_metadata/_collections.py,sha256=CJ0OTCHIjWA0ZIVS4voORAsn2R4R2cQBEtPsZEJpASY,743
importlib_metadata/_compat.py,sha256=EU2XCFBPFByuI0Of6XkAuBYbzqSyjwwwwqmsK4ccna0,1826
importlib_metadata/_functools.py,sha256=PsY2-4rrKX4RVeRC1oGp1lB1pmC9eKN88_f-bD9uOoA,2895
importlib_metadata/_itertools.py,sha256=cvr_2v8BRbxcIl5x5ldfqdHjhI8Yi8s8yk50G_nm6jQ,2068
importlib_metadata/_meta.py,sha256=_F48Hu_jFxkfKWz5wcYS8vO23qEygbVdF9r-6qh-hjE,1154
importlib_metadata/_text.py,sha256=HCsFksZpJLeTP3NEk_ngrAeXVRRtTrtyh9eOABoRP4A,2166
importlib_metadata/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
Empty file.
5 changes: 5 additions & 0 deletions setuptools/_vendor/importlib_metadata-4.10.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.37.1)
Root-Is-Purelib: true
Tag: py3-none-any

@@ -0,0 +1 @@
importlib_metadata

0 comments on commit d64fb2f

Please sign in to comment.