diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 526049ff..98ad3dc8 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*' @@ -14,21 +15,18 @@ on: jobs: build: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ubuntu-latest] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -37,64 +35,93 @@ jobs: MB_PYTHON_VERSION: ${{ matrix.python-version }} TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} MB_ML_VER: 2014 - NP_TEST_DEP: numpy==1.19.4 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT} - USE_CCACHE: 1 + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20220628 + USE_CCACHE: 0 UNICODE_WIDTH: 32 + PLAT: x86_64 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules 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 - echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV; - echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; - - - 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: ubuntu-20.04 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + 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: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} + - 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 build_sdist: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ubuntu-latest] python-version: [3.8] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [1] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -107,50 +134,41 @@ jobs: NP_TEST_DEP: numpy==1.19.4 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20220628 USE_CCACHE: 1 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui || 0 }} ENABLE_CONTRIB: ${{ matrix.with_contrib || 0 }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - 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 [ "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 - echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV; - echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; - - - name: before install + - name: Build a package run: | set -e # Build and package set -x python -m pip install --upgrade pip python -m pip install scikit-build - python setup.py sdist + python setup.py sdist --formats=gztar set +x # Install and run tests set -x echo "skipping tests because of sdist" - - name: saving artifacts uses: actions/upload-artifact@v2 with: @@ -159,8 +177,8 @@ jobs: test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease - needs: [build, build_sdist] - runs-on: ubuntu-latest + needs: [build, build_sdist, test] + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -170,7 +188,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -178,8 +195,8 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build, build_sdist] - runs-on: ubuntu-latest + needs: [build, build_sdist, test] + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -189,22 +206,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* wheelhouse/opencv-python-[^h]* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* wheelhouse/opencv-contrib-python-[^h]* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* wheelhouse/opencv-python-headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index d71db231..4d0c3daf 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*' @@ -14,21 +15,18 @@ on: jobs: build_arm: - runs-on: ${{ matrix.os }} + runs-on: opencv-cn-lin-arm64 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ARM64] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -38,50 +36,84 @@ jobs: TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} PLAT: aarch64 MB_ML_VER: 2014 - NP_TEST_DEP: numpy==1.19.4 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT} - DOCKER_TEST_IMAGE: multibuild/xenial_arm64v8 + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20220628 USE_CCACHE: 0 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: UID + run: id -u - name: Cleanup - if: always() - uses: AutoModality/action-clean@v1 - + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - - name: Setup Environment variables - run: | - if [ "ARM64" == "${{ matrix.os }}" ]; then echo "PLAT=aarch64" >> $GITHUB_ENV; fi - echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV; - echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; - - - 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: opencv-cn-lin-arm64 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + 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 + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} + - 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] - runs-on: ubuntu-latest + needs: [build_arm, test] + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -91,7 +123,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -99,8 +130,8 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build_arm] - runs-on: ubuntu-latest + needs: [build_arm, test] + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -110,22 +141,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index 5b2b8066..af892101 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*' @@ -18,17 +19,26 @@ jobs: defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [macos-latest] - python-version: [3.6, 3.7, 3.8, 3.9] + os: [macos-10.15, macos-11] + python-version: ['3.6'] 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 REPO_DIR: . @@ -37,45 +47,30 @@ jobs: MB_PYTHON_VERSION: ${{ matrix.python-version }} TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} MB_ML_VER: 2014 - NP_TEST_DEP: numpy==1.19.4 TRAVIS_BUILD_DIR: ${{ github.workspace }} + TRAVIS_OS_NAME: osx CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT} + 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 }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - if: ${{ 'macos-latest' == matrix.os }} - with: - python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.platform }} - - - name: Setup Environment variables - run: | - if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi - 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 - echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV; - echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; - - - name: before install + - name: Build a package run: | set -e # Check out and prepare the source @@ -92,20 +87,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 + PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py + steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} + - 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 . + - 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] - runs-on: ubuntu-latest + needs: [build, test] + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -115,7 +182,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -123,8 +189,8 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build] - runs-on: ubuntu-latest + needs: [build, test] + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -134,22 +200,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index d3018497..a1d7c924 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*' @@ -14,62 +15,99 @@ on: jobs: build: - runs-on: ${{ matrix.os }} - + runs-on: opencv-cn-mac-arm64 strategy: fail-fast: false matrix: - os: [macOS-M1] - python-version: [3.7, 3.8, 3.9] + python-version: ['3.7'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: + CI_BUILD: 1 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: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules 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 - - name: before test + 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: 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: opencv-cn-mac-arm64-tests + strategy: + fail-fast: false + matrix: + 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 + PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py + steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} + - 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 + - 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] - runs-on: ubuntu-latest + needs: [build, test] + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -87,8 +125,8 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build] - runs-on: ubuntu-latest + needs: [build, test] + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -98,7 +136,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 554f684c..087efc04 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*' @@ -13,81 +14,123 @@ on: jobs: build-windows-x86_64: - runs-on: ${{ matrix.os }} - defaults: - run: - shell: powershell - + runs-on: windows-2019 strategy: fail-fast: false matrix: - os: [windows-latest] - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: ['3.6'] platform: [x86, x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true 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: Cleanup + shell: bash + run: | + rm -rf ./* || true + rm -rf ./.??* || true + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Setup MSBuild.exe - uses: warrenbuckley/Setup-MSBuild@v1 - - - name: build script + uses: microsoft/setup-msbuild@v1.1 + - 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: 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* - - name: before test + test: + needs: [build-windows-x86_64] + runs-on: windows-2019 + defaults: + run: + shell: cmd + strategy: + fail-fast: false + matrix: + 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 + PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py + steps: + - name: Cleanup + shell: bash + run: | + rm -rf ./* || true + rm -rf ./.??* || true + working-directory: ${{ github.workspace }} + - 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 + - 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-windows-x86_64] - runs-on: ubuntu-latest + needs: [build-windows-x86_64, test] + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -97,7 +140,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -105,8 +147,8 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease - needs: [build-windows-x86_64] - runs-on: ubuntu-latest + needs: [build-windows-x86_64, test] + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -116,22 +158,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.gitmodules b/.gitmodules index 655467e8..7193d3b9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/opencv/opencv_contrib.git [submodule "multibuild"] path = multibuild - url = https://github.com/matthew-brett/multibuild.git + url = https://github.com/multi-build/multibuild.git [submodule "opencv_extra"] path = opencv_extra url = https://github.com/opencv/opencv_extra.git diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6ba06d4c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,410 +0,0 @@ -env: - global: - - "PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'" - # pip dependencies to _test_ your project - - TEST_DEPENDS="numpy==1.11.1" - # params to bdist_wheel. used to set osx build target. - - CONFIG_PATH="travis_config.sh" - - USE_CCACHE=1 - - UNICODE_WIDTH=32 - - SDIST=0 - -# Save some time, we and setup check them out on demand instead -# https://docs.travis-ci.com/user/customizing-the-build/#Git-Clone-Depth -git: - submodules: false - -# https://docs.travis-ci.com/user/caching -cache: - directories: - # `cache: ccache: true` has no effect if `language:` is not `c` or `cpp` - - $HOME/.ccache - -# Add more cache stages (s2 etc) and corresponding OSX jobs like s1 -# if brew builds start to take longer than one Travis time limit -stages: - - final - -jobs: - fast_finish: true - # Travis exclude is buggy, this seems to be the only way to disable default build - exclude: - - language: ruby - include: - # default builds for Linux - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - # headless builds for Linux - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - # contrib builds for Linux - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - - # headless contrib builds for Linux - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - os: linux - arch: arm64 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=aarch64 - - DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - -# The first line is printed in the folding header in Travis output -before_install: | - set -e - - if [[ $SDIST == 0 ]]; then - # Check out and prepare the source - # Multibuild doesn't have releases, so --depth would break eventually (see - # https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised) - git submodule update --init multibuild - - source multibuild/common_utils.sh - - # https://github.com/matthew-brett/multibuild/issues/116 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi - - source multibuild/travis_steps.sh - # This sets -x - - source travis_multibuild_customize.sh - echo $ENABLE_CONTRIB > contrib.enabled - echo $ENABLE_HEADLESS > headless.enabled - - echo "end" - # Not interested in travis internal scripts' output - fi - - set +x - -install: | - # Build and package - set -x - - if [[ $SDIST == 1 ]]; then - python -m pip install --upgrade pip - python -m pip install scikit-build - python setup.py sdist - else - build_wheel $REPO_DIR $PLAT - fi - - set +x - -script: | - # Install and run tests - set -x - if [[ $SDIST == 1 ]]; then - echo "skipping tests because of sdist" - else - install_run $PLAT && rc=$? || rc=$? - fi - - set +x - - #otherwise, Travis logic terminates prematurely - #https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817 - trap ERR - test "$rc" -eq 0 - -after_success: | - # Upload wheels to pypi if tag is set - - set -x - - if [ -n "$TRAVIS_TAG" ]; then - - if [[ $ENABLE_CONTRIB == 0 ]]; then - if [[ $ENABLE_HEADLESS == 0 ]]; then - echo "This is default build. Deployment will be done to to PyPI entry opencv-python." - else - echo "This is headless contrib build. Deployment will be done to to PyPI entry opencv-python-headless." - fi - else - if [[ $ENABLE_HEADLESS == 0 ]]; then - echo "This is contrib build. Deployment will be done to to PyPI entry opencv-contrib-python." - else - echo "This is headless contrib build. Deployment will be done to to PyPI entry opencv-contrib-python-headless." - fi - fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - if [[ $SDIST == 1 ]]; then - pip install twine - twine upload -u ${PYPI_USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist/opencv* - else - pip install --user twine - pip install --user --upgrade six - twine upload -u ${PYPI_USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv* - fi - - fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then - # macpython 3.5 doesn't support recent TLS protocols which causes twine - # upload to fail, so we use the system Python to run twine - /usr/bin/python -m ensurepip --user - /usr/bin/python -m pip install --user -U pip - /usr/bin/python -m pip install --user -U -I twine - - if [[ $SDIST == 1 ]]; then - /usr/bin/python -m twine upload -u ${PYPI_USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist/opencv* - else - /usr/bin/python -m twine upload -u ${PYPI_USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv* - fi - - fi - - fi - - # # Save to Azure storage always - - # if [[ $TRAVIS_CPU_ARCH != "arm64" ]]; then - # if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then - # curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash - # else - # brew install azure-cli - # fi - - # az storage container create -n ${TRAVIS_COMMIT} --public-access blob - - # if [[ $SDIST == 1 ]]; then - # az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/dist --pattern *.gz - # else - # az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern opencv*.whl - # fi - # fi - - set +x - diff --git a/LICENSE-3RD-PARTY.txt b/LICENSE-3RD-PARTY.txt index 20f4fb37..caeffe51 100644 --- a/LICENSE-3RD-PARTY.txt +++ b/LICENSE-3RD-PARTY.txt @@ -1000,7 +1000,7 @@ This license applies to above binaries in the directory cv2/. * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions + * the following conditions are adhered to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms @@ -1025,7 +1025,7 @@ This license applies to above binaries in the directory cv2/. * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library + * The word 'cryptographic' can be left out if the routines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: @@ -1043,7 +1043,7 @@ This license applies to above binaries in the directory cv2/. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * The licence and distribution terms for any publically available version or + * The licence and distribution terms for any publicly available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] diff --git a/MANIFEST.in b/MANIFEST.in index 45cb6c40..b429eae0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,3 +9,4 @@ recursive-include docker * recursive-include opencv * recursive-include opencv_contrib * recursive-include patches * +recursive-include scripts *.py diff --git a/README.md b/README.md index 9629aae0..d60fcdf2 100644 --- a/README.md +++ b/README.md @@ -65,9 +65,9 @@ If you still encounter the error after you have checked all the previous solutio A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages). -**Q: Function foo() or method bar() returns wrong result, throws exception or crashes interpriter. What should I do?** +**Q: Function foo() or method bar() returns wrong result, throws exception or crashes interpreter. What should I do?** -A: The repository contains only OpenCV-Python package build scripts, but not OpenCV itself. Python bindings for OpenCV are developed in official OpenCV repository and it's the best place to report issues. Also please check {OpenCV wiki](https://github.com/opencv/opencv/wiki) and [the fficial OpenCV forum](https://forum.opencv.org/) before file new bugs. +A: The repository contains only OpenCV-Python package build scripts, but not OpenCV itself. Python bindings for OpenCV are developed in official OpenCV repository and it's the best place to report issues. Also please check {OpenCV wiki](https://github.com/opencv/opencv/wiki) and [the official OpenCV forum](https://forum.opencv.org/) before file new bugs. **Q: Why the packages do not include non-free algorithms?** @@ -79,15 +79,16 @@ A: It's easier for users to understand ``opencv-python`` than ``cv2`` and it mak ## Documentation for opencv-python -[![AppVeyor CI test status (Windows)](https://img.shields.io/appveyor/ci/skvark/opencv-python.svg?maxAge=3600&label=Windows)](https://ci.appveyor.com/project/skvark/opencv-python) -[![Travis CI test status (Linux and macOS)](https://img.shields.io/travis/com/skvark/opencv-python/master?label=Linux%20%26%20macOS)](https://travis-ci.com/github/skvark/opencv-python/) +[![Windows Build Status](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_windows.yml/badge.svg)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_windows.yml) +[![(Linux Build status)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_linux.yml/badge.svg)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_linux.yml) +[![(Mac OS Build status)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_macos.yml/badge.svg)](https://github.com/opencv/opencv-python/actions/workflows/build_wheels_macos.yml) The aim of this repository is to provide means to package each new [OpenCV release](https://github.com/opencv/opencv/releases) for the most used Python versions and platforms. ### CI build process The project is structured like a normal Python package with a standard ``setup.py`` file. -The build process for a single entry in the build matrices is as follows (see for example ``appveyor.yml`` file): +The build process for a single entry in the build matrices is as follows (see for example `.github/workflows/build_wheels_linux.yml` file): 0. In Linux and MacOS build: get OpenCV's optional C dependencies that we compile against @@ -181,7 +182,7 @@ Third party package licenses are at [LICENSE-3RD-PARTY.txt](https://github.com/o All wheels ship with [FFmpeg](http://ffmpeg.org) licensed under the [LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html). -Non-headless Linux and MacOS wheels ship with [Qt 5](http://doc.qt.io/qt-5/lgpl.html) licensed under the [LGPLv3](http://www.gnu.org/licenses/lgpl-3.0.html). +Non-headless Linux wheels ship with [Qt 5](http://doc.qt.io/qt-5/lgpl.html) licensed under the [LGPLv3](http://www.gnu.org/licenses/lgpl-3.0.html). The packages include also other binaries. Full list of licenses can be found from [LICENSE-3RD-PARTY.txt](https://github.com/opencv/opencv-python/blob/master/LICENSE-3RD-PARTY.txt). @@ -219,6 +220,7 @@ Python 3.x compatible pre-built wheels are provided for the officially supported - 3.7 - 3.8 - 3.9 +- 3.10 ### Backward compatibility diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index c79e7de4..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,201 +0,0 @@ -environment: - USER: - secure: fXgF9uyy6sT0JoVOR7BoqA== - - PASS: - secure: 0bXSOVjf9x8L7nErTivu92TF1FwNosTjFJQPmxp8Dys= - - matrix: - - PYTHON: "C:\\Python36" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python36-x64" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python37" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python37-x64" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python38" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python38-x64" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python39" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python39-x64" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python36" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python36-x64" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python37" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python37-x64" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python38" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python38-x64" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python39" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python39-x64" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 0 - - - PYTHON: "C:\\Python36" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python36-x64" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python37" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python37-x64" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python38" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python38-x64" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python39" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python39-x64" - ENABLE_CONTRIB: 0 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python36" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python36-x64" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python37" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python37-x64" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python38" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python38-x64" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python39" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 1 - - - PYTHON: "C:\\Python39-x64" - ENABLE_CONTRIB: 1 - ENABLE_HEADLESS: 1 - -matrix: - fast_finish: true - -install: - - ps: | - if (-not (Test-Path $env:PYTHON)) { - curl -o install_python.ps1 https://raw.githubusercontent.com/matthew-brett/multibuild/devel/install_python.ps1 - .\install_python.ps1 - } - - ps: if (-not (Test-Path $env:PYTHON)) { throw "No $env:PYTHON" } - - "set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - python --version - -build_script: -- cmd: | - "%PYTHON%\\python.exe" -m pip install --upgrade pip - "%PYTHON%\\python.exe" -m pip install --upgrade setuptools - set "CI_BUILD=1" && "%PYTHON%\\python.exe" -m pip wheel --wheel-dir=%cd%\dist . --verbose - -before_test: -- ps: | - - cd ${Env:APPVEYOR_BUILD_FOLDER}\tests - $env:PYTHONWARNINGS = "ignore:::pip._internal.cli.base_command" - &"${Env:PYTHON}\\python.exe" -m pip install --user --no-warn-script-location (ls "../dist/opencv_*.whl") - if ($LastExitCode -ne 0) {throw $LastExitCode} - -test_script: -- cmd: | - - cd %APPVEYOR_BUILD_FOLDER%\tests - "%PYTHON%\\python.exe" -m unittest test - -artifacts: -- path: dist\opencv*.whl - name: wheels - -deploy_script: -- ps: | - - if (${Env:APPVEYOR_REPO_TAG} -eq "true") { - cd ${Env:APPVEYOR_BUILD_FOLDER} - if (${Env:ENABLE_CONTRIB} -eq 0) { - if (${Env:ENABLE_HEADLESS} -eq 0) { - echo "This is a default build. Deployment will be done to PyPI entry opencv-python." - } - else { - echo "This is a headless build. Deployment will be done to PyPI entry opencv-python-headless." - } - } - else { - if (${Env:ENABLE_HEADLESS} -eq 0) { - echo "This is a contrib build. Deployment will be done to PyPI entry opencv-contrib-python." - } - else { - echo "This is a headless contrib build. Deployment will be done to PyPI entry opencv-contrib-python-headless." - } - } - - &"${Env:PYTHON}\\python.exe" -m pip install twine - &"${Env:PYTHON}\\python.exe" -m twine upload -u ${Env:USER} -p ${Env:PASS} --skip-existing dist/opencv* - } - else { - echo "Tag not set, deployment skipped." - } diff --git a/cv2/__init__.py b/cv2/__init__.py index 0c080d52..e69de29b 100644 --- a/cv2/__init__.py +++ b/cv2/__init__.py @@ -1,31 +0,0 @@ -import importlib -import os -import sys - -from .cv2 import * -from .data import * - -# wildcard import above does not import "private" variables like __version__ -# this makes them available -globals().update(importlib.import_module("cv2.cv2").__dict__) - -ci_and_not_headless = False - -try: - from .version import ci_build, headless - - ci_and_not_headless = ci_build and not headless -except: - pass - -# the Qt plugin is included currently only in the pre-built wheels -if sys.platform.startswith("linux") and ci_and_not_headless: - os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = os.path.join( - os.path.dirname(os.path.abspath(__file__)), "qt", "plugins" - ) - -# Qt will throw warning on Linux if fonts are not found -if sys.platform.startswith("linux") and ci_and_not_headless: - os.environ["QT_QPA_FONTDIR"] = os.path.join( - os.path.dirname(os.path.abspath(__file__)), "qt", "fonts" - ) diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index e8920770..2679cbbf 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -1,73 +1,142 @@ +# Version: 20220628 +# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64 + FROM quay.io/pypa/manylinux2014_aarch64:latest -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 +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_1o +ARG QT_VERSION=5.15.0 +ARG YASM_VERSION=1.3.0 + +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="/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/5.15.0/single/qt-everywhere-src-5.15.0.tar.xz && \ - tar -xf qt-everywhere-src-5.15.0.tar.xz && \ - cd qt-everywhere* && \ +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-src-${QT_VERSION} && \ 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* -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 && \ - ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ +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} && \ + ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \ 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 && \ - curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.14.01/nasm-2.14.01.tar.bz2 && \ - tar -xf nasm-2.14.01.tar.bz2 && cd nasm-2.14.01 && ./autogen.sh && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ +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="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/nasm_sources -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 && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ +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="/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 && \ + ./configure --prefix="/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 && \ - curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \ - tar -xf ffmpeg-snapshot.tar.bz2 && \ - cd ffmpeg && \ +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} && \ 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" && \ + PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ - echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ + echo "/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/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 + make install && \ + cd .. && \ + rm -rf ccache-${CCACHE_VERSION}.tar.gz + +# Self-hosted runner UID is 1004 +RUN useradd ci -m -s /bin/bash -G users --uid=1004 && \ + mkdir /io && \ + chown -R ci:ci /io && \ + # This needs to find ffmpeg packages from ci user + chown -R ci:ci /ffmpeg_build && \ + # This calls in mutlibuild scripts and cannot be run without permissions + chown -R ci:ci /opt/_internal/pipx/venvs/auditwheel + +USER ci + +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced +RUN 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 +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/ffmpeg_build/lib/pkgconfig +ENV LDFLAGS -L/ffmpeg_build/lib ENV PATH "$HOME/bin:$PATH" diff --git a/docker/manylinux2014/Dockerfile_i686 b/docker/manylinux2014/Dockerfile_i686 index 39fc1560..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.14.01/nasm-2.14.01.tar.bz2 && \ - tar -xf nasm-2.14.01.tar.bz2 && cd nasm-2.14.01 && ./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-snapshot.tar.bz2 && \ - tar -xf ffmpeg-snapshot.tar.bz2 && \ - cd ffmpeg && \ + 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 010120ca..8bb77341 100644 --- a/docker/manylinux2014/Dockerfile_x86_64 +++ b/docker/manylinux2014/Dockerfile_x86_64 @@ -1,66 +1,142 @@ +# Version: 20220628 +# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64 + FROM quay.io/pypa/manylinux2014_x86_64:latest -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 +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_1o +ARG QT_VERSION=5.15.0 +ARG YASM_VERSION=1.3.0 + +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 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 && \ - cd qt-everywhere* && \ +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="/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-src-${QT_VERSION} && \ 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* -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 && \ - ./config --prefix="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ +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} && \ + ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \ 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 && \ - curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.14.01/nasm-2.14.01.tar.bz2 && \ - tar -xf nasm-2.14.01.tar.bz2 && cd nasm-2.14.01 && ./autogen.sh && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ +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="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/nasm_sources -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 && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ +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="/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 && \ + ./configure --prefix="/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 && \ - curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \ - tar -xf ffmpeg-snapshot.tar.bz2 && \ - cd ffmpeg && \ +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} && \ 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" && \ + PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ - echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ + echo "/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} && \ + ./configure && \ + make -j$(getconf _NPROCESSORS_ONLN) && \ + make install && \ + cd .. && \ + rm -rf ccache-${CCACHE_VERSION}.tar.gz + +# GitHub Actions user`s UID is 1001 +RUN useradd ci -m -s /bin/bash -G users --uid=1001 && \ + mkdir /io && \ + chown -R ci:ci /io && \ + # This needs to find ffmpeg packages from ci user + chown -R ci:ci /ffmpeg_build && \ + # This calls in mutlibuild scripts and cannot be run without permissions + chown -R ci:ci /opt/_internal/pipx/venvs/auditwheel + +USER ci + +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced +RUN 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 +ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/ffmpeg_build/lib/pkgconfig +ENV LDFLAGS -L/ffmpeg_build/lib ENV PATH "$HOME/bin:$PATH" diff --git a/multibuild b/multibuild index 8882150d..bce1637e 160000 --- a/multibuild +++ b/multibuild @@ -1 +1 @@ -Subproject commit 8882150df6529658700b66bec124dfb77eefca26 +Subproject commit bce1637e202cb52b0e7ea42baa1cccc894b82806 diff --git a/opencv b/opencv index ad6e8294..b0dc4741 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit ad6e82942b37be8ee2c71c1d9bc7fe79cd16f7ab +Subproject commit b0dc474160e389b9c9045da5db49d03ae17c6a6b diff --git a/opencv_contrib b/opencv_contrib index d5317d62..db16caf6 160000 --- a/opencv_contrib +++ b/opencv_contrib @@ -1 +1 @@ -Subproject commit d5317d6297a8129b66dba1a1f7cc784e94639da9 +Subproject commit db16caf6ceee76b43b94c846be276e92a43e9700 diff --git a/opencv_extra b/opencv_extra index d5c7212d..936854e2 160000 --- a/opencv_extra +++ b/opencv_extra @@ -1 +1 @@ -Subproject commit d5c7212d53f097c9fdf5e72c598ad051660599e8 +Subproject commit 936854e2b666853d6d0732a8eabc2d699f4fa3d8 diff --git a/patch_auditwheel_whitelist.py b/patch_auditwheel_whitelist.py index d0cbf5b2..b32da17a 100644 --- a/patch_auditwheel_whitelist.py +++ b/patch_auditwheel_whitelist.py @@ -5,12 +5,11 @@ policies = None -with open(join(dirname(abspath(policy.__file__)), "policy.json")) as f: +with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json")) as f: policies = json.load(f) for p in policies: - if p["name"] == "manylinux2014": - p["lib_whitelist"].append("libxcb.so.1") + p["lib_whitelist"].append("libxcb.so.1") -with open(join(dirname(abspath(policy.__file__)), "policy.json"), "w") as f: +with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json"), "w") as f: f.write(json.dumps(policies)) diff --git a/patches/patchQtPlugins b/patches/patchQtPlugins index 03560f17..a05a5f83 100644 --- a/patches/patchQtPlugins +++ b/patches/patchQtPlugins @@ -3,9 +3,8 @@ index 4c0b3880fc..dffa0a4caa 100644 --- a/opencv/CMakeLists.txt +++ b/opencv/CMakeLists.txt @@ -1187,6 +1187,13 @@ if(WITH_QT OR HAVE_QT) - if(HAVE_QT5) - status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})") - status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO) + if(HAVE_QT) + status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})") + if(APPLE) + install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt) + endif() @@ -13,6 +12,14 @@ index 4c0b3880fc..dffa0a4caa 100644 + install(DIRECTORY /opt/Qt5.15.0/plugins DESTINATION lib/qt) + install(DIRECTORY /usr/share/fonts DESTINATION lib/qt) + endif() - elseif(HAVE_QT) - status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})") - status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO) + if(HAVE_QT_OPENGL) + if(Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES) + status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES} ${Qt${QT_VERSION_MAJOR}OpenGL_VERSION_STRING})" ELSE NO) + else() + status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO) + endif() + else() + status(" QT OpenGL support:" "NO") + endif() + else() + status(" QT:" "NO") diff --git a/pyproject.toml b/pyproject.toml index 5a2849f3..ff535e86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,12 @@ [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.19.3; python_version>='3.6' and sys_platform == 'linux' and platform_machine == 'aarch64'", - "numpy==1.21.0; python_version>='3.6' and sys_platform == 'darwin' 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'", - "numpy==1.19.3; python_version>='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'" + "numpy==1.19.3; python_version<='3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'", + "numpy==1.21.0; python_version<='3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'", + "numpy==1.19.3; python_version=='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'", + "numpy==1.21.2; python_version>='3.10'" ] diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 00000000..587a42bf --- /dev/null +++ b/scripts/__init__.py @@ -0,0 +1,24 @@ +PYTHON_EXTENSIONS_PATHS = [ + LOADER_DIR +] + PYTHON_EXTENSIONS_PATHS + +ci_and_not_headless = False + +try: + from .version import ci_build, headless + + ci_and_not_headless = ci_build and not headless +except: + pass + +# the Qt plugin is included currently only in the pre-built wheels +if sys.platform.startswith("linux") and ci_and_not_headless: + os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "qt", "plugins" + ) + +# Qt will throw warning on Linux if fonts are not found +if sys.platform.startswith("linux") and ci_and_not_headless: + os.environ["QT_QPA_FONTDIR"] = os.path.join( + os.path.dirname(os.path.abspath(__file__)), "qt", "fonts" + ) diff --git a/setup.py b/setup.py index 612a080c..11014d6b 100644 --- a/setup.py +++ b/setup.py @@ -22,24 +22,15 @@ def main(): build_headless = get_build_env_var_by_name("headless") build_java = "ON" if get_build_env_var_by_name("java") else "OFF" - if sys.version_info[:2] >= (3, 6): - minimum_supported_numpy = "1.13.3" - if sys.version_info[:2] >= (3, 7): - minimum_supported_numpy = "1.14.5" - if sys.version_info[:2] >= (3, 8): - minimum_supported_numpy = "1.17.3" - if sys.version_info[:2] >= (3, 9): - minimum_supported_numpy = "1.19.3" - - # linux arm64 is a special case - if sys.platform.startswith("linux") and sys.version_info[:2] >= (3, 6) and platform.machine() == "aarch64": - minimum_supported_numpy = "1.19.3" - - # macos arm64 is a special case - if sys.platform == "darwin" and sys.version_info[:2] >= (3, 6) and platform.machine() == "arm64": - minimum_supported_numpy = "1.21.0" - - numpy_version = "numpy>=%s" % minimum_supported_numpy + install_requires = [ + 'numpy>=1.13.3; python_version<"3.7"', + 'numpy>=1.14.5; python_version>="3.7"', + 'numpy>=1.17.3; python_version>="3.8"', + 'numpy>=1.19.3; python_version>="3.9"', + 'numpy>=1.21.2; python_version>="3.10"', + 'numpy>=1.19.3; python_version>="3.6" and platform_system=="Linux" and platform_machine=="aarch64"', + 'numpy>=1.21.2; python_version>="3.6" and platform_system=="Darwin" and platform_machine=="arm64"', + ] python_version = cmaker.CMaker.get_python_version() python_lib_path = cmaker.CMaker.get_python_library(python_version).replace( @@ -69,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" @@ -97,7 +88,7 @@ def main(): # Path regexes with forward slashes relative to CMake install dir. rearrange_cmake_output_data = { "cv2": ( - [r"bin/opencv_videoio_ffmpeg\d{3}%s\.dll" % ("_64" if x64 else "")] + [r"bin/opencv_videoio_ffmpeg\d{3}%s\.dll" % ("_64" if is64 else "")] if os.name == "nt" else [] ) @@ -106,12 +97,32 @@ def main(): # Naming conventions vary so widely between versions and OSes # had to give up on checking them. [ - "python/cv2[^/]*%(ext)s" - % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))} + r"python/cv2/python-%s/cv2.*" + % (sys.version_info[0]) + ] + + + [ + r"python/cv2/__init__.py" + ] + + + [ + r"python/cv2/.*config.*.py" ], "cv2.data": [ # OPENCV_OTHER_INSTALL_PATH ("etc" if os.name == "nt" else "share/opencv4") + r"/haarcascades/.*\.xml" ], + "cv2.gapi": [ + "python/cv2" + r"/gapi/.*\.py" + ], + "cv2.mat_wrapper": [ + "python/cv2" + r"/mat_wrapper/.*\.py" + ], + "cv2.misc": [ + "python/cv2" + r"/misc/.*\.py" + ], + "cv2.utils": [ + "python/cv2" + r"/utils/.*\.py" + ], } # Files in sourcetree outside package dir that should be copied to package. @@ -119,7 +130,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"] ) @@ -135,8 +146,6 @@ def main(): "-DBUILD_opencv_python2=OFF", # Disable the Java build by default as it is not needed "-DBUILD_opencv_java=%s" % build_java, - # When off, adds __init__.py and a few more helper .py's. We use our own helper files with a different structure. - "-DOPENCV_SKIP_PYTHON_LOADER=ON", # Relative dir to install the built module to in the build tree. # The default is generated from sysconfig, we'd rather have a constant for simplicity "-DOPENCV_PYTHON3_INSTALL_PATH=python", @@ -150,7 +159,21 @@ def main(): "-DBUILD_TESTS=OFF", "-DBUILD_PERF_TESTS=OFF", "-DBUILD_DOCS=OFF", + "-DPYTHON3_LIMITED_API=ON", + "-DBUILD_OPENEXR=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 + else ["-DCMAKE_GENERATOR_PLATFORM=x64"] if is64 and sys.platform == "win32" + else [] + ) + ( ["-DOPENCV_EXTRA_MODULES_PATH=" + os.path.abspath("opencv_contrib/modules")] if build_contrib @@ -168,7 +191,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 @@ -231,7 +254,7 @@ def main(): package_data=package_data, maintainer="Olli-Pekka Heinisuo", ext_modules=EmptyListWithLength(), - install_requires=numpy_version, + install_requires=install_requires, python_requires=">=3.6", classifiers=[ "Development Status :: 5 - Production/Stable", @@ -252,6 +275,7 @@ def main(): "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Programming Language :: C++", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering", @@ -350,6 +374,13 @@ def _classify_installed_files_override( print("Copying files from CMake output") + # 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.py' + % (cmake_install_dir, sys.version_info[0]), 'w') as opencv_init_config: + opencv_init_config.write(custom_init_data) + for package_name, relpaths_re in cls.package_paths_re.items(): package_dest_reldir = package_name.replace(".", os.path.sep) for relpath_re in relpaths_re: @@ -371,7 +402,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 @@ -410,7 +442,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 a83fe141..366d35ad 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -12,13 +12,16 @@ function build_wheel { function bdist_wheel_cmd { # copied from multibuild's common_utils.sh - # add osx deployment target so it doesnt default to 10.6 + # 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 - TOOLS_PATH=/opt/_internal/tools - /opt/python/cp37-cp37m/bin/python -m venv $TOOLS_PATH + # this path can be changed in the latest manylinux image + TOOLS_PATH=/opt/_internal/pipx/venvs/auditwheel + /opt/python/cp39-cp39/bin/python -m venv $TOOLS_PATH source $TOOLS_PATH/bin/activate python patch_auditwheel_whitelist.py deactivate @@ -47,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 @@ -67,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; } @@ -92,6 +96,10 @@ function pre_build { echo "Starting pre-build" set -e -o pipefail + if [ -n "$IS_OSX" ]; then + brew install lapack + fi + if [ -n "$IS_OSX" ]; then echo "Running for OSX" @@ -99,34 +107,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 @@ -148,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 diff --git a/travis_multibuild_customize.sh b/travis_multibuild_customize.sh index 5a9451be..178fd6ec 100644 --- a/travis_multibuild_customize.sh +++ b/travis_multibuild_customize.sh @@ -3,4 +3,4 @@ export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' set -x REPO_DIR=$(dirname "${BASH_SOURCE[0]}") -DOCKER_IMAGE='quay.io/skvark/manylinux2014_$plat' +DOCKER_IMAGE='quay.io/asenyaev/manylinux2014_$plat' diff --git a/travis_osx_brew_cache.sh b/travis_osx_brew_cache.sh index 401265f2..1a2a1c6c 100644 --- a/travis_osx_brew_cache.sh +++ b/travis_osx_brew_cache.sh @@ -249,7 +249,7 @@ function _brew_install_and_cache_within_time_limit { for dep in $DEPS; do #TIME_LIMIT only has to be met if we'll be actually building the main project this iteration, i.e. after the "root" module installation #While we don't know that yet, we can make better use of Travis-given time with a laxer limit - #We still can't overrun TIME_HARD_LIMIT as that would't leave time to save the cache + #We still can't overrun TIME_HARD_LIMIT as that wouldn't leave time to save the cache _brew_install_and_cache_within_time_limit "$dep" $(((TIME_LIMIT+TIME_HARD_LIMIT)/2)) "$TIME_HARD_LIMIT" "$TIME_START" || return $? done