From 197f37c80fbef3319f102434a5b98de0d54aa2b9 Mon Sep 17 00:00:00 2001 From: Lewis Arias Date: Fri, 31 May 2024 18:15:03 -0400 Subject: [PATCH] opencv4: properly install Python type-stubs Without these type stubs installed auto-completion for the `cv2` module will not be available and diagnostics may not be accurate. This is especially notable in a devshell using `mkShell` and `python3.withPackages` leading to editors such as Neovim having a poor development experience. --- pkgs/development/libraries/opencv/4.x.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkgs/development/libraries/opencv/4.x.nix b/pkgs/development/libraries/opencv/4.x.nix index 3d5c0ac87067..0a48e4da8563 100644 --- a/pkgs/development/libraries/opencv/4.x.nix +++ b/pkgs/development/libraries/opencv/4.x.nix @@ -480,7 +480,7 @@ effectiveStdenv.mkDerivation { ] ++ optionals (!effectiveStdenv.hostPlatform.isDarwin) [ (cmakeOptionType "path" "OPENCL_LIBRARY" "${ocl-icd}/lib/libOpenCL.so") ] ++ optionals enablePython [ - (cmakeBool "OPENCV_SKIP_PYTHON_LOADER" true) + (cmakeOptionType "path" "OPENCV_PYTHON_INSTALL_PATH" pythonPackages.python.sitePackages) ] ++ optionals (enabledModules != [ ]) [ (cmakeFeature "BUILD_LIST" (concatStringsSep "," enabledModules)) ]; @@ -541,10 +541,6 @@ effectiveStdenv.mkDerivation { pushd dist python -m pip install ./*.whl --no-index --no-warn-script-location --prefix="$out" --no-cache - # the cv2/__init__.py just tries to check provide "nice user feedback" if the installation is bad - # however, this also causes infinite recursion when used by other packages - rm -r $out/${pythonPackages.python.sitePackages}/cv2 - popd popd '';