Message ID | 20191129190707.710738-3-thomas.petazzoni@bootlin.com |
---|---|
State | Accepted |
Headers | show |
Series | Support excluding .py files from removal | expand |
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes: > The OpenCV Python module does a fairly strange thing to read a few > configuration details: it uses Python's execfile() to execute two .py > files and access a few variables. However, execfile() only works with > .py files and not .pyc files. > When BR2_PACKAGE_PYTHON{,3}_PYC_ONLY=y, the .py files are all removed, > causing the OpenCV Python module to not work: > File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module> > File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 58, in bootstrap > File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config > ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation. > To fix this problem, this commit uses the newly introduced > <pkg>_KEEP_PY_FILES mechanism, to ensure the important config*.py > files are kept. > Fixes: > https://bugs.busybox.net/show_bug.cgi?id=12171 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Committed, thanks.
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes: > The OpenCV Python module does a fairly strange thing to read a few > configuration details: it uses Python's execfile() to execute two .py > files and access a few variables. However, execfile() only works with > .py files and not .pyc files. > When BR2_PACKAGE_PYTHON{,3}_PYC_ONLY=y, the .py files are all removed, > causing the OpenCV Python module to not work: > File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module> > File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 58, in bootstrap > File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config > ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation. > To fix this problem, this commit uses the newly introduced > <pkg>_KEEP_PY_FILES mechanism, to ensure the important config*.py > files are kept. > Fixes: > https://bugs.busybox.net/show_bug.cgi?id=12171 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Committed to 2019.02.x and 2019.08.x, thanks.
diff --git a/package/opencv3/opencv3.mk b/package/opencv3/opencv3.mk index 83094ed78b..d38107f6e7 100644 --- a/package/opencv3/opencv3.mk +++ b/package/opencv3/opencv3.mk @@ -328,6 +328,7 @@ OPENCV3_CONF_OPTS += \ -DPYTHON2_PACKAGES_PATH=/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages \ -DPYTHON2_NUMPY_VERSION=$(PYTHON_NUMPY_VERSION) OPENCV3_DEPENDENCIES += python +OPENCV3_KEEP_PY_FILES += usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages/cv2/config*.py else OPENCV3_CONF_OPTS += \ -DBUILD_opencv_python2=OFF \ @@ -339,6 +340,7 @@ OPENCV3_CONF_OPTS += \ -DPYTHON3_PACKAGES_PATH=/usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \ -DPYTHON3_NUMPY_VERSION=$(PYTHON_NUMPY_VERSION) OPENCV3_DEPENDENCIES += python3 +OPENCV3_KEEP_PY_FILES += usr/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/cv2/config*.py endif OPENCV3_CONF_ENV += $(PKG_PYTHON_DISTUTILS_ENV) OPENCV3_DEPENDENCIES += python-numpy
The OpenCV Python module does a fairly strange thing to read a few configuration details: it uses Python's execfile() to execute two .py files and access a few variables. However, execfile() only works with .py files and not .pyc files. When BR2_PACKAGE_PYTHON{,3}_PYC_ONLY=y, the .py files are all removed, causing the OpenCV Python module to not work: File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 89, in <module> File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 58, in bootstrap File "usr/lib/python3.7/site-packages/cv2/__init__.py", line 56, in load_first_config ImportError: OpenCV loader: missing configuration file: ['config.py']. Check OpenCV installation. To fix this problem, this commit uses the newly introduced <pkg>_KEEP_PY_FILES mechanism, to ensure the important config*.py files are kept. Fixes: https://bugs.busybox.net/show_bug.cgi?id=12171 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> --- package/opencv3/opencv3.mk | 2 ++ 1 file changed, 2 insertions(+)