11from __future__ import absolute_import
22
33import io
4+ import logging
45import os
56import sys
67
1516 Pep517Data = Tuple [str , List [str ]]
1617
1718
19+ logger = logging .getLogger (__name__ )
20+
21+
1822def _is_list_of_str (obj ):
1923 # type: (Any) -> bool
2024 return (
@@ -133,7 +137,11 @@ def resolve_pyproject_toml(
133137 # opposed to False can occur when the value is provided via an
134138 # environment variable or config file option (due to the quirk of
135139 # strtobool() returning an integer in pip's configuration code).
136- if has_pyproject and not has_setup :
140+ if editable and use_pep517 :
141+ raise make_editable_error (
142+ req_name , 'PEP 517 processing was explicitly requested'
143+ )
144+ elif has_pyproject and not has_setup :
137145 if use_pep517 is not None and not use_pep517 :
138146 raise InstallationError (
139147 "Disabling PEP 517 processing is invalid: "
@@ -145,26 +153,45 @@ def resolve_pyproject_toml(
145153 )
146154 use_pep517 = True
147155 elif build_system and "build-backend" in build_system :
148- if use_pep517 is not None and not use_pep517 :
156+ if editable :
157+ if use_pep517 is None :
158+ message = (
159+ 'Error installing {!r}: editable mode is not supported '
160+ 'for pyproject.toml-style projects. '
161+ 'This project is pyproject.toml-style because it has a '
162+ 'pyproject.toml file and a "build-backend" key for the '
163+ '"build_system" value, but editable mode is undefined '
164+ 'for pyproject.toml-style projects. '
165+ 'Since the project has a setup.py, you may pass '
166+ '--no-use-pep517 to opt out of pyproject.toml-style '
167+ 'processing. However, this is an unsupported combination. '
168+ 'See PEP 517 for details on pyproject.toml-style projects.'
169+ ).format (req_name )
170+ raise InstallationError (message )
171+
172+ # The case of `editable and use_pep517` being true was already
173+ # handled above.
174+ assert not use_pep517
175+ message = (
176+ 'Installing {!r} in editable mode, which is not supported '
177+ 'for pyproject.toml-style projects: '
178+ 'this project is pyproject.toml-style because it has a '
179+ 'pyproject.toml file and a "build-backend" key for the '
180+ '"build_system" value, but editable mode is undefined '
181+ 'for pyproject.toml-style projects. '
182+ 'See PEP 517 for details on pyproject.toml-style projects.'
183+ ).format (req_name )
184+ logger .warning (message )
185+ elif use_pep517 is not None and not use_pep517 :
149186 raise InstallationError (
150187 "Disabling PEP 517 processing is invalid: "
151188 "project specifies a build backend of {} "
152189 "in pyproject.toml" .format (
153190 build_system ["build-backend" ]
154191 )
155192 )
156- if editable :
157- reason = (
158- 'it has a pyproject.toml file with a "build-backend" key '
159- 'in the "build_system" value'
160- )
161- raise make_editable_error (req_name , reason )
162- use_pep517 = True
163- elif use_pep517 :
164- if editable :
165- raise make_editable_error (
166- req_name , 'PEP 517 processing was explicitly requested'
167- )
193+ else :
194+ use_pep517 = True
168195
169196 # If we haven't worked out whether to use PEP 517 yet, and the user
170197 # hasn't explicitly stated a preference, we do so if the project has
0 commit comments