diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 7ff34a18..53e30c12 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*' @@ -23,7 +24,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] @@ -37,13 +38,12 @@ jobs: MB_PYTHON_VERSION: ${{ matrix.python-version }} TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} MB_ML_VER: 2014 - NP_TEST_DEP: numpy==1.19.4 - NP_TEST_DEP_LATEST: numpy==1.21.2 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 + PLAT: x86_64 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} @@ -59,25 +59,64 @@ jobs: if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Setup Environment variables - run: | - if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi - if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi - if [ "x64" == "${{ matrix.platform }}" ]; then echo "PLAT=x86_64" >> $GITHUB_ENV; fi - if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - - name: build + - name: Build a package run: source scripts/build.sh - - name: install and test - run: source scripts/install.sh - - - name: saving artifacts + - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/opencv*.whl + + test: + needs: [build] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + platform: [x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + MB_PYTHON_VERSION: ${{ matrix.python-version }} + NP_TEST_DEP: numpy==1.19.4 + NP_TEST_DEP_LATEST: numpy==1.21.2 + CONFIG_PATH: travis_config.sh + PLAT: x86_64 + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: false + fetch-depth: 0 + + - name: Setup Environment variables + run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi + + - name: Download a wheel accordingly to matrix + uses: actions/download-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/ + + - name: Package installation and run tests + run: source scripts/install.sh build_sdist: runs-on: ${{ matrix.os }} @@ -131,12 +170,7 @@ jobs: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Setup Environment variables - run: | - if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi - if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi - - - name: before install + - name: Build a package run: | set -e # Build and package @@ -157,7 +191,7 @@ jobs: test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build, build_sdist] + needs: [build, build_sdist, test] runs-on: ubuntu-latest environment: test-opencv-python-release defaults: @@ -176,7 +210,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build, build_sdist] + needs: [build, build_sdist, test] runs-on: ubuntu-latest environment: opencv-python-release defaults: diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index 89142a57..2c1b3e8f 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*' @@ -23,7 +24,7 @@ jobs: fail-fast: false matrix: os: [ARM64] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] @@ -38,12 +39,9 @@ jobs: TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} PLAT: aarch64 MB_ML_VER: 2014 - NP_TEST_DEP: numpy==1.19.4 - NP_TEST_DEP_LATEST: numpy==1.21.2 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} - DOCKER_TEST_IMAGE: multibuild/focal_arm64v8 USE_CCACHE: 0 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} @@ -61,26 +59,74 @@ jobs: submodules: false fetch-depth: 0 - - name: Setup Environment variables - run: | - if [ "ARM64" == "${{ matrix.os }}" ]; then echo "PLAT=aarch64" >> $GITHUB_ENV; fi - if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - - name: build + - name: Build a package run: source scripts/build.sh - - name: install and test - run: source scripts/install.sh - - - name: saving artifacts + - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/opencv*.whl + + test: + needs: [build_arm] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + os: [ARM64] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + platform: [x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + MB_PYTHON_VERSION: ${{ matrix.python-version }} + PLAT: aarch64 + NP_TEST_DEP: numpy==1.19.4 + NP_TEST_DEP_LATEST: numpy==1.21.4 + CONFIG_PATH: travis_config.sh + DOCKER_TEST_IMAGE: multibuild/focal_arm64v8 + UNICODE_WIDTH: 32 + + steps: + - name: Cleanup + if: always() + uses: AutoModality/action-clean@v1 + + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - name: Setup Environment variables + run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi + + - name: Download a wheel accordingly to matrix + uses: actions/download-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/ + + - name: Package installation and run tests + run: source scripts/install.sh + test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build_arm] + needs: [build_arm, test] runs-on: ubuntu-latest environment: test-opencv-python-release defaults: @@ -99,7 +145,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build_arm] + needs: [build_arm, test] runs-on: ubuntu-latest environment: opencv-python-release defaults: diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index d4f10be0..6af5357e 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*' @@ -23,7 +24,7 @@ jobs: fail-fast: false matrix: os: [macos-10.15, macos-11] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] @@ -48,14 +49,14 @@ jobs: MB_PYTHON_VERSION: ${{ matrix.python-version }} TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} MB_ML_VER: 2014 - NP_TEST_DEP: numpy==1.19.4 - NP_TEST_DEP_LATEST: numpy==1.21.2 TRAVIS_BUILD_DIR: ${{ github.workspace }} TRAVIS_OS_NAME: osx CONFIG_PATH: travis_config.sh DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 + PLAT: x86_64 + FFMPEG_FORMULA_VERSION: '@4' SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} @@ -71,15 +72,7 @@ jobs: if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Setup Environment variables - run: | - if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi - if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi - if [ "x64" == "${{ matrix.platform }}" ]; then echo "PLAT=x86_64" >> $GITHUB_ENV; fi - if [ "x86" == "${{ matrix.platform }}" ]; then echo "PLAT=i686" >> $GITHUB_ENV; fi - if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - - name: before install + - name: Build a package run: | set -e # Check out and prepare the source @@ -96,19 +89,92 @@ jobs: echo $ENABLE_HEADLESS > headless.enabled set -x build_wheel $REPO_DIR $PLAT - git submodule update --init --recursive - install_run $PLAT - set +x - - name: saving artifacts + - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/opencv*.whl + + test: + needs: [build] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + + strategy: + fail-fast: false + matrix: + os: [macos-10.15, macos-11] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + platform: [x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + exclude: + - os: macos-10.15 + python-version: '3.10' + - os: macos-11 + python-version: '3.6' + - os: macos-11 + python-version: '3.7' + - os: macos-11 + python-version: '3.8' + - os: macos-11 + python-version: '3.9' + + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + MB_PYTHON_VERSION: ${{ matrix.python-version }} + NP_TEST_DEP: numpy==1.19.4 + NP_TEST_DEP_LATEST: numpy==1.21.4 + CONFIG_PATH: travis_config.sh + PLAT: x86_64 + OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.platform }} + + - name: Setup Environment variables + run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi + + - name: Download a wheel accordingly to matrix + uses: actions/download-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/ + + - name: Package installation + run: | + python -m pip install wheelhouse/opencv*.whl + cd ${{ github.workspace }}/tests + python get_build_info.py + + - name: Run tests + run: | + cd ${{ github.workspace }}/opencv + python modules/python/test/test.py -v --repo . + test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build] + needs: [build, test] runs-on: ubuntu-latest environment: test-opencv-python-release defaults: @@ -127,7 +193,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build] + needs: [build, test] runs-on: ubuntu-latest environment: opencv-python-release defaults: diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 79164dcf..f25d26a7 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*' @@ -20,7 +21,7 @@ jobs: fail-fast: false matrix: os: [macOS-M1] - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] @@ -31,7 +32,6 @@ jobs: SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata steps: - name: Checkout @@ -44,36 +44,72 @@ jobs: if: github.event_name == 'pull_request' run: git submodule update --remote - - name: build script + - name: Build a package run: | git submodule update --init multibuild echo $ENABLE_CONTRIB > contrib.enabled echo $ENABLE_HEADLESS > headless.enabled export MACOSX_DEPLOYMENT_TARGET=11.0 - arch -arm64 python${{ matrix.python-version }} -m pip wheel --wheel-dir=wheelhouse . --verbose + arch -arm64 python${{ matrix.python-version }} -m pip install toml && python${{ matrix.python-version }} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${{ matrix.python-version }} -m pip install -r /dev/stdin + arch -arm64 python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v delocate-wheel ${{ github.workspace }}/wheelhouse/opencv* - - name: before test + - name: Saving all wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: wheelhouse/opencv*.whl + + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/opencv*.whl + + test: + needs: [build] + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [macOS-M1] + python-version: ['3.7', '3.8', '3.9', '3.10'] + platform: [x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + + env: + OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - name: Download a wheel accordingly to matrix + uses: actions/download-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/ + + - name: Package installation run: | - git submodule update --init --recursive arch -arm64 python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl cd ${{ github.workspace }}/tests arch -arm64 python${{ matrix.python-version }} get_build_info.py - - name: run test + - name: Run tests run: | cd ${{ github.workspace }}/opencv arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo . - - name: saving artifacts - uses: actions/upload-artifact@v2 - with: - name: wheels - path: wheelhouse/opencv*.whl - test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build] + needs: [build, test] runs-on: ubuntu-latest environment: test-opencv-python-release defaults: @@ -92,7 +128,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build] + needs: [build, test] runs-on: ubuntu-latest environment: opencv-python-release defaults: diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 3eb13086..e719280e 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*' @@ -21,8 +22,8 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest] - python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + os: [windows-2019] + python-version: ['3.6'] platform: [x86, x64] with_contrib: [0, 1] without_gui: [0, 1] @@ -53,40 +54,86 @@ jobs: architecture: ${{ matrix.platform }} - name: Setup MSBuild.exe - uses: warrenbuckley/Setup-MSBuild@v1 + uses: microsoft/setup-msbuild@v1.1 - - name: build script + - name: Build a package run: | python --version python -m pip install --upgrade pip python -m pip install --upgrade setuptools - set "CI_BUILD=1" && python -m pip wheel --wheel-dir=%cd%\wheelhouse . --verbose + python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt + set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp36 --dist-dir=%cd%\wheelhouse -v shell: cmd - - name: before test + - name: Saving all wheels + uses: actions/upload-artifact@v2 + with: + name: wheels + path: wheelhouse/opencv*.whl + + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }} + path: wheelhouse/opencv* + + test: + needs: [build-windows-x86_64] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: powershell + + strategy: + fail-fast: false + matrix: + os: [windows-2019] + python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] + platform: [x86, x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + fetch-depth: 0 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.platform }} + + - name: Download a wheel accordingly to matrix + uses: actions/download-artifact@v2 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }} + path: wheelhouse/ + + - name: Package installation run: | - git submodule update --init --recursive cd ${{ github.workspace }}/tests &python -m pip install --user --no-warn-script-location (ls "../wheelhouse/opencv*.whl") if ($LastExitCode -ne 0) {throw $LastExitCode} python get_build_info.py shell: powershell - - name: run test + - name: Run tests run: | cd ${{ github.workspace }}/opencv python modules\python\test\test.py -v --repo . shell: cmd - - name: saving artifacts - uses: actions/upload-artifact@v2 - with: - name: wheels - path: wheelhouse/opencv*.whl - test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build-windows-x86_64] + needs: [build-windows-x86_64, test] runs-on: ubuntu-latest environment: test-opencv-python-release defaults: @@ -105,7 +152,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build-windows-x86_64] + needs: [build-windows-x86_64, test] runs-on: ubuntu-latest environment: opencv-python-release defaults: diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index c76ccec4..b380d3ba 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -1,26 +1,33 @@ FROM quay.io/pypa/manylinux2014_aarch64:latest +ARG CCACHE_VERSION=3.7.9 +ARG FFMPEG_VERSION=4.4.1 +ARG NASM_VERSION=2.15.04 +ARG OPENSSL_VERSION=1_1_1m +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 -RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/5.15.0/single/qt-everywhere-src-5.15.0.tar.xz && \ - tar -xf qt-everywhere-src-5.15.0.tar.xz && \ +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* && \ export MAKEFLAGS=-j$(nproc) && \ - ./configure -prefix /opt/Qt5.15.0 -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 && \ + ./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-5.15.0 && \ - rm qt-everywhere-src-5.15.0.tar.xz + rm -rf qt-everywhere-src-${QT_VERSION} && \ + rm qt-everywhere-src-${QT_VERSION}.tar.xz -ENV QTDIR /opt/Qt5.15.0 +ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" RUN mkdir ~/ffmpeg_sources && \ cd ~/ffmpeg_sources && \ - curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz && \ - tar -xf OpenSSL_1_1_1g.tar.gz && \ - cd openssl-OpenSSL_1_1_1g && \ + 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} && \ ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation @@ -28,16 +35,16 @@ RUN mkdir ~/ffmpeg_sources && \ rm -rf ~/openssl_build RUN cd ~/ffmpeg_sources && \ - curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.15.04/nasm-2.15.04.tar.bz2 && \ - tar -xf nasm-2.15.04.tar.bz2 && cd nasm-2.15.04 && ./autogen.sh && \ + 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 RUN cd ~/ffmpeg_sources && \ - curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \ - tar -xf yasm-1.3.0.tar.gz && \ - cd yasm-1.3.0 && \ + 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 @@ -50,9 +57,9 @@ RUN cd ~/ffmpeg_sources && \ make install RUN cd ~/ffmpeg_sources && \ - curl -O -L https://ffmpeg.org/releases/ffmpeg-4.3.2.tar.bz2 && \ - tar -xf ffmpeg-4.3.2.tar.bz2 && \ - cd ffmpeg-4.3.2 && \ + curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ + tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ + cd ffmpeg-${FFMPEG_VERSION} && \ PATH=~/bin:$PATH && \ PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ @@ -61,9 +68,9 @@ RUN cd ~/ffmpeg_sources && \ ldconfig && \ rm -rf ~/ffmpeg_sources -RUN curl -O -L https://github.com/ccache/ccache/releases/download/v3.7.9/ccache-3.7.9.tar.gz && \ - tar -xf ccache-3.7.9.tar.gz && \ - cd ccache-3.7.9 && \ +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 diff --git a/docker/manylinux2014/Dockerfile_i686 b/docker/manylinux2014/Dockerfile_i686 index 6a60a073..3b866874 100644 --- a/docker/manylinux2014/Dockerfile_i686 +++ b/docker/manylinux2014/Dockerfile_i686 @@ -1,26 +1,34 @@ FROM quay.io/pypa/manylinux2014_i686:latest +ARG CCACHE_VERSION=3.7.9 +ARG CMAKE_VERSION=3.17.0 +ARG FFMPEG_VERSION=4.4.1 +ARG NASM_VERSION=2.15.04 +ARG OPENSSL_VERSION=1_1_1m +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 -RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/5.15.0/single/qt-everywhere-src-5.15.0.tar.xz && \ - tar -xf qt-everywhere-src-5.15.0.tar.xz && \ +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* && \ export MAKEFLAGS=-j$(nproc) && \ - ./configure -prefix /opt/Qt5.15.0 -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 && \ + ./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-5.15.0 && \ - rm qt-everywhere-src-5.15.0.tar.xz + rm -rf qt-everywhere-src-${QT_VERSION} && \ + rm qt-everywhere-src-${QT_VERSION}.tar.xz -ENV QTDIR /opt/Qt5.15.0 +ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" RUN mkdir ~/ffmpeg_sources && \ cd ~/ffmpeg_sources && \ - curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz && \ - tar -xf OpenSSL_1_1_1g.tar.gz && \ - cd openssl-OpenSSL_1_1_1g && \ + 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} && \ # in i686, ./config detects x64 in i686 container without linux32 # when run from "docker build" linux32 ./config --prefix="$HOME/ffmpeg_build" no-pinshared shared zlib && \ @@ -30,16 +38,16 @@ RUN mkdir ~/ffmpeg_sources && \ rm -rf ~/openssl_build RUN cd ~/ffmpeg_sources && \ - curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.15.04/nasm-2.15.04.tar.bz2 && \ - tar -xf nasm-2.15.04.tar.bz2 && cd nasm-2.15.04 && ./autogen.sh && \ + 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 && \ linux32 ./configure && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install RUN cd ~/ffmpeg_sources && \ - curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \ - tar -xf yasm-1.3.0.tar.gz && \ - cd yasm-1.3.0 && \ + 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} && \ linux32 ./configure && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install @@ -52,9 +60,9 @@ RUN cd ~/ffmpeg_sources && \ make install RUN cd ~/ffmpeg_sources && \ - curl -O -L https://ffmpeg.org/releases/ffmpeg-4.3.2.tar.bz2 && \ - tar -xf ffmpeg-4.3.2.tar.bz2 && \ - cd ffmpeg-4.3.2 && \ + curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ + tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ + cd ffmpeg-${FFMPEG_VERSION} && \ PATH=~/bin:$PATH && \ PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" linux32 ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ @@ -63,22 +71,22 @@ RUN cd ~/ffmpeg_sources && \ ldconfig && \ rm -rf ~/ffmpeg_sources -RUN curl -O -L https://github.com/ccache/ccache/releases/download/v3.7.9/ccache-3.7.9.tar.gz && \ - tar -xf ccache-3.7.9.tar.gz && \ - cd ccache-3.7.9 && \ +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 -RUN curl -O -L https://github.com/Kitware/CMake/releases/download/v3.17.0/cmake-3.17.0.tar.gz && \ - tar -xf cmake-3.17.0.tar.gz && \ - cd cmake-3.17.0 && \ +RUN curl -O -L https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz && \ + tar -xf cmake-${CMAKE_VERSION}.tar.gz && \ + cd cmake-${CMAKE_VERSION} && \ export MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN) && \ ./configure --system-curl && \ make && \ make install && \ cd .. && \ - rm -rf cmake-3.17.0* + rm -rf cmake-${CMAKE_VERSION}* 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 49622378..fb367c0a 100644 --- a/docker/manylinux2014/Dockerfile_x86_64 +++ b/docker/manylinux2014/Dockerfile_x86_64 @@ -1,26 +1,32 @@ FROM quay.io/pypa/manylinux2014_x86_64:latest +ARG FFMPEG_VERSION=4.4.1 +ARG NASM_VERSION=2.15.04 +ARG OPENSSL_VERSION=1_1_1m +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 -RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/5.15.0/single/qt-everywhere-src-5.15.0.tar.xz && \ - tar -xf qt-everywhere-src-5.15.0.tar.xz && \ +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* && \ export MAKEFLAGS=-j$(nproc) && \ - ./configure -prefix /opt/Qt5.15.0 -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 && \ + ./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-5.15.0 && \ - rm qt-everywhere-src-5.15.0.tar.xz + rm -rf qt-everywhere-src-${QT_VERSION} && \ + rm qt-everywhere-src-${QT_VERSION}.tar.xz -ENV QTDIR /opt/Qt5.15.0 +ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" RUN mkdir ~/ffmpeg_sources && \ cd ~/ffmpeg_sources && \ - curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_1_1_1g.tar.gz && \ - tar -xf OpenSSL_1_1_1g.tar.gz && \ - cd openssl-OpenSSL_1_1_1g && \ + 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} && \ ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation @@ -28,16 +34,16 @@ RUN mkdir ~/ffmpeg_sources && \ rm -rf ~/openssl_build RUN cd ~/ffmpeg_sources && \ - curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.15.04/nasm-2.15.04.tar.bz2 && \ - tar -xf nasm-2.15.04.tar.bz2 && cd nasm-2.15.04 && ./autogen.sh && \ + 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 RUN cd ~/ffmpeg_sources && \ - curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz && \ - tar -xf yasm-1.3.0.tar.gz && \ - cd yasm-1.3.0 && \ + 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 @@ -50,9 +56,9 @@ RUN cd ~/ffmpeg_sources && \ make install RUN cd ~/ffmpeg_sources && \ - curl -O -L https://ffmpeg.org/releases/ffmpeg-4.3.2.tar.bz2 && \ - tar -xf ffmpeg-4.3.2.tar.bz2 && \ - cd ffmpeg-4.3.2 && \ + curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ + tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ + cd ffmpeg-${FFMPEG_VERSION} && \ PATH=~/bin:$PATH && \ PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ diff --git a/opencv b/opencv index 4223495e..dad26339 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit 4223495e6cd67011f86b8ecd9be1fa105018f3b1 +Subproject commit dad26339a975b49cfb6c7dbe4bd5276c9dcb36e2 diff --git a/opencv_contrib b/opencv_contrib index 2bc3e1a1..49e8f123 160000 --- a/opencv_contrib +++ b/opencv_contrib @@ -1 +1 @@ -Subproject commit 2bc3e1a169afd2675ef68221176f32cc0ea5427a +Subproject commit 49e8f123ca08e76891856a1ecce491b62d08ba20 diff --git a/opencv_extra b/opencv_extra index 822ee112..37294e3c 160000 --- a/opencv_extra +++ b/opencv_extra @@ -1 +1 @@ -Subproject commit 822ee11240b969e98e20546663bc481a5e7089cc +Subproject commit 37294e3c876a72c992d4718b9bbfc8346b9e779a diff --git a/scripts/__init__.py b/scripts/config-override.py similarity index 90% rename from scripts/__init__.py rename to scripts/config-override.py index 587a42bf..1a828b93 100644 --- a/scripts/__init__.py +++ b/scripts/config-override.py @@ -1,6 +1,5 @@ -PYTHON_EXTENSIONS_PATHS = [ - LOADER_DIR -] + PYTHON_EXTENSIONS_PATHS +import os +import sys ci_and_not_headless = False @@ -22,3 +21,4 @@ os.environ["QT_QPA_FONTDIR"] = os.path.join( os.path.dirname(os.path.abspath(__file__)), "qt", "fonts" ) + diff --git a/scripts/init-override.py b/scripts/init-override.py new file mode 100644 index 00000000..b93eaa76 --- /dev/null +++ b/scripts/init-override.py @@ -0,0 +1,5 @@ +from . import data +from . import gapi +from . import mat_wrapper +from . import misc +from . import utils diff --git a/setup.py b/setup.py index a49fcc37..b6e14897 100644 --- a/setup.py +++ b/setup.py @@ -93,14 +93,6 @@ def main(): else [] ) + - # In Windows, in python/X.Y//; in Linux, in just python/X.Y/. - # Naming conventions vary so widely between versions and OSes - # had to give up on checking them. - [ - "python/cv2/python-%s.%s/cv2[^/]*%s" - % (sys.version_info[0], sys.version_info[1], re.escape(sysconfig.get_config_var("EXT_SUFFIX"))) - ] - + [ r"python/cv2/__init__.py" ] @@ -108,6 +100,14 @@ def main(): [ r"python/cv2/.*config.*.py" ], + # In Windows, in python/X.Y//; in Linux, in just python/X.Y/. + # Naming conventions vary so widely between versions and OSes + # had to give up on checking them. + os.path.join("cv2", "python-%s" % (sys.version_info[0])): + [ + r"python/cv2/python-%s/cv2.*" + % (sys.version_info[0]) + ], "cv2.data": [ # OPENCV_OTHER_INSTALL_PATH ("etc" if os.name == "nt" else "share/opencv4") + r"/haarcascades/.*\.xml" ], @@ -159,6 +159,9 @@ def main(): "-DBUILD_TESTS=OFF", "-DBUILD_PERF_TESTS=OFF", "-DBUILD_DOCS=OFF", + "-DPYTHON3_LIMITED_API=ON", + "-DBUILD_OPENEXR=ON", + "-DBUILD_PNG=ON", ] + ( # If it is not defined 'linker flags: /machine:X86' on Windows x64 @@ -366,30 +369,24 @@ def _classify_installed_files_override( print("Copying files from CMake output") - # lines for a proper work using pylint and an autocomplete in IDE - with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'r') as opencv_init: - opencv_init_lines = opencv_init.readlines() - extra_imports = ('\nfrom .cv2 import *\nfrom .cv2 import _registerMatType\nfrom . import mat_wrapper\nfrom . import gapi' - '\nfrom . import misc\nfrom . import utils\nfrom . import data\n') - free_line_after_imports = 6 - opencv_init_lines.insert(free_line_after_imports, extra_imports) - opencv_init_data = "" - for line in opencv_init_lines: - opencv_init_replacement = line.replace('importlib.import_module("cv2")', 'importlib.import_module("cv2.cv2")') - opencv_init_data = opencv_init_data + opencv_init_replacement - - with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'w') as opencv_final_init: - opencv_final_init.write(opencv_init_data) - - # add lines from the old __init__.py file to the config file - with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', '__init__.py'), 'r') as custom_init: - custom_init_data = custom_init.read() - with open('%spython/cv2/config-%s.%s.py' - % (cmake_install_dir, sys.version_info[0], sys.version_info[1]), 'w') as opencv_init_config: - opencv_init_config.write(custom_init_data) + # lines for a proper work using an autocomplete in IDE + with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', 'init-override.py'), 'r') as init_override: + init_override_data = init_override.read() + with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'a') as opencv_init: + opencv_init.write(init_override_data) + + # append extra environment for not headless packages + with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', 'config-override.py'), 'r') as config_override: + config_override_data = config_override.read() + with open(os.path.join(cmake_install_dir, 'python', 'cv2', 'config.py'), 'a') as opencv_config: + opencv_config.write(config_override_data) for package_name, relpaths_re in cls.package_paths_re.items(): - package_dest_reldir = package_name.replace(".", os.path.sep) + print(package_name, relpaths_re) + if package_name != os.path.join("cv2", "python-%s" % (sys.version_info[0])): + package_dest_reldir = package_name.replace(".", os.path.sep) + else: + package_dest_reldir = package_name for relpath_re in relpaths_re: found = False r = re.compile(relpath_re + "$") @@ -418,7 +415,10 @@ def _classify_installed_files_override( print("Copying files from non-default sourcetree locations") for package_name, paths in cls.files_outside_package.items(): - package_dest_reldir = package_name.replace(".", os.path.sep) + if package_name != os.path.join("cv2", "python-%s" % (sys.version_info[0])): + package_dest_reldir = package_name.replace(".", os.path.sep) + else: + package_dest_reldir = package_name for path in paths: new_install_relpath = os.path.join( package_dest_reldir, diff --git a/travis_config.sh b/travis_config.sh index 6d6cc06b..dfb656e8 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -14,7 +14,9 @@ function bdist_wheel_cmd { # copied from multibuild's common_utils.sh # add osx deployment target so it doesn't default to 10.6 local abs_wheelhouse=$1 - CI_BUILD=1 pip wheel --verbose --wheel-dir="$PWD/dist" . $BDIST_PARAMS + # install all required packages in pyproject.toml, because bdist_wheel does not do it + python${PYTHON_VERSION} -m pip install toml && python${PYTHON_VERSION} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${PYTHON_VERSION} -m pip install -r /dev/stdin + CI_BUILD=1 python${PYTHON_VERSION} setup.py bdist_wheel --py-limited-api=cp36 -v cp dist/*.whl $abs_wheelhouse if [ -z "$IS_OSX" ]; then # this path can be changed in the latest manylinux image @@ -22,8 +24,6 @@ function bdist_wheel_cmd { /opt/python/cp39-cp39/bin/python -m venv $TOOLS_PATH source $TOOLS_PATH/bin/activate python patch_auditwheel_whitelist.py - # to avoid issues with numpy wheels - rm /io/wheelhouse/numpy* deactivate fi if [ -n "$USE_CCACHE" -a -z "$BREW_BOOTSTRAP_MODE" ]; then ccache -s; fi @@ -50,7 +50,7 @@ if [ -n "$IS_OSX" ]; then function generate_ffmpeg_formula { local FF="ffmpeg" local LFF="ffmpeg_opencv" - local FF_FORMULA; FF_FORMULA=$(brew formula "$FF") + local FF_FORMULA; FF_FORMULA=$(brew formula "${FF}${FFMPEG_FORMULA_VERSION}") local LFF_FORMULA; LFF_FORMULA="$(dirname "$FF_FORMULA")/${LFF}.rb" local REGENERATE @@ -70,8 +70,9 @@ if [ -n "$IS_OSX" ]; then if [ -n "$REGENERATE" ]; then echo "Regenerating custom ffmpeg formula" # Bottle block syntax: https://docs.brew.sh/Bottles#bottle-dsl-domain-specific-language + # FfmpegAT4 is a class in ffmpeg@4 formula perl -wpe 'BEGIN {our ($found_blank, $bottle_block);} - if (/(^class )(Ffmpeg)(\s.*)/) {$_=$1.$2."Opencv".$3."\n"; next;} + if (/(^class )(FfmpegAT4)(\s.*)/) {$_=$1."FfmpegOpencv".$3."\n"; next;} if (!$found_blank && /^$/) {$_.="conflicts_with \"ffmpeg\"\n\n"; $found_blank=1; next;} if (!$bottle_block && /^\s*bottle do$/) { $bottle_block=1; next; } if ($bottle_block) { if (/^\s*end\s*$/) { $bottle_block=0} elsif (/^\s*sha256\s/) {$_=""} next; } @@ -111,34 +112,14 @@ function pre_build { CACHE_STAGE= export HOMEBREW_NO_AUTO_UPDATE=1 - #after the cache stage, all bottles and Homebrew metadata should be already cached locally - # if [ -n "$CACHE_STAGE" ]; then - # brew update - # generate_ffmpeg_formula - # brew_add_local_bottles - # fi - echo 'Installing FFmpeg' - # if [ -n "$CACHE_STAGE" ]; then - # brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; } - # else - brew update - generate_ffmpeg_formula - brew_add_local_bottles - # brew unlink python@2 - brew install --build-bottle ffmpeg_opencv - # fi - - # echo 'Installing qt5' - - # if [ -n "$CACHE_STAGE" ]; then - # echo "Qt5 has bottle, no caching needed" - # else - # brew switch qt 5.13.2 - # brew pin qt - # export PATH="/usr/local/opt/qt/bin:$PATH" - # fi + brew update + generate_ffmpeg_formula + brew_add_local_bottles + brew install --build-bottle ffmpeg_opencv + # It needs when we use not the latest ffmpeg formula + brew link ffmpeg_opencv if [ -n "$CACHE_STAGE" ]; then brew_go_bootstrap_mode 0