diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml new file mode 100644 index 00000000..7bfe8cec --- /dev/null +++ b/.github/workflows/build_wheels_linux.yml @@ -0,0 +1,261 @@ +name: Linux x86_64 + +on: + pull_request: + branches: + - master + - 3.4 + - 4.x + - 5.x + paths-ignore: + - '.github/workflows/build_wheels_linux_arm.yml' + - '.github/workflows/build_wheels_windows*' + - '.github/workflows/build_wheels_macos*' + release: + types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: + + +jobs: + Build: + runs-on: ubuntu-20.04 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + python-version: ['3.9'] + platform: [x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + REPO_DIR: . + PROJECT_SPEC: opencv-python + MB_PYTHON_VERSION: ${{ matrix.python-version }} + TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} + MB_ML_VER: 2014 + TRAVIS_BUILD_DIR: ${{ github.workspace }} + CONFIG_PATH: travis_config.sh + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20241202 + 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: Setup environment + run: | + if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 0 + - name: Build a package + run: source scripts/build.sh + - name: Saving all wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: wheelhouse/opencv*.whl + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v3 + 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.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + 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==2.2.1 + 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@v3 + with: + submodules: true + fetch-depth: 0 + - name: Setup Environment variables + run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ 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@v3 + 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: ubuntu-20.04 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + 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: . + PROJECT_SPEC: opencv-python + PLAT: x86_64 + 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/opencv-ci/opencv-python-manylinux2014-x86-64:20241202 + 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: Setup environment + run: | + if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.platform }} + - 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 --formats=gztar + set +x + # Install and run tests + set -x + echo "skipping tests because of sdist" + - name: saving artifacts + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist/opencv*.tar.gz + + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: + if: github.event_name == 'release' && github.event.release.prerelease + needs: [Build, Build_sdist, Test] + runs-on: ubuntu-20.04 + environment: test-opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload all wheels + run: | + python -m pip install twine + python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* wheelhouse/opencv-* + + Release: + if: github.event_name == 'release' && !github.event.release.prerelease + needs: [Build, Build_sdist, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + 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 + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-* wheelhouse/opencv-contrib-python-headless-* diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml new file mode 100644 index 00000000..d643ba8e --- /dev/null +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -0,0 +1,196 @@ +name: Linux ARM64 + +on: + pull_request: + branches: + - master + - 3.4 + - 4.x + - 5.x + paths-ignore: + - '.github/workflows/build_wheels_linux.yml' + - '.github/workflows/build_wheels_windows*' + - '.github/workflows/build_wheels_macos*' + release: + types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: + + +jobs: + Build: + runs-on: opencv-cn-lin-arm64 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + python-version: ['3.9'] + platform: [x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + REPO_DIR: . + PROJECT_SPEC: opencv-python + MB_PYTHON_VERSION: ${{ matrix.python-version }} + TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} + PLAT: aarch64 + MB_ML_VER: 2014 + TRAVIS_BUILD_DIR: ${{ github.workspace }} + CONFIG_PATH: travis_config.sh + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20241202 + USE_CCACHE: 0 + UNICODE_WIDTH: 32 + 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: Setup environment + run: | + if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 0 + - name: Build a package + run: source scripts/build.sh + - name: Saving all wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: wheelhouse/opencv*.whl + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v3 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/opencv*.whl + + Test: + needs: [Build] + runs-on: opencv-cn-lin-arm64 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + 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==2.2.1 + 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@v3 + with: + submodules: true + fetch-depth: 0 + - name: Setup Environment variables + run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ 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@v3 + 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 + + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: + if: github.event_name == 'release' && github.event.release.prerelease + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: test-opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload all wheels + run: | + python -m pip install twine + python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* + + Release: + if: github.event_name == 'release' && !github.event.release.prerelease + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + 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 + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-* diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml new file mode 100644 index 00000000..eb797d46 --- /dev/null +++ b/.github/workflows/build_wheels_macos.yml @@ -0,0 +1,234 @@ +name: macOS x86_64 + +on: + pull_request: + branches: + - master + - 3.4 + - 4.x + - 5.x + paths-ignore: + - '.github/workflows/build_wheels_linux*' + - '.github/workflows/build_wheels_windows*' + - '.github/workflows/build_wheels_macos_m1.yml' + release: + types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: + + +jobs: + Build: + runs-on: macos-13 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + python-version: ['3.9'] + platform: [x64] + with_contrib: [0, 1] + without_gui: [0, 1] + build_sdist: [0] + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + REPO_DIR: . + PROJECT_SPEC: opencv-python + MB_PYTHON_VERSION: ${{ matrix.python-version }} + TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }} + MB_ML_VER: 2014 + TRAVIS_BUILD_DIR: ${{ github.workspace }} + TRAVIS_OS_NAME: osx + CONFIG_PATH: travis_config.sh + USE_CCACHE: 1 + 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: Setup environment + run: | + if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi + # hack for image issue on mac: https://github.com/actions/runner-images/issues/6817 + rm /usr/local/bin/2to3* + rm /usr/local/bin/idle3* + rm /usr/local/bin/pydoc3* + rm /usr/local/bin/python3* + # end hack + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 0 + - name: Build a package + run: | + set -e + # 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 + set -x + build_wheel $REPO_DIR $PLAT + - name: Saving all wheels + uses: actions/upload-artifact@v3 + with: + name: wheels + path: wheelhouse/opencv*.whl + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v3 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/opencv*.whl + + Test: + needs: [Build] + runs-on: macos-13 + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + 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==2.2.1 + 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@v3 + with: + submodules: true + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.platform }} + - name: Setup Environment variables + run: if ["3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ 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@v3 + 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.15.9 + cd ${{ github.workspace }}/tests + python -m pylint $PYLINT_TEST_FILE + + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: + if: github.event_name == 'release' && github.event.release.prerelease + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: test-opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload all wheels + run: | + python -m pip install twine + python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* + + Release: + if: github.event_name == 'release' && !github.event.release.prerelease + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + 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 + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-* diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml new file mode 100644 index 00000000..ffbdc752 --- /dev/null +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -0,0 +1,200 @@ +name: macOS ARM64 + +on: + pull_request: + branches: + - master + - 3.4 + - 4.x + - 5.x + paths-ignore: + - '.github/workflows/build_wheels_linux*' + - '.github/workflows/build_wheels_windows*' + - '.github/workflows/build_wheels_macos.yml' + release: + types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: + + +jobs: + Build: + runs-on: python-macos12-m1 + strategy: + fail-fast: false + matrix: + python-version: ['3.9'] + 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 }} + PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple + steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} + - name: Setup environment + run: | + if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 0 + - name: Build a package + run: | + git submodule update --init multibuild + echo $ENABLE_CONTRIB > contrib.enabled + echo $ENABLE_HEADLESS > headless.enabled + export MACOSX_DEPLOYMENT_TARGET=13.0 + 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 + 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@v3 + with: + name: wheels + path: wheelhouse/opencv*.whl + - name: Saving a wheel accordingly to matrix + uses: actions/upload-artifact@v3 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/opencv*.whl + + Test: + needs: [Build] + runs-on: python-macos12-m1 + strategy: + fail-fast: false + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + 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 + PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple + steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + - name: Download a wheel accordingly to matrix + uses: actions/download-artifact@v3 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} + path: wheelhouse/ + - name: Create Venv for test + run: | + test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test" + python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test + - name: Package installation + run: | + source ${{ github.workspace }}/opencv_test/bin/activate + python${{ matrix.python-version }} -m pip install --upgrade pip + python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl + cd ${{ github.workspace }}/tests + python${{ matrix.python-version }} get_build_info.py + - name: Run tests + run: | + source ${{ github.workspace }}/opencv_test/bin/activate + cd ${{ github.workspace }}/opencv + python${{ matrix.python-version }} modules/python/test/test.py -v --repo . + - name: Pylint test + run: | + source ${{ github.workspace }}/opencv_test/bin/activate + python${{ matrix.python-version }} -m pip install pylint==2.15.9 + cd ${{ github.workspace }}/tests + python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE + + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: + if: github.event_name == 'release' && github.event.release.prerelease + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: test-opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + with: + name: wheels + path: wheelhouse/ + - name: Upload all wheels + run: | + python -m pip install twine + python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* + + Release: + if: github.event_name == 'release' && !github.event.release.prerelease + needs: [Build, Test] + runs-on: ubuntu-20.04 + environment: opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v3 + 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 + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-* diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml new file mode 100644 index 00000000..a1a36ff8 --- /dev/null +++ b/.github/workflows/build_wheels_windows.yml @@ -0,0 +1,210 @@ +name: Windows x86_64 + +on: + pull_request: + branches: + - master + - 3.4 + - 4.x + - 5.x + paths-ignore: + - '.github/workflows/build_wheels_linux*' + - '.github/workflows/build_wheels_macos*' + release: + types: [published, edited] + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: + + +jobs: + Build: + runs-on: windows-2019 + strategy: + fail-fast: false + matrix: + python-version: ['3.9'] + 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: Setup environment + shell: bash + run: | + if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "ENABLE_ROLLING=1" >> $GITHUB_ENV + fi + - name: Checkout + uses: actions/checkout@v3 + with: + submodules: false + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.platform }} + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.1 + - name: Setup NASM + uses: ilammy/setup-nasm@v1 + - name: Build a package + # CMake 3.25 regression fix. See https://stackoverflow.com/questions/74162633/problem-compiling-from-source-opencv-with-mvsc2019-in-64-bit-version + run: | + python --version + python -m pip install --upgrade pip + python -m pip install --upgrade setuptools + python -m pip install cmake==3.24.2 + 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=cp37 --dist-dir=%cd%\wheelhouse -v + shell: cmd + - name: Saving all wheels + uses: actions/upload-artifact@v4 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }} + path: wheelhouse/opencv* + + Test: + needs: [Build] + runs-on: windows-2019 + defaults: + run: + shell: cmd + strategy: + fail-fast: false + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] + 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@v3 + with: + submodules: true + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.platform }} + - name: Download a wheel accordingly to matrix + uses: actions/download-artifact@v4 + with: + name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }} + path: wheelhouse/ + - name: Package installation + run: | + 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 tests + run: | + cd ${{ github.workspace }}/opencv + python modules\python\test\test.py -v --repo . + - name: Pylint test + run: | + python -m pip install pylint==2.15.9 + cd ${{ github.workspace }}\tests + python -m pylint $PYLINT_TEST_FILE + + Release_rolling: + if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} + needs: [Build, Test] + runs-on: ubuntu-22.04 + environment: opencv-python-rolling-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v4 + with: + path: wheelhouse/ + - name: Upload wheels for opencv_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* + - name: Upload wheels for opencv_contrib_python_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* + - name: Upload wheels for opencv_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* + - name: Upload wheels for opencv_contrib_python_headless_rolling + run: | + python -m pip install twine + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* + + Pre-release: + if: github.event_name == 'release' && github.event.release.prerelease + needs: [Build, Test] + runs-on: ubuntu-22.04 + environment: test-opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v4 + with: + path: wheelhouse/ + - name: Upload all wheels + run: | + python -m pip install twine + python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* + + Release: + if: github.event_name == 'release' && !github.event.release.prerelease + needs: [Build, Test] + runs-on: ubuntu-22.04 + environment: opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v4 + with: + 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 + python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-* diff --git a/.gitmodules b/.gitmodules index f2e0d283..7193d3b9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +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 a4c8227e..00000000 --- a/.travis.yml +++ /dev/null @@ -1,1060 +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: - - s1 - - final - -jobs: - fast_finish: true - # Travis exclude is buggy, this seems to be the only way to disable default build - exclude: - - language: ruby - include: - - os: osx - env: - - MB_PYTHON_VERSION=3.8 - language: generic - osx_image: xcode9.4 - stage: s1 - workspaces: - create: - name: brew_cache - paths: - # https://stackoverflow.com/questions/39930171/cache-brew-builds-with-travis-ci - - $HOME/Library/Caches/Homebrew - - /usr/local/Homebrew/ - # used in OSX custom build script dealing with local bottle caching - - $HOME/local_bottle_metadata - #workspaces share within the same build, cache shares between builds - cache: - directories: - # `cache: ccache: true` has no effect if `language:` is not `c` or `cpp` - - $HOME/.ccache - # https://stackoverflow.com/questions/39930171/cache-brew-builds-with-travis-ci - - $HOME/Library/Caches/Homebrew - - /usr/local/Homebrew/ - # used in OSX custom build script dealing with local bottle caching - - $HOME/local_bottle_metadata - - # source distributions - - os: linux - stage: s1 - script: skip - env: - - SDIST=1 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - python: "3.8" - language: python - dist: xenial - - os: linux - stage: s1 - script: skip - env: - - SDIST=1 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - python: "3.8" - language: python - dist: xenial - - os: linux - stage: s1 - script: skip - env: - - SDIST=1 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - python: "3.8" - language: python - dist: xenial - - os: linux - stage: s1 - script: skip - env: - - SDIST=1 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - python: "3.8" - language: python - dist: xenial - - # default builds for MacOS - #further jobs in the list will use the same stage until the next assignment - - stage: final - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.13.3 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.14.5 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.17.3 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.3 - workspaces: - use: brew_cache - - # headless builds for MacOS - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.13.3 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.14.5 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.17.3 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.3 - workspaces: - use: brew_cache - - # Contrib builds for MacOS - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.13.3 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.14.5 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.17.3 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.3 - workspaces: - use: brew_cache - - # headless contrib builds for MacOS - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.13.3 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.14.5 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.17.3 - workspaces: - use: brew_cache - - os: osx - language: generic - osx_image: xcode9.4 - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.3 - workspaces: - use: brew_cache - - # default builds for Linux - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.13.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.13.3 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.14.5 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.14.5 - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.17.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.17.3 - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=0 - - TEST_DEPENDS=numpy==1.19.3 - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.13.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.13.3 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.14.5 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.14.5 - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.17.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.17.3 - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.3 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=i686 - - ENABLE_CONTRIB=0 - - ENABLE_HEADLESS=1 - - TEST_DEPENDS=numpy==1.19.3 - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - TEST_DEPENDS=numpy==1.13.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.13.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - TEST_DEPENDS=numpy==1.14.5 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.14.5 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - TEST_DEPENDS=numpy==1.17.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.17.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - TEST_DEPENDS=numpy==1.19.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=0 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.19.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - TEST_DEPENDS=numpy==1.13.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.6 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.13.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - USE_CCACHE=0 - cache: - directories: $HOME/.ccache - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - TEST_DEPENDS=numpy==1.14.5 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.7 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.14.5 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - TEST_DEPENDS=numpy==1.17.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.8 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.17.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - 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 - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - TEST_DEPENDS=numpy==1.19.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - cache: - directories: $HOME/.ccache - - os: linux - language: generic - dist: xenial - services: docker - env: - - MB_PYTHON_VERSION=3.9 - - PLAT=i686 - - TEST_DEPENDS=numpy==1.19.3 - - ENABLE_CONTRIB=1 - - ENABLE_HEADLESS=1 - - 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 - - if [ -n "$IS_OSX" ]; then - export PATH="/usr/local/sbin:$PATH" - TAPS="$(brew --repository)/Library/Taps" - if [ -e "$TAPS/caskroom/homebrew-cask" -a -e "$TAPS/homebrew/homebrew-cask" ]; then - rm -rf "$TAPS/caskroom/homebrew-cask" - fi - find "$TAPS" -type d -name .git -exec \ - bash -xec ' - cd $(dirname '\''{}'\'') || echo "status: $?" - git clean -fxd || echo "status: $?" - sleep 1 || echo "status: $?" - git status || echo "status: $?"' \; || echo "status: $?" - brew_cache_cleanup - fi - 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 - -before_cache: | - # Cleanup dirs to be cached - set -e; set -x - if [ -n "$IS_OSX" ]; then - - # When Taps is cached, this dir causes "Error: file exists" on `brew update` - if [ -e "$(brew --repository)/Library/Taps/homebrew/homebrew-cask/homebrew-cask" ]; then - rm -rf "$(brew --repository)/Library/Taps/homebrew/homebrew-cask/homebrew-cask" - fi - - brew_cache_cleanup - - fi - set +x; set +e - -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_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 - - set +x - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6a843f0e..07ac1259 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,9 +6,12 @@ Thank you for considering contributing to opencv-python. If you've noticed a bug or have a question that doesn't belong on [Stack Overflow](http://stackoverflow.com/questions/tagged/opencv-python), -[search the issue tracker](https://github.com/skvark/opencv-python/issues?q=something) +[search the project issue tracker](https://github.com/opencv/opencv-python/issues?q=something) or +[search OpenCV issue tracker](https://github.com/opencv/opencv/issues?q=is%3Aissue+is%3Aopen+label%3A%22category%3A+python+bindings%22) to see if someone else in the community has already created a ticket. -If not, go ahead and [make one](https://github.com/skvark/opencv-python/issues/new)! +If not, go ahead and: +- [make new one for opencv-python](https://github.com/opencv/opencv-python/issues/new) if you cannot load package or some functionality is not available! +- [make new one for OpenCV](https://github.com/opencv/opencv-python/issues/new) if something went wrong with some function, class or method in code! ### 2. Fork & create a branch diff --git a/LICENSE-3RD-PARTY.txt b/LICENSE-3RD-PARTY.txt index 60c34bc0..0462eee3 100644 --- a/LICENSE-3RD-PARTY.txt +++ b/LICENSE-3RD-PARTY.txt @@ -1,48 +1,208 @@ OpenCV library is redistributed within opencv-python package. This license applies to OpenCV binary in the directory cv2/. -By downloading, copying, installing or using the software you agree to this license. -If you do not agree to this license, do not download, install, -copy or use the software. - - License Agreement - For Open Source Computer Vision Library - (3-clause BSD License) - -Copyright (C) 2000-2020, Intel Corporation, all rights reserved. -Copyright (C) 2009-2011, Willow Garage Inc., all rights reserved. -Copyright (C) 2009-2016, NVIDIA Corporation, all rights reserved. -Copyright (C) 2010-2013, Advanced Micro Devices, Inc., all rights reserved. -Copyright (C) 2015-2016, OpenCV Foundation, all rights reserved. -Copyright (C) 2015-2016, Itseez Inc., all rights reserved. -Copyright (C) 2019-2020, Xperience AI, all rights reserved. -Third party copyrights are property of their respective owners. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the names of the copyright holders nor the names of the contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -This software is provided by the copyright holders and contributors "as is" and -any express or implied warranties, including, but not limited to, the implied -warranties of merchantability and fitness for a particular purpose are disclaimed. -In no event shall copyright holders or contributors be liable for any direct, -indirect, incidental, special, exemplary, or consequential damages -(including, but not limited to, procurement of substitute goods or services; -loss of use, data, or profits; or business interruption) however caused -and on any theory of liability, whether in contract, strict liability, -or tort (including negligence or otherwise) arising in any way out of -the use of this software, even if advised of the possibility of such damage. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. ------------------------------------------------------------------------------ libvpx is redistributed within all opencv-python Linux packages. @@ -144,7 +304,7 @@ modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a @@ -200,7 +360,7 @@ modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -247,7 +407,7 @@ Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -305,7 +465,7 @@ instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -356,7 +516,7 @@ Library will still fall under Section 6.) distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -418,7 +578,7 @@ restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -459,7 +619,7 @@ subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -511,7 +671,7 @@ conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -733,16 +893,16 @@ are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -2. The origin of this software must not be misrepresented; you must - not claim that you wrote the original software. If you use this - software in a product, an acknowledgment in the product +2. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -4. The name of the author may not be used to endorse or promote - products derived from this software without specific prior written +4. The name of the author may not be used to endorse or promote + products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS @@ -840,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 @@ -865,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: @@ -883,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.] @@ -1342,8 +1502,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. libopenjp2 is redistributed within opencv-python macOS packages. This license applies to libopenjp2 binary in the directory cv2/. -The copyright in this software is being made available under the 2-clauses -BSD License, included below. This software may be subject to other third +The copyright in this software is being made available under the 2-clauses +BSD License, included below. This software may be subject to other third party and contributor rights, including patent rights, and no such rights are granted under this license. @@ -1354,7 +1514,7 @@ Copyright (c) 2003-2009, Francois-Olivier Devaux Copyright (c) 2005, Herve Drolon, FreeImage Team Copyright (c) 2002-2003, Yannick Verschueren Copyright (c) 2001-2003, David Janssens -Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France +Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France Copyright (c) 2012, CS Systemes d'Information, France All rights reserved. @@ -1499,7 +1659,7 @@ This license applies to libspeex binary in the directory cv2/. Copyright 2002-2008 Xiph.org Foundation Copyright 2002-2008 Jean-Marc Valin Copyright 2005-2007 Analog Devices Inc. -Copyright 2005-2008 Commonwealth Scientific and Industrial Research +Copyright 2005-2008 Commonwealth Scientific and Industrial Research Organisation (CSIRO) Copyright 1993, 2002, 2006 David Rowe Copyright 2003 EpicGames @@ -1537,26 +1697,26 @@ libsrt is redistributed within opencv-python macOS packages. This license applies to libsrt binary in the directory cv2/. /* - * + * * Copyright (c) 2001-2017 Cisco Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. - * + * * Neither the name of the Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -1610,7 +1770,7 @@ This license applies to libsrt binary in the directory cv2/. means any form of the work other than Source Code Form. 1.7. "Larger Work" - means a work that combines Covered Software with other material, in + means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" @@ -1981,7 +2141,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------ -libwebp and libwebpmux are redistributed within opencv-python macOS packages. +libwebp and libwebpmux are redistributed within all opencv-python packages. This license applies to libwebp and libwebpmux binaries in the directory cv2/. Copyright (c) 2010, Google Inc. All rights reserved. @@ -2275,4 +2435,656 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. \ No newline at end of file +in this Software without prior written authorization from The Open Group. + +------------------------------------------------------------------------------ +Vulkan headers are redistributed within all opencv-python packages. +This license applies to Vulkan headers in the directory 3rdparty/include/vulkan. + +Copyright (c) 2015-2018 The Khronos Group Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +------------------------------------------------------------------------------ +Libjpeg-turbo is redistributed within all opencv-python packages as build option. + +libjpeg-turbo Licenses +====================== + +libjpeg-turbo is covered by three compatible BSD-style open source licenses: + +- The IJG (Independent JPEG Group) License, which is listed in + [README.ijg](README.ijg) + + This license applies to the libjpeg API library and associated programs + (any code inherited from libjpeg, and any modifications to that code.) + +- The Modified (3-clause) BSD License, which is listed below + + This license covers the TurboJPEG API library and associated programs, as + well as the build system. + +- The [zlib License](https://opensource.org/licenses/Zlib) + + This license is a subset of the other two, and it covers the libjpeg-turbo + SIMD extensions. + + +Complying with the libjpeg-turbo Licenses +========================================= + +This section provides a roll-up of the libjpeg-turbo licensing terms, to the +best of our understanding. + +1. If you are distributing a modified version of the libjpeg-turbo source, + then: + + 1. You cannot alter or remove any existing copyright or license notices + from the source. + + **Origin** + - Clause 1 of the IJG License + - Clause 1 of the Modified BSD License + - Clauses 1 and 3 of the zlib License + + 2. You must add your own copyright notice to the header of each source + file you modified, so others can tell that you modified that file (if + there is not an existing copyright header in that file, then you can + simply add a notice stating that you modified the file.) + + **Origin** + - Clause 1 of the IJG License + - Clause 2 of the zlib License + + 3. You must include the IJG README file, and you must not alter any of the + copyright or license text in that file. + + **Origin** + - Clause 1 of the IJG License + +2. If you are distributing only libjpeg-turbo binaries without the source, or + if you are distributing an application that statically links with + libjpeg-turbo, then: + + 1. Your product documentation must include a message stating: + + This software is based in part on the work of the Independent JPEG + Group. + + **Origin** + - Clause 2 of the IJG license + + 2. If your binary distribution includes or uses the TurboJPEG API, then + your product documentation must include the text of the Modified BSD + License (see below.) + + **Origin** + - Clause 2 of the Modified BSD License + +3. You cannot use the name of the IJG or The libjpeg-turbo Project or the + contributors thereof in advertising, publicity, etc. + + **Origin** + - IJG License + - Clause 3 of the Modified BSD License + +4. The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be + free of defects, nor do we accept any liability for undesirable + consequences resulting from your use of the software. + + **Origin** + - IJG License + - Modified BSD License + - zlib License + + +The Modified (3-clause) BSD License +=================================== + +Copyright (C)2009-2022 D. R. Commander. All Rights Reserved.
+Copyright (C)2015 Viktor Szathmáry. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + +Why Three Licenses? +=================== + +The zlib License could have been used instead of the Modified (3-clause) BSD +License, and since the IJG License effectively subsumes the distribution +conditions of the zlib License, this would have effectively placed +libjpeg-turbo binary distributions under the IJG License. However, the IJG +License specifically refers to the Independent JPEG Group and does not extend +attribution and endorsement protections to other entities. Thus, it was +desirable to choose a license that granted us the same protections for new code +that were granted to the IJG for code derived from their software. + +------------------------------------------------------------------------------ +Libspng is redistributed within all opencv-python packages as build option. + +BSD 2-Clause License + +Copyright (c) 2018-2022, Randy +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +QUIRC library is redistributed within all opencv-python packages. + +quirc -- QR-code recognition library +Copyright (C) 2010-2012 Daniel Beer + +Permission to use, copy, modify, and/or distribute this software for +any purpose with or without fee is hereby granted, provided that the +above copyright notice and this permission notice appear in all +copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE +AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL +DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR +PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +------------------------------------------------------------------------------ +Flatbuffers library is redistributed within all opencv-python packages. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +------------------------------------------------------------------------------ +Protobuf library is redistributed within all opencv-python packages. + +Copyright 2008 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Code generated by the Protocol Buffer compiler is owned by the owner +of the input file used when generating it. This code is not +standalone and requires a support library to be linked with it. This +support library is itself covered by the above license. + +------------------------------------------------------------------------------ +OpenJPEG library is redistributed within all opencv-python packages. + +/* + * The copyright in this software is being made available under the 2-clauses + * BSD License, included below. This software may be subject to other third + * party and contributor rights, including patent rights, and no such rights + * are granted under this license. + * + * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium + * Copyright (c) 2002-2014, Professor Benoit Macq + * Copyright (c) 2003-2014, Antonin Descampe + * Copyright (c) 2003-2009, Francois-Olivier Devaux + * Copyright (c) 2005, Herve Drolon, FreeImage Team + * Copyright (c) 2002-2003, Yannick Verschueren + * Copyright (c) 2001-2003, David Janssens + * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France + * Copyright (c) 2012, CS Systemes d'Information, France + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +------------------------------------------------------------------------------ +TIFF library is redistributed within all opencv-python packages. + +Copyright (c) 1988-1997 Sam Leffler +Copyright (c) 1991-1997 Silicon Graphics, Inc. + +Permission to use, copy, modify, distribute, and sell this software and +its documentation for any purpose is hereby granted without fee, provided +that (i) the above copyright notices and this permission notice appear in +all copies of the software and related documentation, and (ii) the names of +Sam Leffler and Silicon Graphics may not be used in any advertising or +publicity relating to the software without the specific, prior written +permission of Sam Leffler and Silicon Graphics. + +THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +OF THIS SOFTWARE. + +------------------------------------------------------------------------------ +OpenEXR library is redistributed within all opencv-python packages. + +Copyright (c) 2006, Industrial Light & Magic, a division of Lucasfilm +Entertainment Company Ltd. Portions contributed and copyright held by +others as indicated. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the following + disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided with + the distribution. + + * Neither the name of Industrial Light & Magic nor the names of + any other contributors to this software may be used to endorse or + promote products derived from this software without specific prior + written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +Intel(R) IPP ICV library statically linked within x86 and x86_64 opencv-python packages. + +Intel(R) Integrated Performance Primitives 2021 Update 10 + +Intel Simplified Software License (Version October 2022) + +Intel(R) Integrated Performance Primitives (Intel(R) IPP) : Copyright (C) 1997 Intel Corporation + +Use and Redistribution. You may use and redistribute the software, which is +provided in binary form only, (the "Software"), without modification, +provided the following conditions are met: + +* Redistributions must reproduce the above copyright notice and these + terms of use in the Software and in the documentation and/or other materials + provided with the distribution. +* Neither the name of Intel nor the names of its suppliers may be used to + endorse or promote products derived from this Software without specific + prior written permission. +* No reverse engineering, decompilation, or disassembly of the Software is + permitted, nor any modification or alteration of the Software or its operation + at any time, including during execution. + +No other licenses. Except as provided in the preceding section, Intel grants no +licenses or other rights by implication, estoppel or otherwise to, patent, +copyright, trademark, trade name, service mark or other intellectual property +licenses or rights of Intel. + +Third party software. "Third Party Software" means the files (if any) listed +in the "third-party-software.txt" or other similarly-named text file that may +be included with the Software. Third Party Software, even if included with the +distribution of the Software, may be governed by separate license terms, including +without limitation, third party license terms, open source software notices and +terms, and/or other Intel software license terms. These separate license terms +solely govern Your use of the Third Party Software. + +DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE +DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS +WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE +THAT YOU ARE FULLY RESPONSIBLE FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND +ATTORNEYS' FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM ALLEGES THAT +INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE SOFTWARE. + +LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +No support. Intel may make changes to the Software, at any time without notice, +and is not obligated to support, update or provide training for the Software. + +Termination. Your right to use the Software is terminated in the event of your +breach of this license. + +Feedback. Should you provide Intel with comments, modifications, corrections, +enhancements or other input ("Feedback") related to the Software, Intel will be +free to use, disclose, reproduce, license or otherwise distribute or exploit the +Feedback in its sole discretion without any obligations or restrictions of any +kind, including without limitation, intellectual property rights or licensing +obligations. + +Compliance with laws. You agree to comply with all relevant laws and regulations +governing your use, transfer, import or export (or prohibition thereof) of the +Software. + +Governing law. All disputes will be governed by the laws of the United States of +America and the State of Delaware without reference to conflict of law +principles and subject to the exclusive jurisdiction of the state or federal +courts sitting in the State of Delaware, and each party agrees that it submits +to the personal jurisdiction and venue of those courts and waives any +objections. THE UNITED NATIONS CONVENTION ON CONTRACTS FOR THE INTERNATIONAL +SALE OF GOODS (1980) IS SPECIFICALLY EXCLUDED AND WILL NOT APPLY TO THE SOFTWARE. + +------------------------------------------------------------------------------ +Orbbec SDK distributed with arm64 MacOS packages. + +MIT License + +Copyright (c) 2023 OrbbecDeveloper + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/MANIFEST.in b/MANIFEST.in index 45cb6c40..cb9a7e7b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,8 +4,10 @@ include README.md include find_version.py include setup.py include pyproject.toml +include _build_backend/backend.py recursive-include cv2 * 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 98bbfa3b..3a4b46c2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,30 @@ -[![Downloads](http://pepy.tech/badge/opencv-python)](http://pepy.tech/project/opencv-python) +[![Downloads](https://static.pepy.tech/badge/opencv-python)](http://pepy.tech/project/opencv-python) + +### Keep OpenCV Free + +OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. [Donate to OpenCV on Github](https://github.com/sponsors/opencv) to show your support. + +- [OpenCV on Wheels](#opencv-on-wheels) + - [Installation and Usage](#installation-and-usage) +- [Frequently Asked Questions](#frequently-asked-questions) +- [Documentation for opencv-python](#documentation-for-opencv-python) + - [CI build process](#ci-build-process) + - [Manual builds](#manual-builds) + - [Manual debug builds](#manual-debug-builds) + - [Source distributions](#source-distributions) + - [Licensing](#licensing) + - [Versioning](#versioning) + - [Releases](#releases) + - [Development builds](#development-builds) + - [Manylinux wheels](#manylinux-wheels) + - [Supported Python versions](#supported-python-versions) + - [Backward compatibility](#backward-compatibility) ## OpenCV on Wheels -**Unofficial** pre-built CPU-only OpenCV packages for Python. +Pre-built CPU-only OpenCV packages for Python. -Check the manual build section if you wish to compile the bindings from source to enable additional modules such as CUDA. +Check the manual build section if you wish to compile the bindings from source to enable additional modules such as CUDA. ### Installation and Usage @@ -30,7 +50,7 @@ Check the manual build section if you wish to compile the bindings from source t ``import cv2`` - All packages contain haarcascade files. ``cv2.data.haarcascades`` can be used as a shortcut to the data folder. For example: + All packages contain Haar cascade files. ``cv2.data.haarcascades`` can be used as a shortcut to the data folder. For example: ``cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")`` @@ -49,10 +69,6 @@ A: No, the packages are special wheel binary packages and they already contain s Since ``opencv-python`` version 4.3.0.\*, ``manylinux1`` wheels were replaced by ``manylinux2014`` wheels. If your pip is too old, it will try to use the new source distribution introduced in 4.3.0.38 to manually build OpenCV because it does not know how to install ``manylinux2014`` wheels. However, source build will also fail because of too old ``pip`` because it does not understand build dependencies in ``pyproject.toml``. To use the new ``manylinux2014`` pre-built wheels (or to build from source), your ``pip`` version must be >= 19.3. Please upgrade ``pip`` with ``pip install --upgrade pip``. -**Q: Pip install fails with ``Could not find a version that satisfies the requirement ...``?** - -A: Most likely the issue is related to too old pip and can be fixed by running ``pip install --upgrade pip``. Note that the wheel (especially manylinux) format does not currently support properly ARM architecture so there are no packages for ARM based platforms in PyPI. However, ``opencv-python`` packages for Raspberry Pi can be found from https://www.piwheels.org/. - **Q: Import fails on Windows: ``ImportError: DLL load failed: The specified module could not be found.``?** A: If the import fails on Windows, make sure you have [Visual C++ redistributable 2015](https://www.microsoft.com/en-us/download/details.aspx?id=48145) installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, [Universal C Runtime](https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows) might be also required. @@ -61,7 +77,7 @@ Windows N and KN editions do not include Media Feature Pack which is required by If you have Windows Server 2012+, media DLLs are probably missing too; please install the Feature called "Media Foundation" in the Server Manager. Beware, some posts advise to install "Windows Server Essentials Media Pack", but this one requires the "Windows Server Essentials Experience" role, and this role will deeply affect your Windows Server configuration (by enforcing active directory integration etc.); so just installing the "Media Foundation" should be a safer choice. -If the above does not help, check if you are using Anaconda. Old Anaconda versions have a bug which causes the error, see [this issue](https://github.com/skvark/opencv-python/issues/36) for a manual fix. +If the above does not help, check if you are using Anaconda. Old Anaconda versions have a bug which causes the error, see [this issue](https://github.com/opencv/opencv-python/issues/36) for a manual fix. If you still encounter the error after you have checked all the previous solutions, download [Dependencies](https://github.com/lucasg/Dependencies) and open the ``cv2.pyd`` (located usually at ``C:\Users\username\AppData\Local\Programs\Python\PythonXX\Lib\site-packages\cv2``) file with it to debug missing DLL issues. @@ -69,6 +85,10 @@ 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 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 official OpenCV forum](https://forum.opencv.org/) before file new bugs. + **Q: Why the packages do not include non-free algorithms?** A: Non-free algorithms such as SURF are not included in these packages because they are patented / non-free and therefore cannot be distributed as built binaries. Note that SIFT is included in the builds due to patent expiration since OpenCV versions 4.3.0 and 3.4.10. See this issue for more info: https://github.com/skvark/opencv-python/issues/126 @@ -79,15 +99,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 @@ -104,7 +125,7 @@ The build process for a single entry in the build matrices is as follows (see fo - tests are disabled, otherwise build time increases too much - there are 4 build matrix entries for each build combination: with and without contrib modules, with and without GUI (headless) - Linux builds run in manylinux Docker containers (CentOS 5) - - source distributions are separate entries in the build matrix + - source distributions are separate entries in the build matrix 4. Rearrange OpenCV's build result, add our custom files and generate wheel @@ -121,7 +142,7 @@ The build can be customized with environment variables. In addition to any varia - ``CI_BUILD``. Set to ``1`` to emulate the CI environment build behaviour. Used only in CI builds to force certain build flags on in ``setup.py``. Do not use this unless you know what you are doing. - ``ENABLE_CONTRIB`` and ``ENABLE_HEADLESS``. Set to ``1`` to build the contrib and/or headless version - ``ENABLE_JAVA``, Set to ``1`` to enable the Java client build. This is disabled by default. -- ``CMAKE_ARGS``. Additional arguments for OpenCV's CMake invocation. You can use this to make a custom build. +- ``CMAKE_ARGS``. Additional arguments for OpenCV's CMake invocation. You can use this to make a custom build. See the next section for more info about manual builds outside the CI environment. @@ -129,27 +150,45 @@ See the next section for more info about manual builds outside the CI environmen If some dependency is not enabled in the pre-built wheels, you can also run the build locally to create a custom wheel. -1. Clone this repository: `git clone --recursive https://github.com/skvark/opencv-python.git` +1. Clone this repository: `git clone --recursive https://github.com/opencv/opencv-python.git` 2. ``cd opencv-python`` - you can use `git` to checkout some other version of OpenCV in the `opencv` and `opencv_contrib` submodules if needed 3. Add custom Cmake flags if needed, for example: `export CMAKE_ARGS="-DSOME_FLAG=ON -DSOME_OTHER_FLAG=OFF"` (in Windows you need to set environment variables differently depending on Command Line or PowerShell) 4. Select the package flavor which you wish to build with `ENABLE_CONTRIB` and `ENABLE_HEADLESS`: i.e. `export ENABLE_CONTRIB=1` if you wish to build `opencv-contrib-python` 5. Run ``pip wheel . --verbose``. NOTE: make sure you have the latest ``pip`` version, the ``pip wheel`` command replaces the old ``python setup.py bdist_wheel`` command which does not support ``pyproject.toml``. - this might take anything from 5 minutes to over 2 hours depending on your hardware -6. You'll have the wheel file in the `dist` folder and you can do with that whatever you wish +6. Pip will print fresh wheel location at the end of build procedure. If you use old approach with `setup.py` file wheel package will be placed in `dist` folder. Package is ready and you can do with that whatever you wish. - Optional: on Linux use some of the `manylinux` images as a build hosts if maximum portability is needed and run `auditwheel` for the wheel after build - Optional: on macOS use ``delocate`` (same as ``auditwheel`` but for macOS) for better portability +#### Manual debug builds + +In order to build `opencv-python` in an unoptimized debug build, you need to side-step the normal process a bit. + +1. Install the packages `scikit-build` and `numpy` via pip. +2. Run the command `python setup.py bdist_wheel --build-type=Debug`. +3. Install the generated wheel file in the `dist/` folder with `pip install dist/wheelname.whl`. + +If you would like the build produce all compiler commands, then the following combination of flags and environment variables has been tested to work on Linux: +``` +export CMAKE_ARGS='-DCMAKE_VERBOSE_MAKEFILE=ON' +export VERBOSE=1 + +python3 setup.py bdist_wheel --build-type=Debug +``` + +See this issue for more discussion: https://github.com/opencv/opencv-python/issues/424 + #### Source distributions Since OpenCV version 4.3.0, also source distributions are provided in PyPI. This means that if your system is not compatible with any of the wheels in PyPI, ``pip`` will attempt to build OpenCV from sources. If you need a OpenCV version which is not available in PyPI as a source distribution, please follow the manual build guidance above instead of this one. -You can also force ``pip`` to build the wheels from the source distribution. Some examples: +You can also force ``pip`` to build the wheels from the source distribution. Some examples: - ``pip install --no-binary opencv-python opencv-python`` - ``pip install --no-binary :all: opencv-python`` -If you need contrib modules or headless version, just change the package name (step 4 in the previous section is not needed). However, any additional CMake flags can be provided via environment variables as described in step 3 of the manual build section. If none are provided, OpenCV's CMake scripts will attempt to find and enable any suitable dependencies. Headless distributions have hard coded CMake flags which disable all possible GUI dependencies. +If you need contrib modules or headless version, just change the package name (step 4 in the previous section is not needed). However, any additional CMake flags can be provided via environment variables as described in step 3 of the manual build section. If none are provided, OpenCV's CMake scripts will attempt to find and enable any suitable dependencies. Headless distributions have hard coded CMake flags which disable all possible GUI dependencies. On slow systems such as Raspberry Pi the full build may take several hours. On a 8-core Ryzen 7 3700X the build takes about 6 minutes. @@ -157,15 +196,15 @@ On slow systems such as Raspberry Pi the full build may take several hours. On a Opencv-python package (scripts in this repository) is available under MIT license. -OpenCV itself is available under [3-clause BSD License](https://github.com/opencv/opencv/blob/master/LICENSE). +OpenCV itself is available under [Apache 2](https://github.com/opencv/opencv/blob/master/LICENSE) license. -Third party package licenses are at [LICENSE-3RD-PARTY.txt](https://github.com/skvark/opencv-python/blob/master/LICENSE-3RD-PARTY.txt). +Third party package licenses are at [LICENSE-3RD-PARTY.txt](https://github.com/opencv/opencv-python/blob/master/LICENSE-3RD-PARTY.txt). 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/skvark/opencv-python/blob/master/LICENSE-3RD-PARTY.txt). +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). ### Versioning @@ -197,10 +236,12 @@ The default ``manylinux2014`` images have been extended with some OpenCV depende Python 3.x compatible pre-built wheels are provided for the officially supported Python versions (not in EOL): -- 3.6 - 3.7 - 3.8 - 3.9 +- 3.10 +- 3.11 +- 3.12 ### Backward compatibility @@ -208,3 +249,6 @@ Starting from 4.2.0 and 3.4.9 builds the macOS Travis build environment was upda Starting from 4.3.0 and 3.4.10 builds the Linux build environment was updated from `manylinux1` to `manylinux2014`. This dropped support for old Linux distributions. +Starting from version 4.7.0 the Mac OS GitHub Actions build environment was update to version 11. Mac OS 10.x support deprecated. See https://github.com/actions/runner-images/issues/5583 + +Starting from version 4.9.0 the Mac OS GitHub Actions build environment was update to version 12. Mac OS 10.x support deprecated by Brew and most of used packages. diff --git a/_build_backend/backend.py b/_build_backend/backend.py new file mode 100644 index 00000000..7fc84138 --- /dev/null +++ b/_build_backend/backend.py @@ -0,0 +1,23 @@ +from setuptools import build_meta as _orig + +prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel +build_wheel = _orig.build_wheel +build_sdist = _orig.build_sdist +get_requires_for_build_sdist = _orig.get_requires_for_build_sdist + +def get_requires_for_build_wheel(config_settings=None): + from packaging import version + from skbuild.exceptions import SKBuildError + from skbuild.cmaker import get_cmake_version + packages = _orig.get_requires_for_build_wheel(config_settings) + # check if system cmake can be used if present + # if not, append cmake PyPI distribution to required packages + # scikit-build>=0.18 itself requires cmake 3.5+ + min_version = "3.5" + try: + if version.parse(get_cmake_version().split("-")[0]) < version.parse(min_version): + packages.append(f'cmake>={min_version}') + except SKBuildError: + packages.append(f'cmake>={min_version}') + + return packages 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 d665b75c..e69de29b 100644 --- a/cv2/__init__.py +++ b/cv2/__init__.py @@ -1,33 +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 == "darwin" or 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/README.md b/docker/README.md index 7e09ee10..6e00e8f3 100644 --- a/docker/README.md +++ b/docker/README.md @@ -6,4 +6,4 @@ Manylinux2014 is used in wheels with version 3.4.10.* / 4.3.0.* and above. The extended images were created to be able to build OpenCV in reasonable time with Travis. The images are hosted at https://quay.io/user/skvark. -See the dockerfiles for more info. \ No newline at end of file +See the dockerfiles for more info. diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index e8920770..9a8bfdde 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -1,73 +1,143 @@ +# Version: 20241202 +# 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=5.1.6 +ARG FREETYPE_VERSION=2.13.3 +ARG LIBPNG_VERSION=1.6.44 +ARG VPX_VERSION=v1.15.0 +ARG NASM_VERSION=2.15.04 +ARG OPENSSL_VERSION=1_1_1w +ARG QT_VERSION=5.15.16 +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 zlib-devel curl-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 dejavu-sans-fonts -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 + +# looks like download.savannah.gnu.org suffers from https://savannah.gnu.org/bugs/?48150 in Manylinux 2014 env on aarch64 +RUN mkdir ~/freetype_sources && \ + cd ~/freetype_sources && \ + curl -O -L https://download-mirror.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 -C - -O -L https://download.qt.io/archive/qt/5.15/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \ + tar -xf qt-everywhere-opensource-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.gz && \ + tar -xf nasm-${NASM_VERSION}.tar.gz && 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 -b ${VPX_VERSION} 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.gz && \ + tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \ + 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 -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..1c94b1fc 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=5.1.4 +ARG NASM_VERSION=2.15.04 +ARG OPENSSL_VERSION=1_1_1w +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..088d8df5 100644 --- a/docker/manylinux2014/Dockerfile_x86_64 +++ b/docker/manylinux2014/Dockerfile_x86_64 @@ -1,66 +1,142 @@ +# Version: 20241202 +# 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=5.1.6 +ARG FREETYPE_VERSION=2.13.3 +ARG LIBPNG_VERSION=1.6.44 +ARG VPX_VERSION=v1.15.0 +ARG NASM_VERSION=2.15.04 +ARG OPENSSL_VERSION=1_1_1w +ARG QT_VERSION=5.15.16 +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 zlib-devel curl-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 dejavu-sans-fonts -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/archive/qt/5.15/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \ + tar -xf qt-everywhere-opensource-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.gz && \ + tar -xf nasm-${NASM_VERSION}.tar.gz && 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 -b ${VPX_VERSION} 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.gz && \ + tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \ + 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 -ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig -ENV LDFLAGS -L/root/ffmpeg_build/lib +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:/ffmpeg_build/lib/pkgconfig +ENV LDFLAGS -L/ffmpeg_build/lib ENV PATH "$HOME/bin:$PATH" diff --git a/find_version.py b/find_version.py index 6c676b23..13e8003c 100644 --- a/find_version.py +++ b/find_version.py @@ -1,11 +1,12 @@ import sys -import os import subprocess +from datetime import date if __name__ == "__main__": contrib = sys.argv[1] headless = sys.argv[2] - ci_build = sys.argv[3] + rolling = sys.argv[3] + ci_build = sys.argv[4] opencv_version = "" # dig out the version from OpenCV sources @@ -56,6 +57,11 @@ # tag identifies the build and should be a sequential revision number version = tag[0] opencv_version += ".{}".format(version) + # rolling has converted into string using get_and_set_info() function in setup.py + elif rolling == "True": + # rolling version identifier, will be published in a dedicated rolling PyPI repository + version = date.today().strftime('%Y%m%d') + opencv_version += ".{}".format(version) else: # local version identifier, not to be published on PyPI version = git_hash @@ -65,4 +71,5 @@ f.write('opencv_version = "{}"\n'.format(opencv_version)) f.write("contrib = {}\n".format(contrib)) f.write("headless = {}\n".format(headless)) + f.write("rolling = {}\n".format(rolling)) f.write("ci_build = {}".format(ci_build)) diff --git a/multibuild b/multibuild index 8882150d..0714f52e 160000 --- a/multibuild +++ b/multibuild @@ -1 +1 @@ -Subproject commit 8882150df6529658700b66bec124dfb77eefca26 +Subproject commit 0714f52ea1ea57a0bc33c7f8b74bae457e1fa8e0 diff --git a/opencv b/opencv index c3bb57af..31b0eeea 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit c3bb57afeaf030f10939204d48d7c2a3842f4293 +Subproject commit 31b0eeea0b44b370fd0712312df4214d4ae1b158 diff --git a/opencv_contrib b/opencv_contrib index 5fae4082..0e5254eb 160000 --- a/opencv_contrib +++ b/opencv_contrib @@ -1 +1 @@ -Subproject commit 5fae4082cc493efa5cb7a7486f9e009618a5198b +Subproject commit 0e5254ebf54d2aed6e7eaf6660bf3b797cf50a02 diff --git a/opencv_extra b/opencv_extra new file mode 160000 index 00000000..a74cf6ba --- /dev/null +++ b/opencv_extra @@ -0,0 +1 @@ +Subproject commit a74cf6bae7fd75d91282b877c559168b3a62148a diff --git a/patch_auditwheel_whitelist.py b/patch_auditwheel_whitelist.py index d0cbf5b2..b396ab55 100644 --- a/patch_auditwheel_whitelist.py +++ b/patch_auditwheel_whitelist.py @@ -3,14 +3,17 @@ from auditwheel import policy -policies = None +def add_whitelisted_libs(): + policies = None -with open(join(dirname(abspath(policy.__file__)), "policy.json")) as f: - policies = json.load(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": + for p in policies: p["lib_whitelist"].append("libxcb.so.1") -with open(join(dirname(abspath(policy.__file__)), "policy.json"), "w") as f: - f.write(json.dumps(policies)) + with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json"), "w") as f: + f.write(json.dumps(policies)) + +if __name__ == '__main__': + add_whitelisted_libs() diff --git a/patches/patchQtPlugins b/patches/patchQtPlugins index 03560f17..b274aa08 100644 --- a/patches/patchQtPlugins +++ b/patches/patchQtPlugins @@ -3,16 +3,23 @@ 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() + if(UNIX AND NOT APPLE) -+ install(DIRECTORY /opt/Qt5.15.0/plugins DESTINATION lib/qt) ++ install(DIRECTORY /opt/Qt5.15.16/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 b2efd1bd..d70b49ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,18 @@ [build-system] requires = [ - "setuptools", "wheel", "scikit-build", "cmake", "pip", - "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64'", - "numpy==1.19.0; python_version>='3.6' and sys_platform == 'linux' and platform_machine == 'aarch64'", - "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64'", - "numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64'", - "numpy==1.19.3; python_version>='3.9' and platform_machine != 'aarch64'" + "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'", + "numpy==1.17.0; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'", + "numpy==1.17.5; python_version=='3.8' 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>=2.0.0; python_version>='3.9'", + "packaging", + "pip", + "scikit-build>=0.14.0", + "setuptools==59.2.0; python_version<'3.12'", + "setuptools<70.0.0; python_version>='3.12'", ] +# use a custom backend to manage CMake check / installation +# see https://scikit-build.readthedocs.io/en/latest/usage.html#adding-cmake-as-building-requirement-only-if-not-installed-or-too-low-a-version +build-backend = "backend" +backend-path = ["_build_backend"] 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/scripts/build.sh b/scripts/build.sh new file mode 100755 index 00000000..e5c83d83 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e +# 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 $ENABLE_ROLLING > rolling.enabled +set -x +build_wheel $REPO_DIR $PLAT diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 00000000..f20080ae --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e +# 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 --recursive +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 $ENABLE_ROLLING > rolling.enabled +set -x +install_run $PLAT +set +x diff --git a/setup.py b/setup.py index 528019cd..1dfab2fb 100644 --- a/setup.py +++ b/setup.py @@ -7,8 +7,7 @@ import re import sysconfig import platform -import skbuild -from skbuild import cmaker +from skbuild import cmaker, setup def main(): @@ -17,28 +16,34 @@ def main(): CI_BUILD = os.environ.get("CI_BUILD", "False") is_CI_build = True if CI_BUILD == "1" else False cmake_source_dir = "opencv" - minimum_supported_numpy = "1.13.1" + minimum_supported_numpy = "1.13.3" build_contrib = get_build_env_var_by_name("contrib") 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, 6) and platform.machine() == "aarch64": - minimum_supported_numpy = "1.19.0" - 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" - - numpy_version = "numpy>=%s" % minimum_supported_numpy + build_rolling = get_build_env_var_by_name("rolling") + + install_requires = [ + 'numpy>=1.13.3; python_version<"3.7"', + 'numpy>=1.17.0; python_version>="3.7"', # https://github.com/numpy/numpy/pull/13725 + '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.0; python_version<="3.9" and platform_system=="Darwin" and platform_machine=="arm64"', + 'numpy>=1.21.4; python_version>="3.10" and platform_system=="Darwin"', + "numpy>=1.23.5; python_version>='3.11'", + "numpy>=1.26.0; python_version>='3.12'" + ] python_version = cmaker.CMaker.get_python_version() - python_lib_path = cmaker.CMaker.get_python_library(python_version).replace( - "\\", "/" - ) + python_lib_path = cmaker.CMaker.get_python_library(python_version) or "" + # HACK: For Scikit-build 0.17.3 and newer that returns None or empty sptring for PYTHON_LIBRARY in manylinux2014 + # A small release related to PYTHON_LIBRARY handling changes in 0.17.2; scikit-build 0.17.3 returns an empty string from get_python_library if no Python library is present (like on manylinux), where 0.17.2 returned None, and previous versions returned a non-existent path. Note that adding REQUIRED to find_package(PythonLibs will fail, but it is incorrect (you must not link to libPython.so) and was really just injecting a non-existent path before. + # TODO: Remove the hack when the issue is handled correctly in main OpenCV CMake. + if python_lib_path == "": + python_lib_path = "libpython%sm.a" % python_version + python_lib_path = python_lib_path.replace("\\", "/") + python_include_dir = cmaker.CMaker.get_python_include_dir(python_version).replace( "\\", "/" ) @@ -49,21 +54,32 @@ def main(): g = git.Git() # NOTE: pip API's are internal, this has to be refactored g.run_command(["submodule", "sync"]) - g.run_command( - ["submodule", "update", "--init", "--recursive", cmake_source_dir] - ) - if build_contrib: + if build_rolling: g.run_command( - ["submodule", "update", "--init", "--recursive", "opencv_contrib"] + ["submodule", "update", "--init", "--recursive", "--remote", cmake_source_dir] ) - package_version, build_contrib, build_headless = get_and_set_info( - build_contrib, build_headless, is_CI_build + if build_contrib: + g.run_command( + ["submodule", "update", "--init", "--recursive", "--remote", "opencv_contrib"] + ) + else: + g.run_command( + ["submodule", "update", "--init", "--recursive", cmake_source_dir] + ) + + if build_contrib: + g.run_command( + ["submodule", "update", "--init", "--recursive", "opencv_contrib"] + ) + + package_version, build_contrib, build_headless, build_rolling = get_and_set_info( + build_contrib, build_headless, build_rolling, is_CI_build ) # https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode - x64 = sys.maxsize > 2 ** 32 + is64 = sys.maxsize > 2 ** 32 package_name = "opencv-python" @@ -76,6 +92,9 @@ def main(): if build_headless and not build_contrib: package_name = "opencv-python-headless" + if build_rolling: + package_name += "-rolling" + long_description = io.open("README.md", encoding="utf-8").read() packages = ["cv2", "cv2.data"] @@ -91,7 +110,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{4}%s\.dll" % ("_64" if is64 else "")] if os.name == "nt" else [] ) @@ -99,21 +118,50 @@ def main(): # In Windows, in python/X.Y//; in Linux, in just python/X.Y/. # Naming conventions vary so widely between versions and OSes # had to give up on checking them. + # If not specifying PY_LIMITED_API, the Python sources go under python/cv2/python-3.MINOR_VERSION/ instead of python/cv2/python-3/ [ - "python/cv2[^/]*%(ext)s" - % {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))} - ], + r"python/cv2/python-%s*/cv2.*" + % (sys.version_info[0]) if 'CMAKE_ARGS' in os.environ and "-DPYTHON3_LIMITED_API=ON" in os.environ['CMAKE_ARGS'] + else r"python/cv2/python-%s.*/cv2.*" + % (sys.version_info[0]) + ] + + + [ + r"python/cv2/__init__.py" + ] + + + [ + r"python/cv2/.*config.*.py" + ] + + + [ r"python/cv2/py.typed" ] if sys.version_info >= (3, 6) else [] + , "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" + ], } + if sys.version_info >= (3, 6): + rearrange_cmake_output_data["cv2.typing"] = ["python/cv2" + r"/typing/.*\.py"] + # Files in sourcetree outside package dir that should be copied to package. # Raw paths relative to sourcetree root. 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"] ) @@ -123,14 +171,13 @@ def main(): + [ # skbuild inserts PYTHON_* vars. That doesn't satisfy opencv build scripts in case of Py3 "-DPYTHON3_EXECUTABLE=%s" % sys.executable, + "-DPYTHON_DEFAULT_EXECUTABLE=%s" % sys.executable, "-DPYTHON3_INCLUDE_DIR=%s" % python_include_dir, "-DPYTHON3_LIBRARY=%s" % python_lib_path, "-DBUILD_opencv_python3=ON", "-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", @@ -139,11 +186,26 @@ def main(): "-DINSTALL_CREATE_DISTRIB=ON", # See opencv/CMakeLists.txt for options and defaults "-DBUILD_opencv_apps=OFF", + "-DBUILD_opencv_freetype=OFF", "-DBUILD_SHARED_LIBS=OFF", "-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 @@ -161,7 +223,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 @@ -170,7 +232,7 @@ def main(): if ( not build_headless and "bdist_wheel" in sys.argv - and (sys.platform == "darwin" or sys.platform.startswith("linux")) + and sys.platform.startswith("linux") ): cmake_args.append("-DWITH_QT=5") subprocess.check_call("patch -p1 < patches/patchQtPlugins", shell=True) @@ -200,31 +262,24 @@ def main(): cmake_args.append("-DWITH_LAPACK=ON") cmake_args.append("-DENABLE_PRECOMPILED_HEADERS=OFF") - # https://github.com/scikit-build/scikit-build/issues/479 - if "CMAKE_ARGS" in os.environ: - import shlex - - cmake_args.extend(shlex.split(os.environ["CMAKE_ARGS"])) - del shlex - # works via side effect RearrangeCMakeOutput( rearrange_cmake_output_data, files_outside_package_dir, package_data.keys() ) - skbuild.setup( + setup( name=package_name, version=package_version, - url="https://github.com/skvark/opencv-python", - license="MIT", + url="https://github.com/opencv/opencv-python", + license="Apache 2.0", description="Wrapper package for OpenCV python bindings.", long_description=long_description, long_description_content_type="text/markdown", packages=packages, package_data=package_data, - maintainer="Olli-Pekka Heinisuo", + maintainer="OpenCV Team", ext_modules=EmptyListWithLength(), - install_requires=numpy_version, + install_requires=install_requires, python_requires=">=3.6", classifiers=[ "Development Status :: 5 - Production/Stable", @@ -233,7 +288,7 @@ def main(): "Intended Audience :: Education", "Intended Audience :: Information Technology", "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", + "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", @@ -245,6 +300,10 @@ def main(): "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: C++", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Scientific/Engineering", @@ -255,8 +314,9 @@ def main(): cmake_source_dir=cmake_source_dir, ) + print("OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. Donate to OpenCV on GitHub:\nhttps://github.com/sponsors/opencv\n") -class RearrangeCMakeOutput(object): +class RearrangeCMakeOutput: """ Patch SKBuild logic to only take files related to the Python package and construct a file hierarchy that SKBuild expects (see below) @@ -337,12 +397,37 @@ def _classify_installed_files_override( p.replace(os.path.sep, "/") for p in install_relpaths ] relpaths_zip = list(zip(fslash_install_relpaths, install_relpaths)) - del install_relpaths, fslash_install_relpaths final_install_relpaths = [] 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() + + # OpenCV generates config with different name for case with PYTHON3_LIMITED_API=ON + config_py = os.path.join(cmake_install_dir, 'python', 'cv2', 'config-%s.%s.py' + % (sys.version_info[0], sys.version_info[1])) + if not os.path.exists(config_py): + config_py = os.path.join(cmake_install_dir, 'python', 'cv2', 'config-%s.py' % sys.version_info[0]) + + with open(config_py, 'w') as opencv_init_config: + opencv_init_config.write(custom_init_data) + + if sys.version_info >= (3, 6): + for p in install_relpaths: + if p.endswith(".pyi"): + target_rel_path = os.path.relpath(p, "python/cv2") + cls._setuptools_wrap._copy_file( + os.path.join(cmake_install_dir, p), + os.path.join(cmake_install_dir, "cv2", target_rel_path), + hide_listing=False, + ) + final_install_relpaths.append(os.path.join("cv2", target_rel_path)) + + del install_relpaths, fslash_install_relpaths + 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: @@ -364,7 +449,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 @@ -403,11 +489,11 @@ 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, ) -def get_and_set_info(contrib, headless, ci_build): +def get_and_set_info(contrib, headless, rolling, ci_build): # cv2/version.py should be generated by running find_version.py version = {} here = os.path.abspath(os.path.dirname(__file__)) @@ -417,14 +503,14 @@ def get_and_set_info(contrib, headless, ci_build): # (in sdists the version.py file already exists) if os.path.exists(".git"): old_args = sys.argv.copy() - sys.argv = ["", str(contrib), str(headless), str(ci_build)] + sys.argv = ["", str(contrib), str(headless), str(rolling), str(ci_build)] runpy.run_path("find_version.py", run_name="__main__") sys.argv = old_args with open(version_file) as fp: exec(fp.read(), version) - return version["opencv_version"], version["contrib"], version["headless"] + return version["opencv_version"], version["contrib"], version["headless"], version["rolling"] def get_build_env_var_by_name(flag_name): diff --git a/tests/get_build_info.py b/tests/get_build_info.py new file mode 100644 index 00000000..4714f2f4 --- /dev/null +++ b/tests/get_build_info.py @@ -0,0 +1,3 @@ +import cv2 as cv + +print(cv.getBuildInformation()) 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 910e365f..fcdd4f60 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=cp37 -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 @@ -31,8 +34,14 @@ if [ -n "$IS_OSX" ]; then export MAKEFLAGS="-j$(sysctl -n hw.ncpu)" else echo " > Linux environment " - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.15.0/lib + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.15.16/lib export MAKEFLAGS="-j$(grep -E '^processor[[:space:]]*:' /proc/cpuinfo | wc -l)" + CURRENT_ARCH=$(uname -m) + if [[ $CURRENT_ARCH == 'aarch64' ]]; then + # To avoid network issues with pypi.org on OpenCV CN machines + export PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple + echo "Running for linux aarch64" + fi fi if [ -n "$IS_OSX" ]; then @@ -41,13 +50,13 @@ if [ -n "$IS_OSX" ]; then BREW_SLOW_BUILIDING_PACKAGES=$(printf '%s\n' \ "cmake 15" \ - "ffmpeg_opencv 10" \ + "ffmpeg 10" \ ) function generate_ffmpeg_formula { local FF="ffmpeg" - local LFF="ffmpeg_opencv" - local FF_FORMULA; FF_FORMULA=$(brew formula "$FF") + local LFF="ffmpeg" + local FF_FORMULA; FF_FORMULA=$(brew formula "${FF}") local LFF_FORMULA; LFF_FORMULA="$(dirname "$FF_FORMULA")/${LFF}.rb" local REGENERATE @@ -68,7 +77,7 @@ if [ -n "$IS_OSX" ]; then echo "Regenerating custom ffmpeg formula" # Bottle block syntax: https://docs.brew.sh/Bottles#bottle-dsl-domain-specific-language perl -wpe 'BEGIN {our ($found_blank, $bottle_block);} - if (/(^class )(Ffmpeg)(\s.*)/) {$_=$1.$2."Opencv".$3."\n"; next;} + if (/(^class )(Ffmpeg)(\s.*)/) {$_=$1."Opencv".$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,37 +101,25 @@ 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" - local CACHE_STAGE; (echo "$TRAVIS_BUILD_STAGE_NAME" | grep -qiF "final") || CACHE_STAGE=1 + local CACHE_STAGE;# (echo "$TRAVIS_BUILD_STAGE_NAME" | grep -qiF "final") || CACHE_STAGE=1 + 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 unlink python@2 - brew install 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 + # It needs when we use not the latest ffmpeg formula + brew link ffmpeg if [ -n "$CACHE_STAGE" ]; then brew_go_bootstrap_mode 0 @@ -142,24 +139,38 @@ function run_tests { echo "Run tests..." echo $PWD - if [ -n "$IS_OSX" ]; then - echo "Running for OS X" - cd ../tests/ - else - echo "Running for linux" - cd /io/tests/ + PYTHON=python$PYTHON_VERSION + + echo "Running for linux" + + if [ $PYTHON == "python3.7" ]; 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 { - PYTHON=python$PYTHON_VERSION - echo "Starting tests..." + echo "Starting OpenCV tests..." #Test package - $PYTHON -m unittest test + $PYTHON modules/python/test/test.py -v --repo . +} + +function pylint_test { + + echo "Starting Pylint tests..." + + $PYTHON -m pip install pylint==2.15.9 + cd /io/tests + $PYTHON -m pylint /io/opencv/samples/python/squares.py } export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' 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 e3a69cc3..42e71446 100644 --- a/travis_osx_brew_cache.sh +++ b/travis_osx_brew_cache.sh @@ -4,6 +4,9 @@ #Should be in Travis' cache BREW_LOCAL_BOTTLE_METADATA="$HOME/local_bottle_metadata" +#FIXME: temporary fix to enable the build, should be replaced with the proper path to the cache dir +mkdir -p $BREW_LOCAL_BOTTLE_METADATA + # Starting reference point for elapsed build time; seconds since the epoch. #TRAVIS_TIMER_START_TIME is set at the start of a log fold, in nanoseconds since the epoch BREW_TIME_START=$(($TRAVIS_TIMER_START_TIME/10**9)) @@ -48,33 +51,33 @@ function brew_add_local_bottles { # so that `brew` commands can find them. # If the package was updated, removes the corresponding files # and the bottle's entry in the formula, if any. - - # Bottle entry in formula: + + # Bottle entry in formula: # bottle do # <...> # sha256 "" => : # <...> - # end - + # end + echo "Cached bottles:" ls "$(brew --cache)/downloads" || true #may not exist initially since it's "$(brew --cache)" that is in Travis cache echo "Saved .json's and links:" ls "$BREW_LOCAL_BOTTLE_METADATA" - + for JSON in "$BREW_LOCAL_BOTTLE_METADATA"/*.json; do [ -e "$JSON" ] || break # OSX 10.11 bash has no nullglob local PACKAGE JSON_VERSION JSON_REBUILD OS_CODENAME BOTTLE_HASH - + _brew_parse_bottle_json "$JSON" PACKAGE JSON_VERSION JSON_REBUILD OS_CODENAME BOTTLE_HASH echo "Adding local bottle: $PACKAGE ${JSON_VERSION}_${JSON_REBUILD}" - + local FORMULA_VERSION FORMULA_REBUILD FORMULA_BOTTLE_HASH - + _brew_parse_package_info "$PACKAGE" "$OS_CODENAME" FORMULA_VERSION FORMULA_REBUILD FORMULA_BOTTLE_HASH local FORMULA_HAS_BOTTLE; [ -n "$FORMULA_BOTTLE_HASH" ] && FORMULA_HAS_BOTTLE=1 || true - + local BOTTLE_LINK BOTTLE=""; BOTTLE_LINK="${JSON}.bottle.lnk"; local BOTTLE_EXISTS= BOTTLE_MISMATCH= VERSION_MISMATCH= @@ -88,10 +91,10 @@ function brew_add_local_bottles { if [ -f "$BOTTLE_LINK" ]; then BOTTLE=$(cat "$BOTTLE_LINK"); BOTTLE=$(cd "$(dirname "$BOTTLE")"; pwd)/$(basename "$BOTTLE") - + if [ -e "$BOTTLE" ]; then BOTTLE_EXISTS=1; - + # The hash in `brew --cache $PACKAGE` entry is generated from download URL, # which itself is generated from base URL and version # (see Homebrew/Library/Homebrew/download_strategy.rb:cached_location). @@ -110,7 +113,7 @@ function brew_add_local_bottles { else echo "Link file is missing or of invalid type!" >&2 fi - + # Delete cached bottle and all metadata if invalid if [[ -z "$BOTTLE_EXISTS" || -n "$VERSION_MISMATCH" || -n "$BOTTLE_MISMATCH" ]]; then echo "Deleting the cached bottle and all metadata" @@ -133,11 +136,11 @@ function brew_add_local_bottles { git commit -m "Removed obsolete local bottle ${JSON_VERSION}_${JSON_REBUILD} :${OS_CODENAME}" "$FORMULA" ) fi - + if [ -n "$BOTTLE" -a -n "$BOTTLE_EXISTS" ]; then rm "$BOTTLE"; fi rm -f "$BOTTLE_LINK" rm "$JSON" - + #(Re)add metadata to the formula otherwise else if [ "$FORMULA_BOTTLE_HASH" == "$BOTTLE_HASH" ]; then @@ -156,7 +159,7 @@ function brew_cache_cleanup { #Lefovers from some failure probably rm -f "$BREW_LOCAL_BOTTLE_METADATA"/*.tar.gz - + #`brew cleanup` may delete locally-built bottles that weren't needed this time # so we're saving and restoring them local BOTTLE_LINK BOTTLE @@ -187,16 +190,16 @@ function brew_go_bootstrap_mode { local EXIT_CODE=${1:-1} echo "Going into cache bootstrap mode" - + BREW_BOOTSTRAP_MODE=1 - + #Can't just `exit` because that would terminate the build without saving the cache #Have to replace further actions with no-ops - + local MESSAGE=""; if [ "$EXIT_CODE" -ne 0 ]; then MESSAGE='Building dependencies took too long. Restart the build in Travis UI to continue from cache.'; fi - + eval ' function '"$cmd"' { return 0; } function repair_wheelhouse { return 0; } @@ -205,11 +208,11 @@ function brew_go_bootstrap_mode { echo \ ' echo -e "\n'"$MESSAGE"'\n"' fi)"\ - ' + ' # Travis runs user scripts via `eval` i.e. in the same shell process. # So have to unset errexit in order to get to cache save stage set +e; return '"$EXIT_CODE"' - }' + }' } @@ -228,15 +231,15 @@ function _brew_install_and_cache_within_time_limit { if grep -qxFf <(cat <<<"$_BREW_ALREADY_INSTALLED") <<<"$PACKAGE"; then MARKED_INSTALLED=1 fi - + if [ -n "$MARKED_INSTALLED" ] || (brew list --versions "$PACKAGE" >/dev/null && ! (brew outdated | grep -qxF "$PACKAGE")); then echo "Already installed and the latest version: $PACKAGE" if [ -z "$MARKED_INSTALLED" ]; then _brew_mark_installed "$PACKAGE"; fi return 0 fi - + local BUILD_FROM_SOURCE INCLUDE_BUILD KEG_ONLY - + _brew_is_bottle_available "$PACKAGE" KEG_ONLY || BUILD_FROM_SOURCE=1 [ -n "$BUILD_FROM_SOURCE" ] && INCLUDE_BUILD="--include-build" || true @@ -246,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 @@ -254,7 +257,7 @@ function _brew_install_and_cache_within_time_limit { _brew_install_and_cache "$PACKAGE" "$([[ -z "$BUILD_FROM_SOURCE" ]] && echo 1 || echo 0)" "$KEG_ONLY" || return 2 _brew_check_elapsed_build_time "$TIME_START" "$TIME_LIMIT" || return $? } - + function _brew_parse_bottle_json { # Parse JSON file resulting from `brew bottle --json` @@ -262,18 +265,18 @@ function _brew_parse_bottle_json { local JSON; JSON="${1:?}"; shift - local JSON_DATA; JSON_DATA=$(python2.7 -c 'if True: + local JSON_DATA; JSON_DATA=$(python3 -c 'if True: import sys,json; j=json.load(open(sys.argv[1],"rb")); [name]=j.keys(); [pdata]=j.values() - print name - print pdata["formula"]["pkg_version"] - print pdata["bottle"]["rebuild"] + print(name) + print(pdata["formula"]["pkg_version"]) + print(pdata["bottle"]["rebuild"]) [(tag_name, tag_dict)]=pdata["bottle"]["tags"].items() - print tag_name - print tag_dict["sha256"] + print(tag_name) + print(tag_dict["sha256"]) ' "$JSON") - + unset JSON - + { local i v; for i in {1..5}; do read -r v eval "${1:?}=\"$v\"" @@ -284,25 +287,25 @@ function _brew_parse_bottle_json { function _brew_parse_package_info { # Get and parse `brew info --json` about a package # and save data into specified variables - + local PACKAGE OS_CODENAME PACKAGE="${1:?}"; shift OS_CODENAME="${1:?}"; shift - local JSON_DATA; JSON_DATA=$(python2.7 -c 'if True: + local JSON_DATA; JSON_DATA=$(python3 -c 'if True: import sys, json, subprocess; j=json.loads(subprocess.check_output(("brew","info","--json=v1",sys.argv[1]))) data=j[0] revision=data["revision"] # in bottle''s json, revision is included into version; here, they are separate - print data["versions"]["stable"]+("_"+str(revision) if revision else "") + print(data["versions"]["stable"]+("_"+str(revision) if revision else "")) bottle_data=data["bottle"].get("stable",{"rebuild":"","files":{}}) - print bottle_data["rebuild"] - print bottle_data["files"].get(sys.argv[2],{"sha256":"!?"})["sha256"] #prevent losing trailing blank line to command substitution + print(bottle_data["rebuild"]) + print(bottle_data["files"].get(sys.argv[2],{"sha256":"!?"})["sha256"]) #prevent losing trailing blank line to command substitution ' \ "$PACKAGE" "$OS_CODENAME"); JSON_DATA="${JSON_DATA%\!\?}" #!? can't occur in a hash - + unset PACKAGE OS_CODENAME - + { local i v; for i in {1..3}; do read -r v eval "${1:?}=\"$v\"" @@ -346,13 +349,13 @@ function _brew_install_and_cache { # Install bottle or make and cache bottle. # assumes that deps were already installed # and not already the latest version - + local PACKAGE USE_BOTTLE KEG_ONLY PACKAGE="${1:?}" USE_BOTTLE="${2:?}" KEG_ONLY="${3:?}" local VERB - + if brew list --versions "$PACKAGE"; then # Install alongside the old version to avoid to have to update "runtime dependents" # https://discourse.brew.sh/t/can-i-install-a-new-version-without-having-to-upgrade-runtime-dependents/4443 @@ -363,7 +366,7 @@ function _brew_install_and_cache { else VERB=install fi - + if [[ "$USE_BOTTLE" -gt 0 ]]; then echo "Installing bottle for: $PACKAGE" brew $VERB "$PACKAGE" @@ -380,12 +383,12 @@ function _brew_install_and_cache { #proper procedure as per https://discourse.brew.sh/t/how-are-bottle-and-postinstall-related-is-it-safe-to-run-bottle-after-postinstall/3410/4 brew uninstall --ignore-dependencies "$PACKAGE" brew $VERB "$BOTTLE" - + local JSON; JSON=$(sed -E 's/bottle(.[[:digit:]]+)?\.tar\.gz$/bottle.json/' <<<"$BOTTLE") - + #`brew bottle --merge` doesn't return nonzero on nonexisting json file test -f "$JSON" -a -f "$BOTTLE" - + brew bottle --merge --write "$JSON" local CACHED_BOTTLE; CACHED_BOTTLE="$(brew --cache "$PACKAGE")" mv "$BOTTLE" "$CACHED_BOTTLE"; @@ -394,9 +397,9 @@ function _brew_install_and_cache { #Symlinks aren't cached by Travis. Will just save paths in files then. local BOTTLE_LINK; BOTTLE_LINK="${CACHED_JSON}.bottle.lnk" echo "$CACHED_BOTTLE" >"$BOTTLE_LINK" - + fi - + _brew_mark_installed "$PACKAGE" } @@ -411,11 +414,11 @@ function _brew_check_elapsed_build_time { local TIME_START TIME_LIMIT ELAPSED_TIME TIME_START="${1:?}" TIME_LIMIT="${2:?}" - + ELAPSED_TIME=$(($(date +%s) - $TIME_START)) echo "Elapsed time: "$(($ELAPSED_TIME/60))"m (${ELAPSED_TIME}s)" - - if [[ "$ELAPSED_TIME" -gt $TIME_LIMIT ]]; then + + if [[ "$ELAPSED_TIME" -gt $TIME_LIMIT ]]; then brew_go_bootstrap_mode return 1 fi @@ -426,19 +429,19 @@ function _brew_check_slow_building_ahead { #If the package's projected build completion is higher than hard limit, # skip it and arrange for further build to be skipped and return 1 - + local PACKAGE TIME_START TIME_HARD_LIMIT PACKAGE="${1:?}" TIME_START="${2:?}" TIME_HARD_LIMIT="${3:?}" - - local PROJECTED_BUILD_TIME + + local PROJECTED_BUILD_TIME PROJECTED_BUILD_TIME=$(echo "$BREW_SLOW_BUILIDING_PACKAGES" | awk '$1=="'"$PACKAGE"'"{print $2}') [ -z "$PROJECTED_BUILD_TIME" ] && return 0 || true - + local PROJECTED_BUILD_END_ELAPSED_TIME PROJECTED_BUILD_END_ELAPSED_TIME=$(( $(date +%s) - TIME_START + PROJECTED_BUILD_TIME * 60)) - + if [[ "$PROJECTED_BUILD_END_ELAPSED_TIME" -ge "$TIME_HARD_LIMIT" ]]; then echo -e "\nProjected build end elapsed time for $PACKAGE: $((PROJECTED_BUILD_END_ELAPSED_TIME/60))m ($PROJECTED_BUILD_END_ELAPSED_TIMEs)" brew_go_bootstrap_mode