Skip to content

Commit 2f022b9

Browse files
ooooo-createabravalheri
authored andcommitted
revert code change and refine assert message
1 parent a75a245 commit 2f022b9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

setuptools/build_meta.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,12 @@ def _find_info_directory(self, metadata_directory: StrPath, suffix: str) -> Path
356356
for parent, dirs, _ in os.walk(metadata_directory):
357357
candidates = [f for f in dirs if f.endswith(suffix)]
358358

359-
if len(candidates) != 0:
360-
assert len(candidates) == 1, f"Multiple {suffix} directories found"
359+
if len(candidates) != 0 or len(dirs) != 1:
360+
assert len(candidates) == 1, (
361+
f"Exactly one {suffix} should have been produced, but found {len(candidates)}: {candidates}"
362+
)
361363
return Path(parent, candidates[0])
362364

363-
if len(dirs) != 1:
364-
break
365-
366365
msg = f"No {suffix} directory found in {metadata_directory}"
367366
raise errors.InternalError(msg)
368367

0 commit comments

Comments
 (0)