File tree 3 files changed +33
-9
lines changed 3 files changed +33
-9
lines changed Original file line number Diff line number Diff line change
1
+ Automatically use the setuptools PEP 517 build backend when ``--config-settings `` is
2
+ used for projects without ``pyproject.toml ``.
Original file line number Diff line number Diff line change @@ -181,6 +181,16 @@ def __init__(
181
181
# but after loading this flag should be treated as read only.
182
182
self .use_pep517 = use_pep517
183
183
184
+ # If config settings are provided, enforce PEP 517.
185
+ if self .config_settings :
186
+ if self .use_pep517 is False :
187
+ raise InstallationError (
188
+ f"Disabling PEP 517 processing is not allowed for { self } "
189
+ f"when --config-settings are specified."
190
+ )
191
+ else :
192
+ self .use_pep517 = True
193
+
184
194
# This requirement needs more preparation before it can be built
185
195
self .needs_more_preparation = False
186
196
@@ -508,15 +518,7 @@ def load_pyproject_toml(self) -> None:
508
518
)
509
519
510
520
if pyproject_toml_data is None :
511
- if self .config_settings :
512
- deprecated (
513
- reason = f"Config settings are ignored for project { self } ." ,
514
- replacement = (
515
- "to use --use-pep517 or add a "
516
- "pyproject.toml file to the project"
517
- ),
518
- gone_in = "24.0" ,
519
- )
521
+ assert not self .config_settings
520
522
self .use_pep517 = False
521
523
return
522
524
Original file line number Diff line number Diff line change @@ -107,6 +107,26 @@ def make_project(
107
107
return name , version , project_dir
108
108
109
109
110
+ def test_config_settings_implies_pep517 (
111
+ script : PipTestEnvironment , tmp_path : Path
112
+ ) -> None :
113
+ """Test that setup.py bdist_wheel is not used when config settings are."""
114
+ pkg_path = tmp_path / "pkga"
115
+ pkg_path .mkdir ()
116
+ pkg_path .joinpath ("setup.py" ).write_text (
117
+ "from setuptools import setup; setup(name='pkga')\n "
118
+ )
119
+ result = script .pip (
120
+ "wheel" ,
121
+ "--config-settings" ,
122
+ "FOO=Hello" ,
123
+ pkg_path ,
124
+ cwd = tmp_path ,
125
+ )
126
+ assert "Successfully built pkga" in result .stdout
127
+ assert "Preparing metadata (pyproject.toml)" in result .stdout
128
+
129
+
110
130
def test_backend_sees_config (script : PipTestEnvironment ) -> None :
111
131
name , version , project_dir = make_project (script .scratch_path )
112
132
script .pip (
You can’t perform that action at this time.
0 commit comments