Improve check_binary_allowed via early return

This commit is contained in:
Sebastian Jordan 2019-09-25 06:58:53 +02:00
parent dd842fd71e
commit 7a0f7b607d
1 changed files with 3 additions and 1 deletions

View File

@ -100,9 +100,11 @@ def get_check_binary_allowed(format_control):
# type: (FormatControl) -> BinaryAllowedPredicate
def check_binary_allowed(req):
# type: (InstallRequirement) -> bool
if req.use_pep517:
return True
canonical_name = canonicalize_name(req.name)
allowed_formats = format_control.get_allowed_formats(canonical_name)
return "binary" in allowed_formats or req.use_pep517
return "binary" in allowed_formats
return check_binary_allowed