@@ -427,12 +427,6 @@ def _install_path(self, wheel_file: mesonpy._wheelfile.WheelFile, origin: Path,
427427
428428 if self ._has_internal_libs :
429429 if _is_native (origin ):
430- if sys .platform == 'win32' and not self ._allow_windows_shared_libs :
431- raise NotImplementedError (
432- 'Loading shared libraries bundled in the Python wheel on Windows requires '
433- 'setting the DLL load path or preloading. See the documentation for '
434- 'the "tool.meson-python.allow-windows-internal-shared-libs" option.' )
435-
436430 # When an executable, libray, or Python extension module is
437431 # dynamically linked to a library built as part of the project,
438432 # Meson adds a library load path to it pointing to the build
@@ -469,6 +463,12 @@ def _wheel_write_metadata(self, whl: mesonpy._wheelfile.WheelFile) -> None:
469463 whl .write (f , f'{ self ._distinfo_dir } /licenses/{ pathlib .Path (f ).as_posix ()} ' )
470464
471465 def build (self , directory : Path ) -> pathlib .Path :
466+ if sys .platform == 'win32' and self ._has_internal_libs and not self ._allow_windows_shared_libs :
467+ raise NotImplementedError (
468+ 'Loading shared libraries bundled in the Python wheel on Windows requires '
469+ 'setting the DLL load path or preloading. See the documentation for '
470+ 'the "tool.meson-python.allow-windows-internal-shared-libs" option.' )
471+
472472 wheel_file = pathlib .Path (directory , f'{ self .name } .whl' )
473473 with mesonpy ._wheelfile .WheelFile (wheel_file , 'w' ) as whl :
474474 self ._wheel_write_metadata (whl )
0 commit comments