From: JinWang An Date: Mon, 27 Mar 2023 08:03:01 +0000 (+0900) Subject: Imported Upstream version 67.5.0 X-Git-Tag: upstream/67.5.0^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8cbab79e1d0c4941258929e3f393b5deb0ba064d;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 67.5.0 --- diff --git a/.bumpversion.cfg b/.bumpversion.cfg index f92513a..9b4a054 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 67.4.0 +current_version = 67.5.0 commit = True tag = True diff --git a/.coveragerc b/.coveragerc index aaecd68..0402a8c 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,7 +2,8 @@ omit = # leading `*/` for pytest-dev/pytest-cov#456 */.tox/* - */pep517-build-env-* +disable_warnings = + couldnt-parse # local */_validate_pyproject/* # generated code, tested in `validate-pyproject` diff --git a/CHANGES.rst b/CHANGES.rst index 6466071..44d0e35 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v67.5.0 +------- + + +Changes +^^^^^^^ +* #3843: Although pkg_resources has been discouraged for use, some projects still consider pkg_resources viable for usage. This change makes it clear that pkg_resources should not be used, emitting a DeprecationWarning when imported. + + v67.4.0 ------- diff --git a/docs/conf.py b/docs/conf.py index 831fcc8..716b899 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -100,16 +100,19 @@ intersphinx_mapping = { # Preserve authored syntax for defaults autodoc_preserve_defaults = True -intersphinx_mapping.update({ - 'pip': ('https://pip.pypa.io/en/latest', None), - 'build': ('https://pypa-build.readthedocs.io/en/latest', None), - 'PyPUG': ('https://packaging.python.org/en/latest/', None), - 'packaging': ('https://packaging.pypa.io/en/latest/', None), - 'twine': ('https://twine.readthedocs.io/en/stable/', None), - 'importlib-resources': ( - 'https://importlib-resources.readthedocs.io/en/latest', None - ), -}) +intersphinx_mapping.update( + { + 'pip': ('https://pip.pypa.io/en/latest', None), + 'build': ('https://pypa-build.readthedocs.io/en/latest', None), + 'PyPUG': ('https://packaging.python.org/en/latest/', None), + 'packaging': ('https://packaging.pypa.io/en/latest/', None), + 'twine': ('https://twine.readthedocs.io/en/stable/', None), + 'importlib-resources': ( + 'https://importlib-resources.readthedocs.io/en/latest', + None, + ), + } +) # Support tooltips on references extensions += ['hoverxref.extension'] @@ -223,7 +226,7 @@ towncrier_draft_include_empty = False extensions += ['jaraco.tidelift'] # Add icons (aka "favicons") to documentation -extensions += ['sphinx-favicon'] +extensions += ['sphinx_favicon'] html_static_path = ['images'] # should contain the folder with icons # Add support for nice Not Found 404 pages @@ -236,13 +239,13 @@ favicons = [ "rel": "icon", "type": "image/svg+xml", "static-file": "logo-symbol-only.svg", - "sizes": "any" + "sizes": "any", }, { # Version with thicker strokes for better visibility at smaller sizes "rel": "icon", "type": "image/svg+xml", "static-file": "favicon.svg", - "sizes": "16x16 24x24 32x32 48x48" + "sizes": "16x16 24x24 32x32 48x48", }, # rel="apple-touch-icon" does not support SVG yet ] diff --git a/docs/pkg_resources.rst b/docs/pkg_resources.rst index 40e5e6f..fcb91b7 100644 --- a/docs/pkg_resources.rst +++ b/docs/pkg_resources.rst @@ -11,12 +11,13 @@ subpackages, and APIs for managing Python's current "working set" of active packages. .. attention:: - Use of ``pkg_resources`` is discouraged in favor of + Use of ``pkg_resources`` is deprecated in favor of `importlib.resources `_, `importlib.metadata `_, and their backports (:pypi:`importlib_resources`, :pypi:`importlib_metadata`). - Please consider using those libraries instead of pkg_resources. + Users should refrain from new usage of ``pkg_resources`` and + should work to port to importlib-based solutions. -------- diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 1eb3f9e..e08d17f 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -12,6 +12,12 @@ The package resource API is designed to work with normal filesystem packages, .egg files, and unpacked .egg files. It can also work in a limited way with .zip files and with custom PEP 302 loaders that support the ``get_data()`` method. + +This module is deprecated. Users are directed to +`importlib.resources `_ +and +`importlib.metadata `_ +instead. """ import sys @@ -112,6 +118,9 @@ _namespace_handlers = None _namespace_packages = None +warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning) + + class PEP440Warning(RuntimeWarning): """ Used when there is an issue with a version or specifier not complying with @@ -914,9 +923,7 @@ class WorkingSet: list(map(shadow_set.add, self)) for project_name in plugin_projects: - for dist in plugin_env[project_name]: - req = [dist.as_requirement()] try: @@ -1822,7 +1829,6 @@ class ZipProvider(EggProvider): # FIXME: 'ZipProvider._extract_resource' is too complex (12) def _extract_resource(self, manager, zip_path): # noqa: C901 - if zip_path in self._index(): for name in self._index()[zip_path]: last = self._extract_resource(manager, os.path.join(zip_path, name)) @@ -1836,7 +1842,6 @@ class ZipProvider(EggProvider): '"os.rename" and "os.unlink" are not supported ' 'on this platform' ) try: - real_path = manager.get_cache_path(self.egg_name, self._parts(zip_path)) if self._is_current(real_path, zip_path): diff --git a/pytest.ini b/pytest.ini index 1a651f5..016f118 100644 --- a/pytest.ini +++ b/pytest.ini @@ -86,3 +86,6 @@ filterwarnings= # Avoid errors when testing pkg_resources.declare_namespace ignore:.*pkg_resources\.declare_namespace.*:DeprecationWarning + + # suppress known deprecation + ignore:pkg_resources is deprecated:DeprecationWarning diff --git a/setup.cfg b/setup.cfg index 0fbd809..947f627 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = setuptools -version = 67.4.0 +version = 67.5.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages diff --git a/setuptools/tests/contexts.py b/setuptools/tests/contexts.py index 7ddbc78..112cdf4 100644 --- a/setuptools/tests/contexts.py +++ b/setuptools/tests/contexts.py @@ -6,7 +6,6 @@ import contextlib import site import io -import pkg_resources from filelock import FileLock @@ -28,11 +27,7 @@ def environment(**replacements): In a context, patch the environment with replacements. Pass None values to clear the values. """ - saved = dict( - (key, os.environ[key]) - for key in replacements - if key in os.environ - ) + saved = dict((key, os.environ[key]) for key in replacements if key in os.environ) # remove values that are null remove = (key for (key, value) in replacements.items() if value is None) @@ -81,6 +76,8 @@ def save_user_site_setting(): @contextlib.contextmanager def save_pkg_resources_state(): + import pkg_resources + pr_state = pkg_resources.__getstate__() # also save sys.path sys_path = sys.path[:]