Start rejecting pyproject.toml files with an empty build-system table

This commit is contained in:
Pradyun Gedam 2018-07-21 13:10:42 +05:30
parent 7fe759bdb1
commit 4d772e6cf6
No known key found for this signature in database
GPG Key ID: DA17C4B29CB32E4B
1 changed files with 11 additions and 1 deletions

View File

@ -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."