Skip to content

Commit 06cb48b

Browse files
committed
fix PEP 518 support: support markers in build requirements
1 parent 28f3ce6 commit 06cb48b

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

news/5230.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix PEP 518 support: support markers in build requirements.

src/pip/_internal/operations/prepare.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ def _install_build_reqs(finder, prefix, build_requirements):
5353
# that should handle all the isolation and sub-process invocation.
5454
finder = copy(finder)
5555
finder.format_control = FormatControl(set(), set([":all:"]))
56-
urls = [
57-
finder.find_requirement(
58-
InstallRequirement.from_line(r), upgrade=False).url
59-
for r in build_requirements
60-
]
56+
urls = []
57+
for req_str in build_requirements:
58+
req = InstallRequirement.from_line(req_str)
59+
if req.match_markers():
60+
urls.append(finder.find_requirement(req, upgrade=False).url)
6161
args = [
6262
sys.executable, '-m', 'pip', 'install', '--ignore-installed',
6363
'--no-user', '--prefix', prefix,

tests/data/packages/pep518-3.0.tar.gz

46 Bytes
Binary file not shown.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
[build-system]
2-
requires=["simplewheel==2.0", "setuptools", "wheel"]
2+
requires=[
3+
"simplewheel==1.0; python_version < '3'",
4+
"simplewheel==2.0; python_version >= '3'",
5+
"setuptools", "wheel",
6+
]

0 commit comments

Comments
 (0)