Content-Length: 598920 | pFad | http://github.com/opencv/opencv-python/commit/6a1f61b8d7e413059dbf0b9e897579c8305c327f

17 Updated submodules to the release 4.5.4, added python loader support,… · opencv/opencv-python@6a1f61b · GitHub
Skip to content

Commit 6a1f61b

Browse files
committed
Updated submodules to the release 4.5.4, added python loader support, updated Qt patch
1 parent 85b9bc5 commit 6a1f61b

File tree

7 files changed

+77
-44
lines changed

7 files changed

+77
-44
lines changed

cv2/__init__.py

-31
Original file line numberDiff line numberDiff line change
@@ -1,31 +0,0 @@
1-
import importlib
2-
import os
3-
import sys
4-
5-
from .cv2 import *
6-
from .data import *
7-
8-
# wildcard import above does not import "private" variables like __version__
9-
# this makes them available
10-
globals().update(importlib.import_module("cv2.cv2").__dict__)
11-
12-
ci_and_not_headless = False
13-
14-
try:
15-
from .version import ci_build, headless
16-
17-
ci_and_not_headless = ci_build and not headless
18-
except:
19-
pass
20-
21-
# the Qt plugin is included currently only in the pre-built wheels
22-
if sys.platform.startswith("linux") and ci_and_not_headless:
23-
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = os.path.join(
24-
os.path.dirname(os.path.abspath(__file__)), "qt", "plugins"
25-
)
26-
27-
# Qt will throw warning on Linux if fonts are not found
28-
if sys.platform.startswith("linux") and ci_and_not_headless:
29-
os.environ["QT_QPA_FONTDIR"] = os.path.join(
30-
os.path.dirname(os.path.abspath(__file__)), "qt", "fonts"
31-
)

opencv

Submodule opencv updated 449 files

opencv_contrib

Submodule opencv_contrib updated 123 files

opencv_extra

Submodule opencv_extra updated 232 files

patches/patchQtPlugins

+13-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,23 @@ index 4c0b3880fc..dffa0a4caa 100644
33
--- a/opencv/CMakeLists.txt
44
+++ b/opencv/CMakeLists.txt
55
@@ -1187,6 +1187,13 @@ if(WITH_QT OR HAVE_QT)
6-
if(HAVE_QT5)
7-
status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
8-
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
6+
if(HAVE_QT)
7+
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
98
+ if(APPLE)
109
+ install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt)
1110
+ endif()
1211
+ if(UNIX AND NOT APPLE)
1312
+ install(DIRECTORY /opt/Qt5.15.0/plugins DESTINATION lib/qt)
1413
+ install(DIRECTORY /usr/share/fonts DESTINATION lib/qt)
1514
+ endif()
16-
elseif(HAVE_QT)
17-
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
18-
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
15+
if(HAVE_QT_OPENGL)
16+
if(Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES)
17+
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES} ${Qt${QT_VERSION_MAJOR}OpenGL_VERSION_STRING})" ELSE NO)
18+
else()
19+
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
20+
endif()
21+
else()
22+
status(" QT OpenGL support:" "NO")
23+
endif()
24+
else()
25+
status(" QT:" "NO")

scripts/__init__.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from .cv2 import *
2+
from .data import *
3+
4+
ci_and_not_headless = False
5+
6+
try:
7+
from .version import ci_build, headless
8+
9+
ci_and_not_headless = ci_build and not headless
10+
except:
11+
pass
12+
13+
# the Qt plugin is included currently only in the pre-built wheels
14+
if sys.platform.startswith("linux") and ci_and_not_headless:
15+
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = os.path.join(
16+
os.path.dirname(os.path.abspath(__file__)), "qt", "plugins"
17+
)
18+
19+
# Qt will throw warning on Linux if fonts are not found
20+
if sys.platform.startswith("linux") and ci_and_not_headless:
21+
os.environ["QT_QPA_FONTDIR"] = os.path.join(
22+
os.path.dirname(os.path.abspath(__file__)), "qt", "fonts"
23+
)

setup.py

+38-4
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,32 @@ def main():
108108
# Naming conventions vary so widely between versions and OSes
109109
# had to give up on checking them.
110110
[
111-
"python/cv2[^/]*%(ext)s"
112-
% {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
111+
"python/cv2/python-%s.%s/cv2[^/]*%s"
112+
% (sys.version_info[0], sys.version_info[1], re.escape(sysconfig.get_config_var("EXT_SUFFIX")))
113+
]
114+
+
115+
[
116+
r"python/cv2/__init__.py"
117+
]
118+
+
119+
[
120+
r"python/cv2/.*config.*.py"
113121
],
114122
"cv2.data": [ # OPENCV_OTHER_INSTALL_PATH
115123
("etc" if os.name == "nt" else "share/opencv4") + r"/haarcascades/.*\.xml"
116124
],
125+
"cv2.gapi": [
126+
"python/cv2" + r"/gapi/.*\.py"
127+
],
128+
"cv2.mat_wrapper": [
129+
"python/cv2" + r"/mat_wrapper/.*\.py"
130+
],
131+
"cv2.misc": [
132+
"python/cv2" + r"/misc/.*\.py"
133+
],
134+
"cv2.utils": [
135+
"python/cv2" + r"/utils/.*\.py"
136+
],
117137
}
118138

119139
# Files in sourcetree outside package dir that should be copied to package.
@@ -137,8 +157,6 @@ def main():
137157
"-DBUILD_opencv_python2=OFF",
138158
# Disable the Java build by default as it is not needed
139159
"-DBUILD_opencv_java=%s" % build_java,
140-
# When off, adds __init__.py and a few more helper .py's. We use our own helper files with a different structure.
141-
"-DOPENCV_SKIP_PYTHON_LOADER=ON",
142160
# Relative dir to install the built module to in the build tree.
143161
# The default is generated from sysconfig, we'd rather have a constant for simplicity
144162
"-DOPENCV_PYTHON3_INSTALL_PATH=python",
@@ -358,6 +376,22 @@ def _classify_installed_files_override(
358376

359377
print("Copying files from CMake output")
360378

379+
with open('%spython/cv2/__init__.py'
380+
% cmake_install_dir, 'r') as opencv_init:
381+
opencv_init_data = ""
382+
for line in opencv_init:
383+
opencv_init_replacement = line.replace('importlib.import_module("cv2")', 'importlib.import_module("cv2.cv2")')
384+
opencv_init_data = opencv_init_data + opencv_init_replacement
385+
with open('%spython/cv2/__init__.py'
386+
% cmake_install_dir, 'w') as opencv_python_init:
387+
opencv_python_init.write(opencv_init_data)
388+
389+
with open('scripts/__init__.py', 'r') as custom_init:
390+
custom_init_data = custom_init.read()
391+
with open('%spython/cv2/config-%s.%s.py'
392+
% (cmake_install_dir, sys.version_info[0], sys.version_info[1]), 'a') as opencv_init_config:
393+
opencv_init_config.write(custom_init_data)
394+
361395
for package_name, relpaths_re in cls.package_paths_re.items():
362396
package_dest_reldir = package_name.replace(".", os.path.sep)
363397
for relpath_re in relpaths_re:

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/opencv/opencv-python/commit/6a1f61b8d7e413059dbf0b9e897579c8305c327f

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy