Wednesday, December 30, 2020

Re: opencv drop py2 (was Re: [update] Python 3.8.7)

On Wed Dec 30, 2020 at 01:21:54PM +0000, Stuart Henderson wrote:
> > > > > sadly this will break packaging for all python ports with shared
> > > > > libraries to the change they made for shared libraries :-(
> > > >
> > > > 3.9 will have the same in the next release.
> > > >
> > > > There are approx 178 ports to fix, they'll just need plist regen and
> > > > bumping (there is already an appropriate variable in python.port.mk).
> > > > I'm working on it.
>
> opencv currently has py2+py3 in a single package, using 2.7
> MODPY_VERSION and manually adding the 3.x parts. This makes it difficult
> to use python.port.mk infrastructure to handle the .so renaming.
>
> Is it OK to drop py2 support from opencv? Upstream say that it's
> deprecated, and nothing in ports is using it (only nomacs and digikam
> use opencv, and neither use Python).

I can confirm nothing in ports uses the opencv-python.

>
> A few other small tweaks to the Makefile to remove some things which
> are set by default anyway (ONLY_FOR_ARCHS is set based on COMPILER
> settings), use consistent .if for arch-specific things, move the
> bsd.port.arch.mk include to the point where it's needed (it has
> side-effects, easier to reason with if it affects a smaller number of
> lines), and fix a typo in COMMENT.

Thanks Stuart for taking care of it. The python part was on my 2021
list.

Package fine and digikam is still happy. OK rsadowski@

>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/graphics/opencv/Makefile,v
> retrieving revision 1.64
> diff -u -p -r1.64 Makefile
> --- Makefile 23 Dec 2020 18:33:05 -0000 1.64
> +++ Makefile 30 Dec 2020 13:16:24 -0000
> @@ -1,16 +1,16 @@
> # $OpenBSD: Makefile,v 1.64 2020/12/23 18:33:05 rsadowski Exp $
>
> -ONLY_FOR_ARCHS = ${GCC4_ARCHS} ${CLANG_ARCHS}
> ONLY_FOR_ARCHS-java = aarch64 amd64 i386
>
> CATEGORIES = graphics devel
> -COMMENT-main = library for computer vision real-time processin
> +COMMENT-main = library for computer vision real-time processing
> COMMENT-java = Java bindings for OpenCV
>
> V = 4.5.1
> GH_ACCOUNT = opencv
> GH_PROJECT = opencv
> GH_TAGNAME = ${V}
> +REVISION = 0
>
> PKGNAME-main = opencv-${V}
> PKGNAME-java = opencv-java-${V}
> @@ -19,8 +19,6 @@ HOMEPAGE = https://www.opencv.org/
>
> MAINTAINER = Rafael Sadowski <rsadowski@openbsd.org>
>
> -DISTFILES = opencv-{opencv/archive/}${V}${EXTRACT_SUFX}
> -
> .for i in opencv_calib3d opencv_core opencv_features2d \
> opencv_flann opencv_highgui opencv_imgproc opencv_ml opencv_objdetect \
> opencv_photo opencv_stitching opencv_video opencv_imgcodecs \
> @@ -47,18 +45,14 @@ FLAVOR ?=
> # BSDL
> PERMIT_PACKAGE = Yes
>
> -.include <bsd.port.arch.mk>
> -
> MODULES = devel/cmake \
> lang/python
> +MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3}
>
> -BUILD_DEPENDS = lang/python/${MODPY_DEFAULT_VERSION_3} \
> - math/eigen3 \
> - math/py-numpy \
> - math/py-numpy,python3
> +BUILD_DEPENDS = math/eigen3 \
> + math/py-numpy${MODPY_FLAVOR}
>
> -RUN_DEPENDS-main = math/py-numpy \
> - math/py-numpy,python3
> +RUN_DEPENDS-main = math/py-numpy${MODPY_FLAVOR}
>
> RUN_DEPENDS-java = ${MODJAVA_RUN_DEPENDS}
>
> @@ -77,7 +71,7 @@ LIB_DEPENDS-java = ${BUILD_PKGPATH},-mai
>
> # XXX PIE cannot be produced due to problems with inline assembly.
> # Since OpenCV is mostly used as a LIBrary, switch to PIC.
> -.if ${ARCH:Mi386}
> +.if ${MACHINE_ARCH:Mi386}
> CONFIGURE_ENV = CFLAGS="${CFLAGS} -fPIC" \
> CXXFLAGS="${CXXFLAGS} -fPIC"
> .endif
> @@ -96,8 +90,11 @@ CONFIGURE_ARGS = -DBUILD_DOCS=OFF \
> -DBUILD_ITT=OFF \
> -DBUILD_PERF_TESTS=OFF \
> -DBUILD_TESTS=OFF \
> + -DBUILD_opencv_python2=OFF \
> -DINSTALL_PYTHON_EXAMPLES=OFF \
> -DINSTALL_TESTS=OFF \
> + -DOPENCV_SKIP_PYTHON_WARNING=ON \
> + -DPYTHON_DEFAULT_EXECUTABLE=${MODPY_BIN} \
> -DWITH_1394=OFF \
> -DWITH_ADE=OFF \
> -DWITH_CUDA=OFF \
> @@ -107,6 +104,8 @@ CONFIGURE_ARGS = -DBUILD_DOCS=OFF \
> -DWITH_V4L=OFF \
> -DWITH_VTK=OFF
>
> +.include <bsd.port.arch.mk>
> +
> .if ${BUILD_PACKAGES:M-java}
> MODULES += java
> MODJAVA_VER = 1.8+
> @@ -120,8 +119,6 @@ CONFIG_ADJ_CMD = perl -pi
> .for _l _v in ${SHARED_LIBS}
> CONFIG_ADJ_CMD += -e 's,lib${_l}.so([^.]),lib${_l}.so.${_v}$$1,g;'
> .endfor
> -
> -SUBST_VARS += MODPY_DEFAULT_VERSION_3
>
> NO_TEST = Yes
> # Enable to run the regression tests
> Index: pkg/PLIST-java
> ===================================================================
> RCS file: /cvs/ports/graphics/opencv/pkg/PLIST-java,v
> retrieving revision 1.11
> diff -u -p -r1.11 PLIST-java
> --- pkg/PLIST-java 23 Dec 2020 18:33:05 -0000 1.11
> +++ pkg/PLIST-java 30 Dec 2020 13:16:24 -0000
> @@ -1,5 +1,5 @@
> @comment $OpenBSD: PLIST-java,v 1.11 2020/12/23 18:33:05 rsadowski Exp $
> share/java/
> share/java/opencv4/
> -share/java/opencv4/opencv-451.jar
> @so share/java/opencv4/libopencv_java451.so
> +share/java/opencv4/opencv-451.jar
> Index: pkg/PLIST-main
> ===================================================================
> RCS file: /cvs/ports/graphics/opencv/pkg/PLIST-main,v
> retrieving revision 1.14
> diff -u -p -r1.14 PLIST-main
> --- pkg/PLIST-main 23 Dec 2020 18:33:05 -0000 1.14
> +++ pkg/PLIST-main 30 Dec 2020 13:16:24 -0000
> @@ -286,25 +286,18 @@ lib/cmake/opencv4/OpenCVModules.cmake
> @lib lib/libopencv_videoio.so.${LIBopencv_videoio_VERSION}
> lib/python${MODPY_VERSION}/site-packages/cv2/
> lib/python${MODPY_VERSION}/site-packages/cv2/__init__.py
> -lib/python${MODPY_VERSION}/site-packages/cv2/__init__.pyc
> +${MODPY_COMMENT}lib/python${MODPY_VERSION}/site-packages/cv2/${MODPY_PYCACHE}/
> +lib/python${MODPY_VERSION}/site-packages/cv2/${MODPY_PYCACHE}__init__.${MODPY_PYC_MAGIC_TAG}pyc
> +lib/python${MODPY_VERSION}/site-packages/cv2/${MODPY_PYCACHE}config-${MODPY_VERSION}.${MODPY_PYC_MAGIC_TAG}pyc
> +lib/python${MODPY_VERSION}/site-packages/cv2/${MODPY_PYCACHE}config.${MODPY_PYC_MAGIC_TAG}pyc
> +lib/python${MODPY_VERSION}/site-packages/cv2/${MODPY_PYCACHE}load_config_py2.${MODPY_PYC_MAGIC_TAG}pyc
> +lib/python${MODPY_VERSION}/site-packages/cv2/${MODPY_PYCACHE}load_config_py3.${MODPY_PYC_MAGIC_TAG}pyc
> lib/python${MODPY_VERSION}/site-packages/cv2/config-${MODPY_VERSION}.py
> -lib/python${MODPY_VERSION}/site-packages/cv2/config-${MODPY_VERSION}.pyc
> lib/python${MODPY_VERSION}/site-packages/cv2/config.py
> -lib/python${MODPY_VERSION}/site-packages/cv2/config.pyc
> lib/python${MODPY_VERSION}/site-packages/cv2/load_config_py2.py
> -lib/python${MODPY_VERSION}/site-packages/cv2/load_config_py2.pyc
> lib/python${MODPY_VERSION}/site-packages/cv2/load_config_py3.py
> -lib/python${MODPY_VERSION}/site-packages/cv2/load_config_py3.pyc
> lib/python${MODPY_VERSION}/site-packages/cv2/python-${MODPY_VERSION}/
> @so lib/python${MODPY_VERSION}/site-packages/cv2/python-${MODPY_VERSION}/cv2.so
> -lib/python${MODPY_DEFAULT_VERSION_3}/site-packages/cv2/
> -lib/python${MODPY_DEFAULT_VERSION_3}/site-packages/cv2/__init__.py
> -lib/python${MODPY_DEFAULT_VERSION_3}/site-packages/cv2/config-${MODPY_DEFAULT_VERSION_3}.py
> -lib/python${MODPY_DEFAULT_VERSION_3}/site-packages/cv2/config.py
> -lib/python${MODPY_DEFAULT_VERSION_3}/site-packages/cv2/load_config_py2.py
> -lib/python${MODPY_DEFAULT_VERSION_3}/site-packages/cv2/load_config_py3.py
> -lib/python${MODPY_DEFAULT_VERSION_3}/site-packages/cv2/python-${MODPY_DEFAULT_VERSION_3}/
> -@so lib/python${MODPY_DEFAULT_VERSION_3}/site-packages/cv2/python-${MODPY_DEFAULT_VERSION_3}/cv2.so
> share/licenses/
> share/licenses/opencv4/
> share/licenses/opencv4/SoftFloat-COPYING.txt
>

No comments:

Post a Comment