Fix PEP 517 builds for packages without setup.py (#6606)

This commit is contained in:
Pradyun Gedam 2019-10-17 22:18:03 +05:30 committed by Xavier Fernandez
parent 4bc72977fc
commit 6ee768a1d4
6 changed files with 25 additions and 1 deletions

1
news/6606.bugfix Normal file
View File

@ -0,0 +1 @@
Fix bug that prevented installation of PEP 517 packages without ``setup.py``.

View File

@ -1,4 +1,3 @@
# The following comment should be removed at some point in the future.
# It's included for now because without it InstallCommand.run() has a
# couple errors where we have to know req.name is str rather than
@ -102,6 +101,8 @@ 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

View File

@ -0,0 +1,3 @@
[build-system]
requires = [ "setuptools" ]
build-backend = "setuptools.build_meta"

View File

@ -0,0 +1,3 @@
[metadata]
name = pep517-setup-and-pyproject
version = 1.0

View File

@ -0,0 +1,3 @@
from setuptools import setup
setup()

View File

@ -1274,6 +1274,19 @@ def test_install_no_binary_disables_building_wheels(script, data, with_wheel):
assert "Running setup.py install for upper" in str(res), str(res)
def test_install_no_binary_builds_pep_517_wheel(script, data, with_wheel):
to_install = data.packages.joinpath('pep517_setup_and_pyproject')
res = script.pip(
'install', '--no-binary=:all:', '-f', data.find_links, to_install
)
expected = ("Successfully installed pep517-setup-and-pyproject")
# Must have installed the package
assert expected in str(res), str(res)
assert "Building wheel for pep517-setup" in str(res), str(res)
assert "Running setup.py install for pep517-set" not in str(res), str(res)
def test_install_no_binary_disables_cached_wheels(script, data, with_wheel):
# Seed the cache
script.pip(