@@ -128,23 +128,29 @@ def _deprecation_constraint_check(self) -> None:
128
128
if self ._build_constraint_feature_enabled :
129
129
return
130
130
131
+ if self ._build_constraints :
132
+ return
133
+
131
134
if not self ._constraints :
132
135
return
133
136
134
137
if not os .environ .get ("PIP_CONSTRAINT" ):
135
138
return
136
139
137
140
pip_constraint_files = [
138
- f . strip () for f in os .environ ["PIP_CONSTRAINT" ].split () if f .strip ()
141
+ f for f in os .environ ["PIP_CONSTRAINT" ].split () if f .strip ()
139
142
]
140
- if pip_constraint_files and set ( pip_constraint_files ) == set ( self ._constraints ) :
143
+ if pip_constraint_files and pip_constraint_files == self ._constraints :
141
144
deprecated (
142
145
reason = (
143
146
"Setting PIP_CONSTRAINT will not affect "
144
147
"build constraints in the future,"
145
148
),
146
149
replacement = (
147
- 'PIP_BUILD_CONSTRAINT with PIP_USE_FEATURE="build-constraint"'
150
+ "to specify build constraints use --build-constraint or "
151
+ "PIP_BUILD_CONSTRAINT, to disable this warning without "
152
+ "any build constraints set --use-feature=build-constraint or "
153
+ 'PIP_USE_FEATURE="build-constraint"'
148
154
),
149
155
gone_in = "26.2" ,
150
156
issue = None ,
@@ -219,13 +225,17 @@ def install(
219
225
# Handle build constraints
220
226
extra_environ : ExtraEnviron = {}
221
227
if self ._build_constraint_feature_enabled :
228
+ args .extend (["--use-feature" , "build-constraint" ])
229
+
230
+ if self ._build_constraints :
222
231
# Build constraints must be passed as both constraints
223
- # and build constraints to the subprocess
232
+ # and build constraints, so that nested builds receive
233
+ # build constraints
224
234
for constraint_file in self ._build_constraints :
225
235
args .extend (["--constraint" , constraint_file ])
226
236
args .extend (["--build-constraint" , constraint_file ])
227
- args .extend (["--use-feature" , "build-constraint" ])
228
237
238
+ if self ._build_constraint_feature_enabled and not self ._build_constraints :
229
239
# If there are no build constraints but the build constraint
230
240
# process is enabled then we must ignore regular constraints
231
241
if not self ._build_constraints :
0 commit comments