@@ -240,44 +240,19 @@ def get_tag(self) -> Tuple[str, str, str]:
240
240
dist .cmdclass ["bdist_wheel" ] = bdist_wheel_rust_extension
241
241
242
242
243
- def patch_distutils_build () -> None :
244
- """Patch distutils to use `has_ext_modules()`
245
-
246
- See https://github.com/pypa/distutils/pull/43
247
- """
248
- from distutils .command import build as _build
249
-
250
- class build (_build .build ):
251
- # Missing type def from distutils.cmd.Command; add it here for now
252
- distribution : Distribution
253
-
254
- def finalize_options (self ) -> None :
255
- build_lib_user_specified = self .build_lib is not None
256
- super ().finalize_options ()
257
- if not build_lib_user_specified :
258
- if self .distribution .has_ext_modules (): # type: ignore[attr-defined]
259
- self .build_lib = self .build_platlib
260
- else :
261
- self .build_lib = self .build_purelib
262
-
263
- _build .build = build # type: ignore[misc]
264
-
265
-
266
243
def rust_extensions (
267
244
dist : Distribution , attr : Literal ["rust_extensions" ], value : List [RustExtension ]
268
245
) -> None :
269
246
assert attr == "rust_extensions"
270
247
has_rust_extensions = len (value ) > 0
271
248
272
- # Monkey patch has_ext_modules to include Rust extensions; pairs with
273
- # patch_distutils_build above.
249
+ # Monkey patch has_ext_modules to include Rust extensions.
274
250
#
275
251
# has_ext_modules is missing from Distribution typing.
276
252
orig_has_ext_modules = dist .has_ext_modules # type: ignore[attr-defined]
277
253
dist .has_ext_modules = lambda : (orig_has_ext_modules () or has_rust_extensions ) # type: ignore[attr-defined]
278
254
279
255
if has_rust_extensions :
280
- patch_distutils_build ()
281
256
add_rust_extension (dist )
282
257
283
258
0 commit comments