From 21b2e4e83ae67f1b3b05b7a938a104aadad6ef95 Mon Sep 17 00:00:00 2001 From: JinWang An Date: Mon, 27 Mar 2023 17:02:30 +0900 Subject: [PATCH] Imported Upstream version 51.2.0 --- .bumpversion.cfg | 2 +- CHANGES.rst | 20 +++++++++++++++++++- docs/setuptools.rst | 2 +- docs/userguide/entry_point.rst | 2 +- pkg_resources/__init__.py | 3 ++- setup.cfg | 2 +- setuptools/tests/test_easy_install.py | 12 ++++++++++++ 7 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 432c813..facadd5 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 51.1.2 +current_version = 51.2.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 5f69c6a..e51b5e6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,21 @@ +v51.2.0 +------- + + +Changes +^^^^^^^ +* #2493: Use importlib.import_module() rather than the deprectated loader.load_module() + in pkg_resources namespace delaration -- by :user:`encukou` + +Documentation changes +^^^^^^^^^^^^^^^^^^^^^ +* #2525: Fix typo in the document page about entry point. -- by :user:`jtr109` + +Misc +^^^^ +* #2534: Avoid hitting network during test_easy_install. + + v51.1.2 ------- @@ -13,7 +31,7 @@ v51.1.1 Misc ^^^^ -* #2525: Avoid hitting network during test_virtualenv.test_test_command. +* #2534: Avoid hitting network during test_virtualenv.test_test_command. v51.1.0 diff --git a/docs/setuptools.rst b/docs/setuptools.rst index 1000a0c..05516a4 100644 --- a/docs/setuptools.rst +++ b/docs/setuptools.rst @@ -157,7 +157,7 @@ To use this feature: ] build-backend = "setuptools.build_meta" -* Use a :pep:`517` compatible build frontend, such as ``pip >= 19`` or ``pep517``. +* Use a :pep:`517` compatible build frontend, such as ``pip >= 19`` or ``build``. .. warning:: diff --git a/docs/userguide/entry_point.rst b/docs/userguide/entry_point.rst index edab446..7382072 100644 --- a/docs/userguide/entry_point.rst +++ b/docs/userguide/entry_point.rst @@ -28,7 +28,7 @@ with ``__init__.py`` as: .. code-block:: python - def helloworld(): + def hello_world(): print("Hello world") and ``__main__.py`` providing a hook: diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 737f4d5..99b7f68 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -38,6 +38,7 @@ import itertools import inspect import ntpath import posixpath +import importlib from pkgutil import get_importer try: @@ -2209,7 +2210,7 @@ def _handle_ns(packageName, path_item): if subpath is not None: path = module.__path__ path.append(subpath) - loader.load_module(packageName) + importlib.import_module(packageName) _rebuild_mod_path(path, packageName, module) return subpath diff --git a/setup.cfg b/setup.cfg index dff72ca..451abe8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] license_file = LICENSE name = setuptools -version = 51.1.2 +version = 51.2.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/test_easy_install.py b/setuptools/tests/test_easy_install.py index dc00e69..6aa17e9 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -38,6 +38,16 @@ from .files import build_files from .textwrap import DALS +@pytest.fixture(autouse=True) +def pip_disable_index(monkeypatch): + """ + Important: Disable the default index for pip to avoid + querying packages in the index and potentially resolving + and installing packages there. + """ + monkeypatch.setenv('PIP_NO_INDEX', 'true') + + class FakeDist: def get_entry_map(self, group): if group != 'console_scripts': @@ -445,6 +455,7 @@ class TestSetupRequires: """ monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) + monkeypatch.setenv('PIP_NO_INDEX', 'false') with contexts.quiet(): # create an sdist that has a build-time dependency. with TestSetupRequires.create_sdist() as dist_file: @@ -618,6 +629,7 @@ class TestSetupRequires: def test_setup_requires_honors_pip_env(self, mock_index, monkeypatch): monkeypatch.setenv(str('PIP_RETRIES'), str('0')) monkeypatch.setenv(str('PIP_TIMEOUT'), str('0')) + monkeypatch.setenv('PIP_NO_INDEX', 'false') monkeypatch.setenv(str('PIP_INDEX_URL'), mock_index.url) with contexts.save_pkg_resources_state(): with contexts.tempdir() as temp_dir: -- 2.34.1