Skip to content

Commit 6ee768a

Browse files
pradyunsgxavfernandez
authored andcommitted
Fix PEP 517 builds for packages without setup.py (pypa#6606)
1 parent 4bc7297 commit 6ee768a

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-1
lines changed

news/6606.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix bug that prevented installation of PEP 517 packages without ``setup.py``.

src/pip/_internal/commands/install.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# The following comment should be removed at some point in the future.
32
# It's included for now because without it InstallCommand.run() has a
43
# couple errors where we have to know req.name is str rather than
@@ -102,6 +101,8 @@ def get_check_binary_allowed(format_control):
102101
# type: (FormatControl) -> BinaryAllowedPredicate
103102
def check_binary_allowed(req):
104103
# type: (InstallRequirement) -> bool
104+
if req.use_pep517:
105+
return True
105106
canonical_name = canonicalize_name(req.name)
106107
allowed_formats = format_control.get_allowed_formats(canonical_name)
107108
return "binary" in allowed_formats
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = [ "setuptools" ]
3+
build-backend = "setuptools.build_meta"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[metadata]
2+
name = pep517-setup-and-pyproject
3+
version = 1.0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from setuptools import setup
2+
3+
setup()

tests/functional/test_install.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,19 @@ def test_install_no_binary_disables_building_wheels(script, data, with_wheel):
12741274
assert "Running setup.py install for upper" in str(res), str(res)
12751275

12761276

1277+
def test_install_no_binary_builds_pep_517_wheel(script, data, with_wheel):
1278+
to_install = data.packages.joinpath('pep517_setup_and_pyproject')
1279+
res = script.pip(
1280+
'install', '--no-binary=:all:', '-f', data.find_links, to_install
1281+
)
1282+
expected = ("Successfully installed pep517-setup-and-pyproject")
1283+
# Must have installed the package
1284+
assert expected in str(res), str(res)
1285+
1286+
assert "Building wheel for pep517-setup" in str(res), str(res)
1287+
assert "Running setup.py install for pep517-set" not in str(res), str(res)
1288+
1289+
12771290
def test_install_no_binary_disables_cached_wheels(script, data, with_wheel):
12781291
# Seed the cache
12791292
script.pip(

0 commit comments

Comments
 (0)