diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index bd42944c..362001fb 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux_arm.yml' - '.github/workflows/build_wheels_windows*' @@ -39,7 +40,7 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 PLAT: x86_64 @@ -102,7 +103,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 with: - submodules: false + submodules: true fetch-depth: 0 - name: Setup Environment variables @@ -145,7 +146,7 @@ jobs: NP_TEST_DEP: numpy==1.19.4 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} @@ -176,7 +177,7 @@ jobs: set -x python -m pip install --upgrade pip python -m pip install scikit-build - python setup.py sdist + python setup.py sdist --formats=xztar set +x # Install and run tests set -x @@ -186,7 +187,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: wheels - path: dist/opencv*.tar.gz + path: dist/opencv*.tar.xz test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index a97bbc29..a892040b 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux.yml' - '.github/workflows/build_wheels_windows*' @@ -40,7 +41,7 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 0 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index c70f2b2d..c453ab85 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_windows*' @@ -137,6 +138,7 @@ jobs: CONFIG_PATH: travis_config.sh PLAT: x86_64 OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata + PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py steps: - name: Checkout @@ -171,6 +173,12 @@ jobs: cd ${{ github.workspace }}/opencv python modules/python/test/test.py -v --repo . + - name: Pylint test + run: | + python -m pip install pylint==2.12.2 + cd ${{ github.workspace }}/tests + python -m pylint $PYLINT_TEST_FILE + test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, test] diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 3711e1b3..1ac065f1 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_windows*' @@ -81,6 +82,7 @@ jobs: env: OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata + PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py steps: - name: Checkout @@ -106,6 +108,12 @@ jobs: cd ${{ github.workspace }}/opencv arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo . + - name: Pylint test + run: | + arch -arm64 python${{ matrix.python-version }} -m pip install pylint==2.12.2 + cd ${{ github.workspace }}/tests + arch -arm64 python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE + test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, test] diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 0262c7b8..0dad17b5 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_macos*' @@ -96,6 +97,7 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata + PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py steps: - name: Checkout @@ -130,6 +132,13 @@ jobs: python modules\python\test\test.py -v --repo . shell: cmd + - name: Pylint test + run: | + python -m pip install pylint==2.12.2 + cd ${{ github.workspace }}\tests + python -m pylint $PYLINT_TEST_FILE + shell: cmd + test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build-windows-x86_64, test] diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index b380d3ba..03889a51 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -2,29 +2,60 @@ FROM quay.io/pypa/manylinux2014_aarch64:latest ARG CCACHE_VERSION=3.7.9 ARG FFMPEG_VERSION=4.4.1 +ARG FREETYPE_VERSION=2.12.1 +ARG LIBPNG_VERSION=1.6.37 ARG NASM_VERSION=2.15.04 -ARG OPENSSL_VERSION=1_1_1m +ARG OPENSSL_VERSION=1_1_1o ARG QT_VERSION=5.15.0 ARG YASM_VERSION=1.3.0 -RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel freetype-devel -y +ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH + +# epel-release need for aarch64 to get openblas packages +RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \ + yum install openblas-devel -y && \ + cp /usr/include/lapacke/lapacke*.h /usr/include/ && \ + curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \ + # libpng will be built from source + yum remove libpng -y + +RUN mkdir ~/libpng_sources && \ + cd ~/libpng_sources && \ + curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \ + tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \ + cd libpng-${LIBPNG_VERSION} && \ + ./configure --prefix=/usr/local && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/libpng_sources + +RUN mkdir ~/freetype_sources && \ + cd ~/freetype_sources && \ + curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ + tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ + cd freetype-${FREETYPE_VERSION} && \ + ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/freetype_sources RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \ tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \ - cd qt-everywhere* && \ + cd qt-everywhere-src-${QT_VERSION} && \ export MAKEFLAGS=-j$(nproc) && \ ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \ make && \ make install && \ cd .. && \ - rm -rf qt-everywhere-src-${QT_VERSION} && \ - rm qt-everywhere-src-${QT_VERSION}.tar.xz + rm -rf qt-everywhere* ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" -RUN mkdir ~/ffmpeg_sources && \ - cd ~/ffmpeg_sources && \ +RUN mkdir ~/openssl_sources && \ + cd ~/openssl_sources && \ curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ cd openssl-OpenSSL_${OPENSSL_VERSION} && \ @@ -32,31 +63,42 @@ RUN mkdir ~/ffmpeg_sources && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ - rm -rf ~/openssl_build + cd .. && \ + rm -rf ~/openssl_build ~/openssl_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/nasm_sources && \ + cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/nasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/yasm_sources && \ + cd ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/yasm_sources -RUN cd ~/ffmpeg_sources && \ - git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ +RUN mkdir ~/libvpx_sources && \ + cd ~/libvpx_sources && \ + git clone --depth 1 https://github.com/webmproject/libvpx.git && \ cd libvpx && \ ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/libvpx_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/ffmpeg_sources && \ + cd ~/ffmpeg_sources && \ curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ @@ -66,14 +108,21 @@ RUN cd ~/ffmpeg_sources && \ make install && \ echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ - rm -rf ~/ffmpeg_sources + rm -rf ~/ffmpeg_sources && \ + yum remove bzip2-devel -y RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \ tar -xf ccache-${CCACHE_VERSION}.tar.gz && \ cd ccache-${CCACHE_VERSION} && \ linux32 ./configure && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ccache-${CCACHE_VERSION}.tar.gz + +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced +RUN mkdir /io && \ + git config --global --add safe.directory /io ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig ENV LDFLAGS -L/root/ffmpeg_build/lib diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64 index fb367c0a..13325756 100644 --- a/docker/manylinux2014/Dockerfile_x86_64 +++ b/docker/manylinux2014/Dockerfile_x86_64 @@ -1,29 +1,60 @@ FROM quay.io/pypa/manylinux2014_x86_64:latest ARG FFMPEG_VERSION=4.4.1 +ARG FREETYPE_VERSION=2.12.1 +ARG LIBPNG_VERSION=1.6.37 ARG NASM_VERSION=2.15.04 -ARG OPENSSL_VERSION=1_1_1m +ARG OPENSSL_VERSION=1_1_1o ARG QT_VERSION=5.15.0 ARG YASM_VERSION=1.3.0 -RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel freetype-devel -y +ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH + +# epel-release need for aarch64 to get openblas packages +RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \ + yum install openblas-devel -y && \ + cp /usr/include/lapacke/lapacke*.h /usr/include/ && \ + curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \ + # libpng will be built from source + yum remove libpng -y + +RUN mkdir ~/libpng_sources && \ + cd ~/libpng_sources && \ + curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \ + tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \ + cd libpng-${LIBPNG_VERSION} && \ + ./configure --prefix=/usr/local && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/libpng_sources + +RUN mkdir ~/freetype_sources && \ + cd ~/freetype_sources && \ + curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ + tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ + cd freetype-${FREETYPE_VERSION} && \ + ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/freetype_sources RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \ tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \ - cd qt-everywhere* && \ + cd qt-everywhere-src-${QT_VERSION} && \ export MAKEFLAGS=-j$(nproc) && \ ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \ make && \ make install && \ cd .. && \ - rm -rf qt-everywhere-src-${QT_VERSION} && \ - rm qt-everywhere-src-${QT_VERSION}.tar.xz + rm -rf qt-everywhere* ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" -RUN mkdir ~/ffmpeg_sources && \ - cd ~/ffmpeg_sources && \ +RUN mkdir ~/openssl_sources && \ + cd ~/openssl_sources && \ curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ cd openssl-OpenSSL_${OPENSSL_VERSION} && \ @@ -31,31 +62,42 @@ RUN mkdir ~/ffmpeg_sources && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ - rm -rf ~/openssl_build + cd .. && \ + rm -rf ~/openssl_build ~/openssl_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/nasm_sources && \ + cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/nasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/yasm_sources && \ + cd ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/yasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/libvpx_sources && \ + cd ~/libvpx_sources && \ git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ cd libvpx && \ ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/libvpx_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/ffmpeg_sources && \ + cd ~/ffmpeg_sources && \ curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ @@ -65,7 +107,12 @@ RUN cd ~/ffmpeg_sources && \ make install && \ echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ - rm -rf ~/ffmpeg_sources + rm -rf ~/ffmpeg_sources && \ + yum remove bzip2-devel -y + +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced +RUN mkdir /io && \ + git config --global --add safe.directory /io ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig ENV LDFLAGS -L/root/ffmpeg_build/lib diff --git a/pyproject.toml b/pyproject.toml index 6aaab1d3..ff535e86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [build-system] requires = [ - "setuptools", "wheel", "scikit-build", "cmake", "pip", + "setuptools==59.2.0", "wheel==0.37.0", "cmake>=3.1", "pip", + "scikit-build>=0.13.2", "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'", diff --git a/setup.py b/setup.py index 7c8dc2c5..613938ff 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ def main(): ) # https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode - x64 = sys.maxsize > 2 ** 32 + is64 = sys.maxsize > 2 ** 32 package_name = "opencv-python" @@ -88,7 +88,7 @@ def main(): # Path regexes with forward slashes relative to CMake install dir. rearrange_cmake_output_data = { "cv2": ( - [r"bin/opencv_ffmpeg\d{3,4}%s\.dll" % ("_64" if x64 else "")] + [r"bin/opencv_ffmpeg\d{3,4}%s\.dll" % ("_64" if is64 else "")] if os.name == "nt" else [] ) @@ -118,7 +118,7 @@ def main(): files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]} ci_cmake_generator = ( - ["-G", "Visual Studio 14" + (" Win64" if x64 else "")] + ["-G", "Visual Studio 14" + (" Win64" if is64 else "")] if os.name == "nt" else ["-G", "Unix Makefiles"] ) @@ -149,12 +149,17 @@ def main(): "-DBUILD_DOCS=OFF", "-DPYTHON3_LIMITED_API=ON", "-DBUILD_OPENEXR=ON", - "-DBUILD_PNG=ON", ] + ( + # CMake flags for windows/arm64 build + ["-DCMAKE_GENERATOR_PLATFORM=ARM64", + # Emulated cmake requires following flags to correctly detect + # target architecture for windows/arm64 build + "-DOPENCV_WORKAROUND_CMAKE_20989=ON", + "-DCMAKE_SYSTEM_PROCESSOR=ARM64"] + if platform.machine() == "ARM64" and sys.platform == "win32" # If it is not defined 'linker flags: /machine:X86' on Windows x64 - ["-DCMAKE_GENERATOR_PLATFORM=x64"] - if x64 and sys.platform == "win32" + else ["-DCMAKE_GENERATOR_PLATFORM=x64"] if is64 and sys.platform == "win32" else [] ) + ( @@ -174,7 +179,7 @@ def main(): "-DWITH_MSMF=OFF" ) # see: https://github.com/skvark/opencv-python/issues/263 - if sys.platform.startswith("linux") and not x64 and "bdist_wheel" in sys.argv: + if sys.platform.startswith("linux") and not is64 and "bdist_wheel" in sys.argv: subprocess.check_call("patch -p0 < patches/patchOpenEXR", shell=True) # OS-specific components during CI builds @@ -395,7 +400,8 @@ def _classify_installed_files_override( final_install_relpaths.append(new_install_relpath) del m, fslash_relpath, new_install_relpath else: - if not found: + # gapi can be missed if ADE was not downloaded (network issue) + if not found and "gapi" not in relpath_re: raise Exception("Not found: '%s'" % relpath_re) del r, found @@ -434,7 +440,7 @@ def _classify_installed_files_override( data_files, # To get around a check that prepends source dir to paths and breaks package detection code. cmake_source_dir="", - cmake_install_dir=cmake_install_reldir, + _cmake_install_dir=cmake_install_reldir, ) diff --git a/tests/pylintrc b/tests/pylintrc new file mode 100644 index 00000000..a3892018 --- /dev/null +++ b/tests/pylintrc @@ -0,0 +1,12 @@ +# Source: opencv/platforms/scripts/pylintrc + +[MESSAGES CONTROL] + +# Disable all to choose the Tests one by one +disable=all + +# Tests +enable=bad-indentation, # Used when an unexpected number of indentation’s tabulations or spaces has been found. + mixed-indentation, # Used when there are some mixed tabs and spaces in a module. + unnecessary-semicolon, # Used when a statement is ended by a semi-colon (”;”), which isn’t necessary. + unused-variable # Used when a variable is defined but not used. (Use _var to ignore var). diff --git a/travis_config.sh b/travis_config.sh index dfb656e8..366d35ad 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -98,11 +98,6 @@ function pre_build { if [ -n "$IS_OSX" ]; then brew install lapack - else - # epel-release need for aarch64 to get openblas packages - yum install -y lapack-devel epel-release && yum install -y openblas-devel - cp /usr/include/lapacke/lapacke*.h /usr/include/ - curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h fi if [ -n "$IS_OSX" ]; then @@ -141,37 +136,37 @@ function run_tests { PYTHON=python$PYTHON_VERSION - if [ -n "$IS_OSX" ]; then - echo "Running for OS X" - - cd ../tests - $PYTHON get_build_info.py - - cd ../opencv/ - export OPENCV_TEST_DATA_PATH=../opencv_extra/testdata - else - echo "Running for linux" - - if [ $PYTHON == "python3.6" ]; then - $PYTHON -m pip install -U numpy==1.19.4 - fi - cd /io/tests - $PYTHON get_build_info.py + echo "Running for linux" - cd /io/opencv - export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata + if [ $PYTHON == "python3.6" ]; then + $PYTHON -m pip install -U numpy==1.19.4 fi + cd /io/tests + $PYTHON get_build_info.py + + cd /io/opencv + export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata test_wheels + pylint_test } function test_wheels { - echo "Starting tests..." + echo "Starting OpenCV tests..." #Test package $PYTHON modules/python/test/test.py -v --repo . } +function pylint_test { + + echo "Starting Pylint tests..." + + $PYTHON -m pip install pylint==2.12.2 + cd /io/tests + $PYTHON -m pylint /io/opencv/samples/python/squares.py +} + export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' set -x