@@ -49,11 +49,27 @@ def read_pyproject_toml(path):
49
49
return build_system
50
50
51
51
52
+ def make_editable_error (req_name , reason ):
53
+ """
54
+ :param req_name: the name of the requirement.
55
+ :param reason: the reason the requirement is being processed as
56
+ pyproject.toml-style.
57
+ """
58
+ message = (
59
+ 'Error installing {!r}: editable mode is not supported for '
60
+ 'pyproject.toml-style projects. This project is being processed '
61
+ 'as pyproject.toml-style because {}. '
62
+ 'See PEP 517 for the relevant specification.'
63
+ ).format (req_name , reason )
64
+ return InstallationError (message )
65
+
66
+
52
67
def resolve_pyproject_toml (
53
- build_system , # type: Optional[Dict[str, str ]]
68
+ build_system , # type: Optional[Dict[str, Any ]]
54
69
has_pyproject , # type: bool
55
70
has_setup , # type: bool
56
71
use_pep517 , # type: Optional[bool]
72
+ editable , # type: bool
57
73
req_name , # type: str
58
74
):
59
75
# type: (...) -> Optional[Tuple[List[str], str, List[str]]]
@@ -67,6 +83,7 @@ def resolve_pyproject_toml(
67
83
:param has_setup: whether the project has a setup.py file.
68
84
:param use_pep517: whether the user requested PEP 517 processing. None
69
85
means the user didn't explicitly specify.
86
+ :param editable: whether editable mode was requested for the requirement.
70
87
:param req_name: the name of the requirement we're processing (for
71
88
error reporting).
72
89
"""
@@ -82,6 +99,10 @@ def resolve_pyproject_toml(
82
99
"Disabling PEP 517 processing is invalid: "
83
100
"project does not have a setup.py"
84
101
)
102
+ if editable :
103
+ raise make_editable_error (
104
+ req_name , 'it has a pyproject.toml file and no setup.py'
105
+ )
85
106
use_pep517 = True
86
107
elif build_system and "build-backend" in build_system :
87
108
if use_pep517 is not None and not use_pep517 :
@@ -92,7 +113,18 @@ def resolve_pyproject_toml(
92
113
build_system ["build-backend" ]
93
114
)
94
115
)
116
+ if editable :
117
+ reason = (
118
+ 'it has a pyproject.toml file with a "build-backend" key '
119
+ 'in the "build_system" value'
120
+ )
121
+ raise make_editable_error (req_name , reason )
95
122
use_pep517 = True
123
+ elif use_pep517 :
124
+ if editable :
125
+ raise make_editable_error (
126
+ req_name , 'PEP 517 processing was explicitly requested'
127
+ )
96
128
97
129
# If we haven't worked out whether to use PEP 517 yet,
98
130
# and the user hasn't explicitly stated a preference,
@@ -175,6 +207,7 @@ def resolve_pyproject_toml(
175
207
176
208
def load_pyproject_toml (
177
209
use_pep517 , # type: Optional[bool]
210
+ editable , # type: bool
178
211
pyproject_toml , # type: str
179
212
setup_py , # type: str
180
213
req_name # type: str
@@ -185,6 +218,7 @@ def load_pyproject_toml(
185
218
Parameters:
186
219
use_pep517 - Has the user requested PEP 517 processing? None
187
220
means the user hasn't explicitly specified.
221
+ editable - Whether editable mode was requested for the requirement.
188
222
pyproject_toml - Location of the project's pyproject.toml file
189
223
setup_py - Location of the project's setup.py file
190
224
req_name - The name of the requirement we're processing (for
@@ -212,5 +246,6 @@ def load_pyproject_toml(
212
246
has_pyproject = has_pyproject ,
213
247
has_setup = has_setup ,
214
248
use_pep517 = use_pep517 ,
249
+ editable = editable ,
215
250
req_name = req_name ,
216
251
)
0 commit comments