1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Merge pull request #5626 from pradyunsg/fix/pep-518-edge-case-warning

Don't warn if pyproject.toml does not contain build-system.requires
This commit is contained in:
Pradyun Gedam 2018-07-21 16:22:06 +05:30 committed by GitHub
commit 17d0650d5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 26 deletions

View file

@ -1 +0,0 @@
Warn when a project's pyproject.toml file does not contain ``build-system.requires``.

View file

@ -1 +0,0 @@
Warn when a project's pyproject.toml file does not contain ``build-system.requires``.

View file

@ -32,7 +32,6 @@ from pip._internal.locations import (
PIP_DELETE_MARKER_FILENAME, running_under_virtualenv,
)
from pip._internal.req.req_uninstall import UninstallPathSet
from pip._internal.utils.deprecation import deprecated
from pip._internal.utils.hashes import Hashes
from pip._internal.utils.logging import indent_log
from pip._internal.utils.misc import (
@ -574,26 +573,10 @@ class InstallRequirement(object):
# Extract the build requirements
requires = pp_toml.get("build-system", {}).get("requires", None)
template = (
"%s does not comply with PEP 518 since pyproject.toml "
"does not contain a valid '[build-system].requires' key: %s"
)
if requires is None:
logging.warn(template, self, "it is missing.")
deprecated(
"Future versions of pip may reject packages with "
"pyproject.toml files that do not contain the [build-system]"
"table and the requires key, as specified in PEP 518.",
replacement=None,
gone_in="18.2",
issue=5416,
)
# Currently, we're isolating the build based on the presence of the
# pyproject.toml file. If the user doesn't specify
# build-system.requires, assume they intended to use setuptools and
# wheel for now.
# We isolate on the presence of the pyproject.toml file.
# If build-system.requires is not specified, treat it as if it was
# specified as ["setuptools", "wheel"]
return ["setuptools", "wheel"]
else:
# Error out if it's not a list of strings
@ -601,8 +584,12 @@ class InstallRequirement(object):
isinstance(req, six.string_types) for req in requires
)
if not is_list_of_str:
template = (
"{} does not comply with PEP 518 since pyproject.toml "
"does not contain a valid build-system.requires key: {}"
)
raise InstallationError(
template % (self, "it is not a list of strings.")
template.format(self, "it is not a list of strings.")
)
# If control flow reaches here, we're good to go.

View file

@ -47,14 +47,14 @@ def test_pep518_refuses_invalid_requires(script, data, common_wheels):
assert "does not comply with PEP 518" in result.stderr
def test_pep518_allows_but_warns_missing_requires(script, data, common_wheels):
def test_pep518_allows_missing_requires(script, data, common_wheels):
result = script.pip(
'install', '-f', common_wheels,
data.src.join("pep518_missing_requires"),
expect_stderr=True
)
assert "does not comply with PEP 518" in result.stderr
assert "DEPRECATION" in result.stderr
# Make sure we don't warn when this occurs.
assert "does not comply with PEP 518" not in result.stderr
# We want it to go through isolation for now.
assert "Installing build dependencies" in result.stdout, result.stdout