From: JinWang An Date: Mon, 27 Mar 2023 08:02:33 +0000 (+0900) Subject: Imported Upstream version 54.2.0 X-Git-Tag: upstream/54.2.0^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f980d05fdc518f1a85bcbf1c0f53fa15da1714d6;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 54.2.0 --- diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 89f47f6..fdde718 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 54.1.3 +current_version = 54.2.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 8612991..dca490b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,13 @@ +v54.2.0 +------- + + +Changes +^^^^^^^ +* #2608: Added informative error message to PEP 517 build failures owing to + an empty ``setup.py`` -- by :user:`layday` + + v54.1.3 ------- diff --git a/setup.cfg b/setup.cfg index b3e5bb8..1b0e618 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 54.1.3 +version = 54.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/build_meta.py b/setuptools/build_meta.py index b9e8a2b..9dfb2f2 100644 --- a/setuptools/build_meta.py +++ b/setuptools/build_meta.py @@ -101,7 +101,12 @@ def _file_with_extension(directory, extension): f for f in os.listdir(directory) if f.endswith(extension) ) - file, = matching + try: + file, = matching + except ValueError: + raise ValueError( + 'No distribution was found. Ensure that `setup.py` ' + 'is not empty and that it calls `setup()`.') return file diff --git a/setuptools/tests/test_build_meta.py b/setuptools/tests/test_build_meta.py index f33a696..ab75a18 100644 --- a/setuptools/tests/test_build_meta.py +++ b/setuptools/tests/test_build_meta.py @@ -3,6 +3,7 @@ import shutil import tarfile import importlib from concurrent import futures +import re import pytest from jaraco import path @@ -442,6 +443,16 @@ class TestBuildMetaBackend: with pytest.raises(AssertionError): build_backend.build_sdist("temp") + @pytest.mark.parametrize('build_hook', ('build_sdist', 'build_wheel')) + def test_build_with_empty_setuppy(self, build_backend, build_hook): + files = {'setup.py': ''} + path.build(files) + + with pytest.raises( + ValueError, + match=re.escape('No distribution was found.')): + getattr(build_backend, build_hook)("temp") + class TestBuildMetaLegacyBackend(TestBuildMetaBackend): backend_name = 'setuptools.build_meta:__legacy__'