mirror of
https://github.com/opencv/opencv.git
synced 2026-07-24 21:03:03 +04:00
3779f630bc
When a module is disabled in an incremental build (e.g. switching from -DBUILD_opencv_gapi=ON to OFF), its typing stub directory persists from the previous build. The stubs generator only creates directories for enabled modules but never removes old ones, and the copy step merges rather than replaces, so stale .pyi files propagate to both the loader directory and the install prefix. This causes type-checkers (mypy, pyright) to report errors for stubs that reference symbols from modules that are no longer available. Fix both propagation paths: - generation.py: remove all subdirectories under the stubs output root before regenerating, so only currently enabled module stubs exist in the build directory. Top-level files (py.typed) are preserved. - copy_typings_stubs_on_success.py: remove stale .pyi files and py.typed markers from the loader directory before copying fresh stubs, so leftover stubs from a previous copy are cleaned up. Runtime .py files are not affected.