Start rejecting pyproject.toml files with an empty build-system table
@@ -580,8 +580,18 @@ class InstallRequirement(object):
if "build-system" not in pp_toml:
return ["setuptools", "wheel"]
+ # Specifying the build-system table but not the requires key is invalid
+ build_system = pp_toml["build-system"]
+ if "requires" not in build_system:
+ raise InstallationError(
+ error_template.format(package=self, reason=(
+ "it has a 'build-system' table but not the "
+ "'build-system.requires' which is mandatory in the table"
+ ))
+ )
+
# Error out if it's not a list of strings
- requires = build_system.get("requires", [])
+ requires = build_system["requires"]
if not _is_list_of_str(requires):
raise InstallationError(error_template.format(
self, "'build-system.requires' is not a list of strings."
