diff --git a/news/6606.bugfix b/news/6606.bugfix new file mode 100644 index 00000000000..3fbf7262f14 --- /dev/null +++ b/news/6606.bugfix @@ -0,0 +1 @@ +Fix bug that prevented installation of PEP 517 packages without ``setup.py``. diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py index 66071f6e819..5842d18da1b 100644 --- a/src/pip/_internal/commands/install.py +++ b/src/pip/_internal/commands/install.py @@ -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 diff --git a/tests/data/packages/pep517_setup_and_pyproject/pyproject.toml b/tests/data/packages/pep517_setup_and_pyproject/pyproject.toml new file mode 100644 index 00000000000..5a561e83317 --- /dev/null +++ b/tests/data/packages/pep517_setup_and_pyproject/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = [ "setuptools" ] +build-backend = "setuptools.build_meta" diff --git a/tests/data/packages/pep517_setup_and_pyproject/setup.cfg b/tests/data/packages/pep517_setup_and_pyproject/setup.cfg new file mode 100644 index 00000000000..7eae9c0111e --- /dev/null +++ b/tests/data/packages/pep517_setup_and_pyproject/setup.cfg @@ -0,0 +1,3 @@ +[metadata] +name = pep517-setup-and-pyproject +version = 1.0 diff --git a/tests/data/packages/pep517_setup_and_pyproject/setup.py b/tests/data/packages/pep517_setup_and_pyproject/setup.py new file mode 100644 index 00000000000..606849326a4 --- /dev/null +++ b/tests/data/packages/pep517_setup_and_pyproject/setup.py @@ -0,0 +1,3 @@ +from setuptools import setup + +setup() diff --git a/tests/functional/test_install.py b/tests/functional/test_install.py index f07dcd4eff0..0bea0543f8b 100644 --- a/tests/functional/test_install.py +++ b/tests/functional/test_install.py @@ -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(