1
1
from __future__ import absolute_import
2
2
3
3
import io
4
+ import logging
4
5
import os
5
6
import sys
6
7
15
16
Pep517Data = Tuple [str , List [str ]]
16
17
17
18
19
+ logger = logging .getLogger (__name__ )
20
+
21
+
18
22
def _is_list_of_str (obj ):
19
23
# type: (Any) -> bool
20
24
return (
@@ -133,7 +137,11 @@ def resolve_pyproject_toml(
133
137
# opposed to False can occur when the value is provided via an
134
138
# environment variable or config file option (due to the quirk of
135
139
# 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 :
137
145
if use_pep517 is not None and not use_pep517 :
138
146
raise InstallationError (
139
147
"Disabling PEP 517 processing is invalid: "
@@ -145,26 +153,45 @@ def resolve_pyproject_toml(
145
153
)
146
154
use_pep517 = True
147
155
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 :
149
186
raise InstallationError (
150
187
"Disabling PEP 517 processing is invalid: "
151
188
"project specifies a build backend of {} "
152
189
"in pyproject.toml" .format (
153
190
build_system ["build-backend" ]
154
191
)
155
192
)
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
168
195
169
196
# If we haven't worked out whether to use PEP 517 yet, and the user
170
197
# hasn't explicitly stated a preference, we do so if the project has
0 commit comments