Imported Upstream version 54.2.0 upstream/54.2.0
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:33 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:33 +0000 (17:02 +0900)
.bumpversion.cfg
CHANGES.rst
setup.cfg
setuptools/build_meta.py
setuptools/tests/test_build_meta.py

index 89f47f621d86041e60116098a98da75d9239065f..fdde71809e045051389755301590c6ad50ba7c29 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 54.1.3
+current_version = 54.2.0
 commit = True
 tag = True
 
index 8612991a41209ff83763e1fe663ee762adc94bb1..dca490b75b0029214a6a9f34d3588909c8d0a50c 100644 (file)
@@ -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
 -------
 
index b3e5bb8adf2d8506bcc61e76c6527173b3a0ef8a..1b0e618807245ea9d5d4eb4ed0415d29cda2069f 100644 (file)
--- 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
index b9e8a2b3faa0d635ae96e931c08f69777bc2ef2c..9dfb2f24b52e4d4a806b26fe99ad9a316fcc5631 100644 (file)
@@ -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
 
 
index f33a69688d1cb352da05d965ba19c3c46eee23bf..ab75a1896c637a40697a2c13025d5c0654875fea 100644 (file)
@@ -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__'