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:
commit
17d0650d5c
4 changed files with 11 additions and 26 deletions
|
@ -1 +0,0 @@
|
|||
Warn when a project's pyproject.toml file does not contain ``build-system.requires``.
|
|
@ -1 +0,0 @@
|
|||
Warn when a project's pyproject.toml file does not contain ``build-system.requires``.
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue