Skip to content

Commit 72e919a

Browse files
authored
Merge pull request #5293 from pypa/bugfix/integration-pip-flit-backend
Fix integration test for pip's flit_core build backend
2 parents bb1b381 + 1b29701 commit 72e919a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎setuptools/tests/integration/test_pip_install_sdist.py‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,15 @@ def build_deps(package, sdist_file):
215215

216216

217217
def _read_pyproject(archive):
218-
contents = (
219-
archive.get_content(member)
218+
members = [
219+
member
220220
for member in archive
221221
if os.path.basename(archive.get_name(member)) == "pyproject.toml"
222-
)
223-
return next(contents, "")
222+
]
223+
if not members:
224+
return ""
225+
# An sdist may contain nested pyproject.toml files (e.g. pip ships a
226+
# ``build-project/`` helper). The project's own build metadata lives in the
227+
# top-level ``{name}-{version}/pyproject.toml``, i.e. the shallowest one.
228+
top = min(members, key=lambda m: archive.get_name(m).count("/"))
229+
return archive.get_content(top)

0 commit comments

Comments
 (0)