From 3dee384cd4ccaba03f7ff86a21916efb97b4cc67 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Thu, 1 Jun 2023 13:49:12 +0300 Subject: [PATCH 1/2] Try to add pyi files to package. --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.py b/setup.py index 203be547..e4aa1066 100644 --- a/setup.py +++ b/setup.py @@ -129,6 +129,10 @@ def main(): + [ r"python/cv2/.*config.*.py" + ] + + + [ + r"python/cv2/.*\.pyi" ], "cv2.data": [ # OPENCV_OTHER_INSTALL_PATH ("etc" if os.name == "nt" else "share/opencv4") + r"/haarcascades/.*\.xml" From e4da6a05bb3158c44de46425d3b675e9548f3438 Mon Sep 17 00:00:00 2001 From: Alexander Smorkalov Date: Thu, 1 Jun 2023 14:25:58 +0300 Subject: [PATCH 2/2] Update OpenCV to current 4.x to get PR #20370 --- opencv | 2 +- opencv_contrib | 2 +- opencv_extra | 2 +- setup.py | 19 +++++++++++++++---- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/opencv b/opencv index 725e440d..2104d61d 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit 725e440d278aca07d35a5e8963ef990572b07316 +Subproject commit 2104d61d4a3fb363e5c7d29a8d14eac038e2b3b2 diff --git a/opencv_contrib b/opencv_contrib index e247b680..8dfeed73 160000 --- a/opencv_contrib +++ b/opencv_contrib @@ -1 +1 @@ -Subproject commit e247b680a6bd396f110274b6c214406a93171350 +Subproject commit 8dfeed73b9389ba09411498dc1e923431d7fe292 diff --git a/opencv_extra b/opencv_extra index 5abbd7e0..847035ec 160000 --- a/opencv_extra +++ b/opencv_extra @@ -1 +1 @@ -Subproject commit 5abbd7e0546bbb34ae7487170383d3e571fb1dd1 +Subproject commit 847035ec7e1d388def99ecee4905fb9b01d1cabf diff --git a/setup.py b/setup.py index e4aa1066..5107e8ea 100644 --- a/setup.py +++ b/setup.py @@ -131,9 +131,8 @@ def main(): r"python/cv2/.*config.*.py" ] + - [ - r"python/cv2/.*\.pyi" - ], + [ r"python/cv2/py.typed" ] if sys.version_info >= (3, 6) else [] + , "cv2.data": [ # OPENCV_OTHER_INSTALL_PATH ("etc" if os.name == "nt" else "share/opencv4") + r"/haarcascades/.*\.xml" ], @@ -396,7 +395,6 @@ def _classify_installed_files_override( p.replace(os.path.sep, "/") for p in install_relpaths ] relpaths_zip = list(zip(fslash_install_relpaths, install_relpaths)) - del install_relpaths, fslash_install_relpaths final_install_relpaths = [] @@ -415,6 +413,19 @@ def _classify_installed_files_override( with open(config_py, 'w') as opencv_init_config: opencv_init_config.write(custom_init_data) + if sys.version_info >= (3, 6): + for p in install_relpaths: + if p.endswith(".pyi"): + target_rel_path = os.path.relpath(p, "python/cv2") + cls._setuptools_wrap._copy_file( + os.path.join(cmake_install_dir, p), + os.path.join(cmake_install_dir, "cv2", target_rel_path), + hide_listing=False, + ) + final_install_relpaths.append(os.path.join("cv2", target_rel_path)) + + del install_relpaths, fslash_install_relpaths + for package_name, relpaths_re in cls.package_paths_re.items(): package_dest_reldir = package_name.replace(".", os.path.sep) for relpath_re in relpaths_re: