From 700cb0095233e104d6c9e96bb45d3d3312015cd1 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Thu, 3 Mar 2022 11:12:51 +0300 Subject: [PATCH 01/24] Defined static version of windows server --- .github/workflows/build_wheels_windows.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 0f697291..cb2beb12 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest] + os: [windows-2019] python-version: ['3.6'] platform: [x86, x64] with_contrib: [0, 1] @@ -86,7 +86,7 @@ jobs: strategy: fail-fast: false matrix: - os: [windows-latest] + os: [windows-2019] python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] platform: [x86, x64] with_contrib: [0, 1] From 141a763d0e2675476b92e4a15359b19684c68eb2 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Thu, 3 Mar 2022 11:30:02 +0300 Subject: [PATCH 02/24] Updated MSBuild action --- .github/workflows/build_wheels_windows.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index cb2beb12..0262c7b8 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -53,7 +53,7 @@ jobs: architecture: ${{ matrix.platform }} - name: Setup MSBuild.exe - uses: warrenbuckley/Setup-MSBuild@v1 + uses: microsoft/setup-msbuild@v1.1 - name: Build a package run: | From 602a8be9e21df225a32827a621f15d7be0e5eebd Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Thu, 3 Mar 2022 14:00:43 +0300 Subject: [PATCH 03/24] Defined ffmpeg version for macos (4.4.1) and fixed MacOS build --- .github/workflows/build_wheels_macos.yml | 1 + travis_config.sh | 37 ++++++------------------ 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index 87fe6f99..c70f2b2d 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -55,6 +55,7 @@ jobs: USE_CCACHE: 1 UNICODE_WIDTH: 32 PLAT: x86_64 + FFMPEG_FORMULA_VERSION: '@4' SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} diff --git a/travis_config.sh b/travis_config.sh index 7bbfec68..dfb656e8 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -50,7 +50,7 @@ if [ -n "$IS_OSX" ]; then function generate_ffmpeg_formula { local FF="ffmpeg" local LFF="ffmpeg_opencv" - local FF_FORMULA; FF_FORMULA=$(brew formula "$FF") + local FF_FORMULA; FF_FORMULA=$(brew formula "${FF}${FFMPEG_FORMULA_VERSION}") local LFF_FORMULA; LFF_FORMULA="$(dirname "$FF_FORMULA")/${LFF}.rb" local REGENERATE @@ -70,8 +70,9 @@ if [ -n "$IS_OSX" ]; then if [ -n "$REGENERATE" ]; then echo "Regenerating custom ffmpeg formula" # Bottle block syntax: https://docs.brew.sh/Bottles#bottle-dsl-domain-specific-language + # FfmpegAT4 is a class in ffmpeg@4 formula perl -wpe 'BEGIN {our ($found_blank, $bottle_block);} - if (/(^class )(Ffmpeg)(\s.*)/) {$_=$1.$2."Opencv".$3."\n"; next;} + if (/(^class )(FfmpegAT4)(\s.*)/) {$_=$1."FfmpegOpencv".$3."\n"; next;} if (!$found_blank && /^$/) {$_.="conflicts_with \"ffmpeg\"\n\n"; $found_blank=1; next;} if (!$bottle_block && /^\s*bottle do$/) { $bottle_block=1; next; } if ($bottle_block) { if (/^\s*end\s*$/) { $bottle_block=0} elsif (/^\s*sha256\s/) {$_=""} next; } @@ -111,34 +112,14 @@ function pre_build { CACHE_STAGE= export HOMEBREW_NO_AUTO_UPDATE=1 - #after the cache stage, all bottles and Homebrew metadata should be already cached locally - # if [ -n "$CACHE_STAGE" ]; then - # brew update - # generate_ffmpeg_formula - # brew_add_local_bottles - # fi - echo 'Installing FFmpeg' - # if [ -n "$CACHE_STAGE" ]; then - # brew_install_and_cache_within_time_limit ffmpeg_opencv || { [ $? -gt 1 ] && return 2 || return 0; } - # else - brew update - generate_ffmpeg_formula - brew_add_local_bottles - # brew unlink python@2 - brew install --build-bottle ffmpeg_opencv - # fi - - # echo 'Installing qt5' - - # if [ -n "$CACHE_STAGE" ]; then - # echo "Qt5 has bottle, no caching needed" - # else - # brew switch qt 5.13.2 - # brew pin qt - # export PATH="/usr/local/opt/qt/bin:$PATH" - # fi + brew update + generate_ffmpeg_formula + brew_add_local_bottles + brew install --build-bottle ffmpeg_opencv + # It needs when we use not the latest ffmpeg formula + brew link ffmpeg_opencv if [ -n "$CACHE_STAGE" ]; then brew_go_bootstrap_mode 0 From 9de011e3885dc2a7d4f39f4a5d289857395b3eb8 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 22 Mar 2022 17:57:51 +0300 Subject: [PATCH 04/24] Added pylint test --- .github/workflows/build_wheels_macos.yml | 5 +++ .github/workflows/build_wheels_macos_m1.yml | 5 +++ .github/workflows/build_wheels_windows.yml | 6 ++++ tests/pylint.py | 3 ++ travis_config.sh | 37 ++++++++++----------- 5 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 tests/pylint.py diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index c70f2b2d..2e434a5f 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -171,6 +171,11 @@ jobs: cd ${{ github.workspace }}/opencv python modules/python/test/test.py -v --repo . + - name: Pylint test + run: | + python -m pip install pylint + python -m pylint ${{ github.workspace }}/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring + test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, test] diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 3711e1b3..46ecb631 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -106,6 +106,11 @@ jobs: cd ${{ github.workspace }}/opencv arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo . + - name: Pylint test + run: | + arch -arm64 python${{ matrix.python-version }} -m pip install pylint + arch -arm64 python${{ matrix.python-version }} -m pylint ${{ github.workspace }}/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring + test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, test] diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 0262c7b8..cee1d848 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -130,6 +130,12 @@ jobs: python modules\python\test\test.py -v --repo . shell: cmd + - name: Pylint test + run: | + python -m pip install pylint + python -m pylint ${{ github.workspace }}\tests\pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring + shell: cmd + test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build-windows-x86_64, test] diff --git a/tests/pylint.py b/tests/pylint.py new file mode 100644 index 00000000..d10ad684 --- /dev/null +++ b/tests/pylint.py @@ -0,0 +1,3 @@ +from cv2 import getStructuringElement, MORPH_ELLIPSE + +a = getStructuringElement(MORPH_ELLIPSE, (3, 3)) diff --git a/travis_config.sh b/travis_config.sh index dfb656e8..751a1772 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -141,37 +141,36 @@ function run_tests { PYTHON=python$PYTHON_VERSION - if [ -n "$IS_OSX" ]; then - echo "Running for OS X" - - cd ../tests - $PYTHON get_build_info.py - - cd ../opencv/ - export OPENCV_TEST_DATA_PATH=../opencv_extra/testdata - else - echo "Running for linux" - - if [ $PYTHON == "python3.6" ]; then - $PYTHON -m pip install -U numpy==1.19.4 - fi - cd /io/tests - $PYTHON get_build_info.py + echo "Running for linux" - cd /io/opencv - export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata + if [ $PYTHON == "python3.6" ]; then + $PYTHON -m pip install -U numpy==1.19.4 fi + cd /io/tests + $PYTHON get_build_info.py + + cd /io/opencv + export OPENCV_TEST_DATA_PATH=/io/opencv_extra/testdata test_wheels + pylint_test } function test_wheels { - echo "Starting tests..." + echo "Starting OpenCV tests..." #Test package $PYTHON modules/python/test/test.py -v --repo . } +function pylint_test { + + echo "Starting Pylint tests..." + + $PYTHON -m pip install pylint + $PYTHON -m pylint /io/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring +} + export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' set -x From 1e26c5d08c182fdbb09d73bc97594bab793e79f6 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Wed, 23 Mar 2022 10:38:47 +0300 Subject: [PATCH 05/24] Pinned pylint version --- .github/workflows/build_wheels_macos.yml | 2 +- .github/workflows/build_wheels_macos_m1.yml | 2 +- .github/workflows/build_wheels_windows.yml | 2 +- travis_config.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index 2e434a5f..f22d56e1 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -173,7 +173,7 @@ jobs: - name: Pylint test run: | - python -m pip install pylint + python -m pip install pylint==2.12.2 python -m pylint ${{ github.workspace }}/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring test_release_opencv_python: diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 46ecb631..1f51a342 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -108,7 +108,7 @@ jobs: - name: Pylint test run: | - arch -arm64 python${{ matrix.python-version }} -m pip install pylint + arch -arm64 python${{ matrix.python-version }} -m pip install pylint==2.12.2 arch -arm64 python${{ matrix.python-version }} -m pylint ${{ github.workspace }}/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring test_release_opencv_python: diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index cee1d848..bf9f9906 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -132,7 +132,7 @@ jobs: - name: Pylint test run: | - python -m pip install pylint + python -m pip install pylint==2.12.2 python -m pylint ${{ github.workspace }}\tests\pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring shell: cmd diff --git a/travis_config.sh b/travis_config.sh index 751a1772..db3bf773 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -168,7 +168,7 @@ function pylint_test { echo "Starting Pylint tests..." - $PYTHON -m pip install pylint + $PYTHON -m pip install pylint==2.12.2 $PYTHON -m pylint /io/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring } From ed16e8ef97a35647aa129f167ade956e4630714f Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Wed, 23 Mar 2022 16:20:07 +0300 Subject: [PATCH 06/24] Changed using custom test for pylint to opencv sample --- .github/workflows/build_wheels_linux.yml | 2 +- .github/workflows/build_wheels_macos.yml | 4 +++- .github/workflows/build_wheels_macos_m1.yml | 4 +++- .github/workflows/build_wheels_windows.yml | 4 +++- tests/pylint.py | 3 --- tests/pylintrc | 12 ++++++++++++ travis_config.sh | 3 ++- 7 files changed, 24 insertions(+), 8 deletions(-) delete mode 100644 tests/pylint.py create mode 100644 tests/pylintrc diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index bd42944c..5ed44e21 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -102,7 +102,7 @@ jobs: - name: Checkout uses: actions/checkout@v2 with: - submodules: false + submodules: true fetch-depth: 0 - name: Setup Environment variables diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index f22d56e1..bccec01f 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -137,6 +137,7 @@ jobs: CONFIG_PATH: travis_config.sh PLAT: x86_64 OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata + PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py steps: - name: Checkout @@ -174,7 +175,8 @@ jobs: - name: Pylint test run: | python -m pip install pylint==2.12.2 - python -m pylint ${{ github.workspace }}/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring + cd ${{ github.workspace }}/tests + python -m pylint $PYLINT_TEST_FILE test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 1f51a342..9f7b0f37 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -81,6 +81,7 @@ jobs: env: OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata + PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py steps: - name: Checkout @@ -109,7 +110,8 @@ jobs: - name: Pylint test run: | arch -arm64 python${{ matrix.python-version }} -m pip install pylint==2.12.2 - arch -arm64 python${{ matrix.python-version }} -m pylint ${{ github.workspace }}/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring + cd ${{ github.workspace }}/tests + arch -arm64 python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index bf9f9906..337c77b2 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -96,6 +96,7 @@ jobs: env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata + PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py steps: - name: Checkout @@ -133,7 +134,8 @@ jobs: - name: Pylint test run: | python -m pip install pylint==2.12.2 - python -m pylint ${{ github.workspace }}\tests\pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring + cd ${{ github.workspace }}\tests + python -m pylint $PYLINT_TEST_FILE shell: cmd test_release_opencv_python: diff --git a/tests/pylint.py b/tests/pylint.py deleted file mode 100644 index d10ad684..00000000 --- a/tests/pylint.py +++ /dev/null @@ -1,3 +0,0 @@ -from cv2 import getStructuringElement, MORPH_ELLIPSE - -a = getStructuringElement(MORPH_ELLIPSE, (3, 3)) 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 db3bf773..4560f726 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -169,7 +169,8 @@ function pylint_test { echo "Starting Pylint tests..." $PYTHON -m pip install pylint==2.12.2 - $PYTHON -m pylint /io/tests/pylint.py --extension-pkg-whitelist=cv2 --disable=missing-docstring + cd /io/tests + $PYTHON -m pylint /io/opencv/samples/python/squares.py } export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' From 3a4c30e50438a3f50c28deb80d16b96235dc7bb7 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Thu, 24 Mar 2022 18:17:16 +0300 Subject: [PATCH 07/24] Added pre-downloaded 3rdparty files to source packages --- .github/workflows/build_wheels_linux.yml | 6 ++++-- scripts/source-packages-preparation.sh | 20 ++++++++++++++++++++ setup.py | 2 ++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 scripts/source-packages-preparation.sh diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 5ed44e21..3e3e010b 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -171,12 +171,14 @@ jobs: - name: Build a package run: | + # Download all 3rdparty files + source scripts/source-packages-preparation.sh ${{ github.workspace }} set -e # Build and package set -x python -m pip install --upgrade pip python -m pip install scikit-build - python setup.py sdist + python setup.py sdist --formats=xztar set +x # Install and run tests set -x @@ -186,7 +188,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: wheels - path: dist/opencv*.tar.gz + path: dist/opencv*.tar.xz test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease diff --git a/scripts/source-packages-preparation.sh b/scripts/source-packages-preparation.sh new file mode 100755 index 00000000..be49b5b8 --- /dev/null +++ b/scripts/source-packages-preparation.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# ${1} variable is a path to repository opencv-python + +# Define flags +if [ "0" == $ENABLE_CONTRIB ]; then + git submodule update --init opencv + EXTRA_CMAKE_OPTIONS="-DOPENCV_DOWNLOAD_PATH=${1}/opencv/3rdparty" +else + git submodule update --init opencv opencv_contrib + EXTRA_CMAKE_OPTIONS="-DOPENCV_DOWNLOAD_PATH=${1}/opencv/3rdparty -DOPENCV_EXTRA_MODULES_PATH=${1}/opencv_contrib/modules" +fi + +# Download 3rdparty files +cd opencv && \ +mkdir generate && \ +cd generate && \ +cmake $EXTRA_CMAKE_OPTIONS ${1}/opencv && \ +cd ${1} && \ +rm -rf opencv/generate diff --git a/setup.py b/setup.py index 5b79e389..c9f09212 100644 --- a/setup.py +++ b/setup.py @@ -162,6 +162,8 @@ def main(): "-DPYTHON3_LIMITED_API=ON", "-DBUILD_OPENEXR=ON", "-DBUILD_PNG=ON", + # To have all 3rdparty files in one place for source packages + "-DOPENCV_DOWNLOAD_PATH=%s" % (os.path.join(os.path.dirname(os.path.abspath(__file__)), "opencv", "3rdparty")), ] + ( # If it is not defined 'linker flags: /machine:X86' on Windows x64 From 7ba53fc4f48894593bda7493709d542e38e2c36d Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 25 Mar 2022 11:52:15 +0300 Subject: [PATCH 08/24] Revert changes for pre-downloaded files --- .github/workflows/build_wheels_linux.yml | 2 -- scripts/source-packages-preparation.sh | 20 -------------------- setup.py | 2 -- 3 files changed, 24 deletions(-) delete mode 100755 scripts/source-packages-preparation.sh diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 3e3e010b..a368661d 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -171,8 +171,6 @@ jobs: - name: Build a package run: | - # Download all 3rdparty files - source scripts/source-packages-preparation.sh ${{ github.workspace }} set -e # Build and package set -x diff --git a/scripts/source-packages-preparation.sh b/scripts/source-packages-preparation.sh deleted file mode 100755 index be49b5b8..00000000 --- a/scripts/source-packages-preparation.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# ${1} variable is a path to repository opencv-python - -# Define flags -if [ "0" == $ENABLE_CONTRIB ]; then - git submodule update --init opencv - EXTRA_CMAKE_OPTIONS="-DOPENCV_DOWNLOAD_PATH=${1}/opencv/3rdparty" -else - git submodule update --init opencv opencv_contrib - EXTRA_CMAKE_OPTIONS="-DOPENCV_DOWNLOAD_PATH=${1}/opencv/3rdparty -DOPENCV_EXTRA_MODULES_PATH=${1}/opencv_contrib/modules" -fi - -# Download 3rdparty files -cd opencv && \ -mkdir generate && \ -cd generate && \ -cmake $EXTRA_CMAKE_OPTIONS ${1}/opencv && \ -cd ${1} && \ -rm -rf opencv/generate diff --git a/setup.py b/setup.py index c9f09212..5b79e389 100644 --- a/setup.py +++ b/setup.py @@ -162,8 +162,6 @@ def main(): "-DPYTHON3_LIMITED_API=ON", "-DBUILD_OPENEXR=ON", "-DBUILD_PNG=ON", - # To have all 3rdparty files in one place for source packages - "-DOPENCV_DOWNLOAD_PATH=%s" % (os.path.join(os.path.dirname(os.path.abspath(__file__)), "opencv", "3rdparty")), ] + ( # If it is not defined 'linker flags: /machine:X86' on Windows x64 From ad010427c7197033532b3f2238b273bb9a5513fb Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 25 Mar 2022 17:10:44 +0300 Subject: [PATCH 09/24] Skip only gapi if it was not found --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c9f09212..2fbdc816 100644 --- a/setup.py +++ b/setup.py @@ -414,7 +414,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 From f68be384bb0310f1fdf95351fdffda7bf288b8d1 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 25 Mar 2022 17:10:44 +0300 Subject: [PATCH 10/24] Skip only gapi if it was not found --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 5b79e389..5784d5a4 100644 --- a/setup.py +++ b/setup.py @@ -412,7 +412,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 From 96cffde198e5bc3411a9577b97021ce59477f97a Mon Sep 17 00:00:00 2001 From: Yclept Nemo Date: Mon, 21 Mar 2022 15:06:30 -0400 Subject: [PATCH 11/24] Synchronize with scikit-build scikit-build commit 94089992b353ea3e4b4c2f118ea1987ca54ecbb8: skbuild/setuptools_wrap.py:_classify_installed_files cmake_install_dir -> _cmake_install_dir This allows tracking scikit-build versions >= 0.13.2. The dependencies file has been updated. --- pyproject.toml | 3 ++- setup.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6aaab1d3..a47525d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,7 @@ [build-system] requires = [ - "setuptools", "wheel", "scikit-build", "cmake", "pip", + "setuptools", "wheel", "cmake", "pip", + "scikit-build>=0.13.2", "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'", diff --git a/setup.py b/setup.py index 5b79e389..3714e9e3 100644 --- a/setup.py +++ b/setup.py @@ -451,7 +451,7 @@ def _classify_installed_files_override( data_files, # To get around a check that prepends source dir to paths and breaks package detection code. cmake_source_dir="", - cmake_install_dir=cmake_install_reldir, + _cmake_install_dir=cmake_install_reldir, ) From 7419f5820ea9c4d2d816f484f1930f2eca23e9cb Mon Sep 17 00:00:00 2001 From: Niyas Sait Date: Mon, 28 Mar 2022 10:13:56 +0100 Subject: [PATCH 12/24] add support for building windows/arm64 package --- setup.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 5784d5a4..b5c5580a 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ def main(): ) # https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode - x64 = sys.maxsize > 2 ** 32 + is64 = sys.maxsize > 2 ** 32 package_name = "opencv-python" @@ -88,7 +88,7 @@ def main(): # Path regexes with forward slashes relative to CMake install dir. rearrange_cmake_output_data = { "cv2": ( - [r"bin/opencv_videoio_ffmpeg\d{3}%s\.dll" % ("_64" if x64 else "")] + [r"bin/opencv_videoio_ffmpeg\d{3}%s\.dll" % ("_64" if is64 else "")] if os.name == "nt" else [] ) @@ -130,7 +130,7 @@ def main(): files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]} ci_cmake_generator = ( - ["-G", "Visual Studio 14" + (" Win64" if x64 else "")] + ["-G", "Visual Studio 14" + (" Win64" if is64 else "")] if os.name == "nt" else ["-G", "Unix Makefiles"] ) @@ -164,9 +164,15 @@ def main(): "-DBUILD_PNG=ON", ] + ( + # CMake flags for windows/arm64 build + ["-DCMAKE_GENERATOR_PLATFORM=ARM64", + # Emulated cmake requires following flags to correctly detect + # target architecture for windows/arm64 build + "-DOPENCV_WORKAROUND_CMAKE_20989=ON", + "-DCMAKE_SYSTEM_PROCESSOR=ARM64"] + if platform.machine() == "ARM64" and sys.platform == "win32" # If it is not defined 'linker flags: /machine:X86' on Windows x64 - ["-DCMAKE_GENERATOR_PLATFORM=x64"] - if x64 and sys.platform == "win32" + else ["-DCMAKE_GENERATOR_PLATFORM=x64"] if is64 and sys.platform == "win32" else [] ) + ( @@ -186,7 +192,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 From 4b068fcba76c2d61a041ed87f7e36b8248b53397 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Thu, 7 Apr 2022 13:34:12 +0300 Subject: [PATCH 13/24] Pinned versions for dependencies --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a47525d5..f237ddbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools", "wheel", "cmake", "pip", + "setuptools==59.2.0", "wheel==0.37.0", "cmake==3.22.3", "pip", "scikit-build>=0.13.2", "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'", From f89dca7a27c9ba9659b0b3091e4f64ac1c9bc13d Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 8 Apr 2022 10:01:04 +0300 Subject: [PATCH 14/24] Downgraded cmake version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f237ddbc..ade9bc2d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools==59.2.0", "wheel==0.37.0", "cmake==3.22.3", "pip", + "setuptools==59.2.0", "wheel==0.37.0", "cmake>=3.6.3", "pip", "scikit-build>=0.13.2", "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'", From 443b747a4ee7ff8d23af221e0361d7f199d5c8ae Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Fri, 8 Apr 2022 10:30:35 +0300 Subject: [PATCH 15/24] Downgraded cmake version to 3.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index ade9bc2d..ff535e86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "setuptools==59.2.0", "wheel==0.37.0", "cmake>=3.6.3", "pip", + "setuptools==59.2.0", "wheel==0.37.0", "cmake>=3.1", "pip", "scikit-build>=0.13.2", "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'", "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'", From 3ac27ad2f3648e4c750a4c3230171713cd2d1edf Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 01:23:49 +0300 Subject: [PATCH 16/24] Updated dependecies for the next release --- .github/workflows/build_wheels_linux.yml | 4 +- .github/workflows/build_wheels_linux_arm.yml | 2 +- docker/manylinux2014/Dockerfile_aarch64 | 77 +++++++++++++++---- docker/manylinux2014/Dockerfile_x86_64 | 79 ++++++++++++++++---- setup.py | 1 - travis_config.sh | 5 -- 6 files changed, 127 insertions(+), 41 deletions(-) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index a368661d..fac5ebad 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -39,7 +39,7 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 PLAT: x86_64 @@ -145,7 +145,7 @@ jobs: NP_TEST_DEP: numpy==1.19.4 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 1 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index a97bbc29..c58e0631 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -40,7 +40,7 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} USE_CCACHE: 0 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index b380d3ba..fedf1e98 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -2,29 +2,60 @@ FROM quay.io/pypa/manylinux2014_aarch64:latest ARG CCACHE_VERSION=3.7.9 ARG FFMPEG_VERSION=4.4.1 +ARG FREETYPE_VERSION=2.12.1 +ARG LIBPNG_VERSION=1.6.37 ARG NASM_VERSION=2.15.04 -ARG OPENSSL_VERSION=1_1_1m +ARG OPENSSL_VERSION=1_1_1o ARG QT_VERSION=5.15.0 ARG YASM_VERSION=1.3.0 -RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel freetype-devel -y +ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH + +# epel-release need for aarch64 to get openblas packages +RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \ + yum install openblas-devel -y && \ + cp /usr/include/lapacke/lapacke*.h /usr/include/ && \ + curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \ + # libpng will be built from source + yum remove libpng -y + +RUN mkdir ~/libpng_sources && \ + cd ~/libpng_sources && \ + curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \ + tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \ + cd libpng-${LIBPNG_VERSION} && \ + ./configure --prefix=/usr/local && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/libpng_sources + +RUN mkdir ~/freetype_sources && \ + cd ~/freetype_sources && \ + curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ + tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ + cd freetype-${FREETYPE_VERSION} && \ + ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/freetype_sources RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \ tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \ - cd qt-everywhere* && \ + cd qt-everywhere-src-${QT_VERSION} && \ export MAKEFLAGS=-j$(nproc) && \ ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \ make && \ make install && \ cd .. && \ - rm -rf qt-everywhere-src-${QT_VERSION} && \ - rm qt-everywhere-src-${QT_VERSION}.tar.xz + rm -rf qt-everywhere* ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" -RUN mkdir ~/ffmpeg_sources && \ - cd ~/ffmpeg_sources && \ +RUN mkdir ~/openssl_sources && \ + cd ~/openssl_sources && \ curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ cd openssl-OpenSSL_${OPENSSL_VERSION} && \ @@ -32,31 +63,40 @@ RUN mkdir ~/ffmpeg_sources && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ - rm -rf ~/openssl_build + cd .. && \ + rm -rf ~/openssl_build ~/openssl_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/nasm_sources && \ + cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/nasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/yasm_sources && \ + cd ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/yasm_sources -RUN cd ~/ffmpeg_sources && \ - git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ +RUN mkdir ~/libvpx_sources && \ + cd ~/libvpx_sources && \ + git clone --depth 1 https://github.com/webmproject/libvpx.git && \ cd libvpx && \ ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/ffmpeg_sources && \ + cd ~/ffmpeg_sources && \ curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ @@ -66,7 +106,8 @@ RUN cd ~/ffmpeg_sources && \ make install && \ echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ - rm -rf ~/ffmpeg_sources + rm -rf ~/ffmpeg_sources && \ + yum remove bzip2-devel -y RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \ tar -xf ccache-${CCACHE_VERSION}.tar.gz && \ @@ -75,6 +116,10 @@ RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERS make -j$(getconf _NPROCESSORS_ONLN) && \ make install +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced +RUN mkdir /io && \ + git config --global --add safe.directory /io + ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig ENV LDFLAGS -L/root/ffmpeg_build/lib ENV PATH "$HOME/bin:$PATH" diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64 index fb367c0a..13325756 100644 --- a/docker/manylinux2014/Dockerfile_x86_64 +++ b/docker/manylinux2014/Dockerfile_x86_64 @@ -1,29 +1,60 @@ FROM quay.io/pypa/manylinux2014_x86_64:latest ARG FFMPEG_VERSION=4.4.1 +ARG FREETYPE_VERSION=2.12.1 +ARG LIBPNG_VERSION=1.6.37 ARG NASM_VERSION=2.15.04 -ARG OPENSSL_VERSION=1_1_1m +ARG OPENSSL_VERSION=1_1_1o ARG QT_VERSION=5.15.0 ARG YASM_VERSION=1.3.0 -RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel freetype-devel -y +ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH + +# epel-release need for aarch64 to get openblas packages +RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \ + yum install openblas-devel -y && \ + cp /usr/include/lapacke/lapacke*.h /usr/include/ && \ + curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \ + # libpng will be built from source + yum remove libpng -y + +RUN mkdir ~/libpng_sources && \ + cd ~/libpng_sources && \ + curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \ + tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \ + cd libpng-${LIBPNG_VERSION} && \ + ./configure --prefix=/usr/local && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/libpng_sources + +RUN mkdir ~/freetype_sources && \ + cd ~/freetype_sources && \ + curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ + tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ + cd freetype-${FREETYPE_VERSION} && \ + ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + make && \ + make install && \ + cd .. && \ + rm -rf ~/freetype_sources RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \ tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \ - cd qt-everywhere* && \ + cd qt-everywhere-src-${QT_VERSION} && \ export MAKEFLAGS=-j$(nproc) && \ ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \ make && \ make install && \ cd .. && \ - rm -rf qt-everywhere-src-${QT_VERSION} && \ - rm qt-everywhere-src-${QT_VERSION}.tar.xz + rm -rf qt-everywhere* ENV QTDIR /opt/Qt${QT_VERSION} ENV PATH "$QTDIR/bin:$PATH" -RUN mkdir ~/ffmpeg_sources && \ - cd ~/ffmpeg_sources && \ +RUN mkdir ~/openssl_sources && \ + cd ~/openssl_sources && \ curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \ tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \ cd openssl-OpenSSL_${OPENSSL_VERSION} && \ @@ -31,31 +62,42 @@ RUN mkdir ~/ffmpeg_sources && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ - rm -rf ~/openssl_build + cd .. && \ + rm -rf ~/openssl_build ~/openssl_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/nasm_sources && \ + cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/nasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/yasm_sources && \ + cd ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/yasm_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/libvpx_sources && \ + cd ~/libvpx_sources && \ git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ cd libvpx && \ ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/libvpx_sources -RUN cd ~/ffmpeg_sources && \ +RUN mkdir ~/ffmpeg_sources && \ + cd ~/ffmpeg_sources && \ curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ @@ -65,7 +107,12 @@ RUN cd ~/ffmpeg_sources && \ make install && \ echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ - rm -rf ~/ffmpeg_sources + rm -rf ~/ffmpeg_sources && \ + yum remove bzip2-devel -y + +# Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced +RUN mkdir /io && \ + git config --global --add safe.directory /io ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/root/ffmpeg_build/lib/pkgconfig ENV LDFLAGS -L/root/ffmpeg_build/lib diff --git a/setup.py b/setup.py index 02d991b9..e9255907 100644 --- a/setup.py +++ b/setup.py @@ -161,7 +161,6 @@ def main(): "-DBUILD_DOCS=OFF", "-DPYTHON3_LIMITED_API=ON", "-DBUILD_OPENEXR=ON", - "-DBUILD_PNG=ON", ] + ( # If it is not defined 'linker flags: /machine:X86' on Windows x64 diff --git a/travis_config.sh b/travis_config.sh index 4560f726..366d35ad 100644 --- a/travis_config.sh +++ b/travis_config.sh @@ -98,11 +98,6 @@ function pre_build { if [ -n "$IS_OSX" ]; then brew install lapack - else - # epel-release need for aarch64 to get openblas packages - yum install -y lapack-devel epel-release && yum install -y openblas-devel - cp /usr/include/lapacke/lapacke*.h /usr/include/ - curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h fi if [ -n "$IS_OSX" ]; then From 4f8289d4627a42621303d9fce6f46b630950186e Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 10:48:58 +0300 Subject: [PATCH 17/24] Updated dependecies for the next release --- docker/manylinux2014/Dockerfile_aarch64 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index fedf1e98..03889a51 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -93,7 +93,9 @@ RUN mkdir ~/libvpx_sources && \ cd libvpx && \ ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ~/libvpx_sources RUN mkdir ~/ffmpeg_sources && \ cd ~/ffmpeg_sources && \ @@ -114,7 +116,9 @@ RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERS cd ccache-${CCACHE_VERSION} && \ linux32 ./configure && \ make -j$(getconf _NPROCESSORS_ONLN) && \ - make install + make install && \ + cd .. && \ + rm -rf ccache-${CCACHE_VERSION}.tar.gz # Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced RUN mkdir /io && \ From 9ec924e1818c9ee755458cb8ac71fd2475d0153d Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 13:31:34 +0300 Subject: [PATCH 18/24] Updated submodules to the latest commits --- opencv | 2 +- opencv_contrib | 2 +- opencv_extra | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opencv b/opencv index dad26339..d6151eae 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit dad26339a975b49cfb6c7dbe4bd5276c9dcb36e2 +Subproject commit d6151eae23aebdb3fce524a86026c2753daed685 diff --git a/opencv_contrib b/opencv_contrib index 49e8f123..84f8ea8e 160000 --- a/opencv_contrib +++ b/opencv_contrib @@ -1 +1 @@ -Subproject commit 49e8f123ca08e76891856a1ecce491b62d08ba20 +Subproject commit 84f8ea8e99f98d8ab7868dbd29cccb6bdd26fb94 diff --git a/opencv_extra b/opencv_extra index 37294e3c..c2cf721e 160000 --- a/opencv_extra +++ b/opencv_extra @@ -1 +1 @@ -Subproject commit 37294e3c876a72c992d4718b9bbfc8346b9e779a +Subproject commit c2cf721e3b8ce535900bc0f97a5cd17efb35361e From df365e5d8ca5cc0b4b29e26fdcc1837a38e8318e Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 13:33:43 +0300 Subject: [PATCH 19/24] Check changes on 3.4 branch in PRs --- .github/workflows/build_wheels_linux.yml | 1 + .github/workflows/build_wheels_linux_arm.yml | 1 + .github/workflows/build_wheels_macos.yml | 1 + .github/workflows/build_wheels_macos_m1.yml | 1 + .github/workflows/build_wheels_windows.yml | 1 + 5 files changed, 5 insertions(+) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index fac5ebad..362001fb 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux_arm.yml' - '.github/workflows/build_wheels_windows*' diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index c58e0631..a892040b 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux.yml' - '.github/workflows/build_wheels_windows*' diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index bccec01f..c453ab85 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_windows*' diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 9f7b0f37..1ac065f1 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_windows*' diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 337c77b2..0dad17b5 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - master + - 3.4 paths-ignore: - '.github/workflows/build_wheels_linux*' - '.github/workflows/build_wheels_macos*' From 5633cf319efadb628e8369b48834d74491c10b1a Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Tue, 31 May 2022 14:09:35 +0300 Subject: [PATCH 20/24] Removed unused lines --- setup.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/setup.py b/setup.py index 37366d9a..11014d6b 100644 --- a/setup.py +++ b/setup.py @@ -374,21 +374,6 @@ def _classify_installed_files_override( print("Copying files from CMake output") - # lines for a proper work using pylint and an autocomplete in IDE - with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'r') as opencv_init: - opencv_init_lines = opencv_init.readlines() - extra_imports = ('\nfrom .cv2 import *\nfrom .cv2 import _registerMatType\nfrom . import mat_wrapper\nfrom . import gapi' - '\nfrom . import misc\nfrom . import utils\nfrom . import data\nfrom . import version\n') - free_line_after_imports = 6 - opencv_init_lines.insert(free_line_after_imports, extra_imports) - opencv_init_data = "" - for line in opencv_init_lines: - opencv_init_replacement = line.replace('importlib.import_module("cv2")', 'importlib.import_module("cv2.cv2")') - opencv_init_data = opencv_init_data + opencv_init_replacement - - with open(os.path.join(cmake_install_dir, "python", "cv2", "__init__.py"), 'w') as opencv_final_init: - opencv_final_init.write(opencv_init_data) - # add lines from the old __init__.py file to the config file with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'scripts', '__init__.py'), 'r') as custom_init: custom_init_data = custom_init.read() From 04b1a52ac69811a33db2fb2110a03b2971c110e5 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Mon, 6 Jun 2022 00:48:04 +0300 Subject: [PATCH 21/24] Updated submodules to 4.6.0 release --- opencv | 2 +- opencv_contrib | 2 +- opencv_extra | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/opencv b/opencv index d6151eae..b0dc4741 160000 --- a/opencv +++ b/opencv @@ -1 +1 @@ -Subproject commit d6151eae23aebdb3fce524a86026c2753daed685 +Subproject commit b0dc474160e389b9c9045da5db49d03ae17c6a6b diff --git a/opencv_contrib b/opencv_contrib index 84f8ea8e..db16caf6 160000 --- a/opencv_contrib +++ b/opencv_contrib @@ -1 +1 @@ -Subproject commit 84f8ea8e99f98d8ab7868dbd29cccb6bdd26fb94 +Subproject commit db16caf6ceee76b43b94c846be276e92a43e9700 diff --git a/opencv_extra b/opencv_extra index c2cf721e..936854e2 160000 --- a/opencv_extra +++ b/opencv_extra @@ -1 +1 @@ -Subproject commit c2cf721e3b8ce535900bc0f97a5cd17efb35361e +Subproject commit 936854e2b666853d6d0732a8eabc2d699f4fa3d8 From 8d045058df0245039a8a8754d140a820548dedb8 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev Date: Wed, 8 Jun 2022 13:36:57 +0300 Subject: [PATCH 22/24] Changed format of an archive for source packages --- .github/workflows/build_wheels_linux.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 362001fb..5315e161 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -177,7 +177,7 @@ jobs: set -x python -m pip install --upgrade pip python -m pip install scikit-build - python setup.py sdist --formats=xztar + python setup.py sdist --formats=gztar set +x # Install and run tests set -x @@ -187,7 +187,7 @@ jobs: uses: actions/upload-artifact@v2 with: name: wheels - path: dist/opencv*.tar.xz + path: dist/opencv*.tar.gz test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease From 54473f17f7c138d4632b003a5e6f736e80481572 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 24 Jun 2022 22:09:56 +1000 Subject: [PATCH 23/24] Updated multibuild to upgrade default 64-bit test image to focal --- .gitmodules | 2 +- multibuild | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 655467e8..7193d3b9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/opencv/opencv_contrib.git [submodule "multibuild"] path = multibuild - url = https://github.com/matthew-brett/multibuild.git + url = https://github.com/multi-build/multibuild.git [submodule "opencv_extra"] path = opencv_extra url = https://github.com/opencv/opencv_extra.git diff --git a/multibuild b/multibuild index b89bb903..bce1637e 160000 --- a/multibuild +++ b/multibuild @@ -1 +1 @@ -Subproject commit b89bb903e94308be79abefa4f436bf123ebb1313 +Subproject commit bce1637e202cb52b0e7ea42baa1cccc894b82806 From 4638ce51fa4ce1b8a8752acdb2320a8b328d275f Mon Sep 17 00:00:00 2001 From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com> Date: Mon, 4 Jul 2022 16:08:39 +0300 Subject: [PATCH 24/24] Changed labeles for macOS ARM64 and Linux ARM64 builds (#681) * Changed labeles for macOS ARM64 and Linux ARM64 builds * Changed labeles for macOS ARM64 and Linux ARM64 builds * Added proper cleanup step for all workflows, removed unused lines, changed ubuntu-latest to ubuntu-20.04 * Updated docker images to work under non-root user, unified cleanup step --- .github/workflows/build_wheels_linux.yml | 53 +++++++------------- .github/workflows/build_wheels_linux_arm.yml | 41 ++++----------- .github/workflows/build_wheels_macos.yml | 31 +++--------- .github/workflows/build_wheels_macos_m1.yml | 31 ++++-------- .github/workflows/build_wheels_windows.yml | 51 +++++++------------ docker/manylinux2014/Dockerfile_aarch64 | 35 +++++++++---- docker/manylinux2014/Dockerfile_x86_64 | 45 +++++++++++++---- 7 files changed, 121 insertions(+), 166 deletions(-) diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml index 5315e161..98ad3dc8 100644 --- a/.github/workflows/build_wheels_linux.yml +++ b/.github/workflows/build_wheels_linux.yml @@ -15,21 +15,18 @@ on: jobs: build: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ubuntu-latest] python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -40,34 +37,32 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} - USE_CCACHE: 1 + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20220628 + USE_CCACHE: 0 UNICODE_WIDTH: 32 PLAT: x86_64 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Build a package run: source scripts/build.sh - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -76,21 +71,18 @@ jobs: test: needs: [build] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ubuntu-latest] python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true MB_PYTHON_VERSION: ${{ matrix.python-version }} @@ -98,42 +90,38 @@ jobs: NP_TEST_DEP_LATEST: numpy==1.21.2 CONFIG_PATH: travis_config.sh PLAT: x86_64 - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Setup Environment variables run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ - - name: Package installation and run tests run: source scripts/install.sh build_sdist: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-20.04 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ubuntu-latest] python-version: [3.8] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [1] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -146,30 +134,29 @@ jobs: 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:${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20220628 USE_CCACHE: 1 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui || 0 }} ENABLE_CONTRIB: ${{ matrix.with_contrib || 0 }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Build a package run: | set -e @@ -182,7 +169,6 @@ jobs: # Install and run tests set -x echo "skipping tests because of sdist" - - name: saving artifacts uses: actions/upload-artifact@v2 with: @@ -192,7 +178,7 @@ jobs: test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, build_sdist, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -202,7 +188,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -211,7 +196,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build, build_sdist, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -221,22 +206,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* wheelhouse/opencv-python-[^h]* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* wheelhouse/opencv-contrib-python-[^h]* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* wheelhouse/opencv-python-headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml index a892040b..4d0c3daf 100644 --- a/.github/workflows/build_wheels_linux_arm.yml +++ b/.github/workflows/build_wheels_linux_arm.yml @@ -15,21 +15,18 @@ on: jobs: build_arm: - runs-on: ${{ matrix.os }} + runs-on: opencv-cn-lin-arm64 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ARM64] python-version: ['3.6'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -41,33 +38,30 @@ jobs: MB_ML_VER: 2014 TRAVIS_BUILD_DIR: ${{ github.workspace }} CONFIG_PATH: travis_config.sh - DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014:${PLAT} + DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20220628 USE_CCACHE: 0 UNICODE_WIDTH: 32 SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: UID + run: id -u - name: Cleanup - if: always() - uses: AutoModality/action-clean@v1 - + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Build a package run: source scripts/build.sh - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -76,21 +70,18 @@ jobs: test: needs: [build_arm] - runs-on: ${{ matrix.os }} + runs-on: opencv-cn-lin-arm64 defaults: run: shell: bash - strategy: fail-fast: false matrix: - os: [ARM64] python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true MB_PYTHON_VERSION: ${{ matrix.python-version }} @@ -100,34 +91,29 @@ jobs: CONFIG_PATH: travis_config.sh DOCKER_TEST_IMAGE: multibuild/focal_arm64v8 UNICODE_WIDTH: 32 - steps: - name: Cleanup - if: always() - uses: AutoModality/action-clean@v1 - + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Setup Environment variables run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ - - name: Package installation and run tests run: source scripts/install.sh test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build_arm, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -137,7 +123,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -146,7 +131,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build_arm, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -156,22 +141,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml index c453ab85..af892101 100644 --- a/.github/workflows/build_wheels_macos.yml +++ b/.github/workflows/build_wheels_macos.yml @@ -19,7 +19,6 @@ jobs: defaults: run: shell: bash - strategy: fail-fast: false matrix: @@ -40,7 +39,6 @@ jobs: python-version: '3.8' - os: macos-11 python-version: '3.9' - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true REPO_DIR: . @@ -60,18 +58,18 @@ jobs: SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Build a package run: | set -e @@ -89,13 +87,11 @@ jobs: echo $ENABLE_HEADLESS > headless.enabled set -x build_wheel $REPO_DIR $PLAT - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -108,7 +104,6 @@ jobs: defaults: run: shell: bash - strategy: fail-fast: false matrix: @@ -129,7 +124,6 @@ jobs: python-version: '3.8' - os: macos-11 python-version: '3.9' - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true MB_PYTHON_VERSION: ${{ matrix.python-version }} @@ -139,40 +133,36 @@ jobs: PLAT: x86_64 OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Setup Environment variables run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ - - name: Package installation run: | python -m pip install wheelhouse/opencv*.whl cd ${{ github.workspace }}/tests python get_build_info.py - - name: Run tests run: | cd ${{ github.workspace }}/opencv python modules/python/test/test.py -v --repo . - - name: Pylint test run: | python -m pip install pylint==2.12.2 @@ -182,7 +172,7 @@ jobs: test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -192,7 +182,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -201,7 +190,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -211,22 +200,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml index 1ac065f1..a1d7c924 100644 --- a/.github/workflows/build_wheels_macos_m1.yml +++ b/.github/workflows/build_wheels_macos_m1.yml @@ -15,35 +15,32 @@ on: jobs: build: - runs-on: ${{ matrix.os }} - + runs-on: opencv-cn-mac-arm64 strategy: fail-fast: false matrix: - os: [macOS-M1] python-version: ['3.7'] 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 }} - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Build a package run: | git submodule update --init multibuild @@ -53,13 +50,11 @@ jobs: arch -arm64 python${{ matrix.python-version }} -m pip install toml && python${{ matrix.python-version }} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${{ matrix.python-version }} -m pip install -r /dev/stdin arch -arm64 python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v delocate-wheel ${{ github.workspace }}/wheelhouse/opencv* - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -68,46 +63,41 @@ jobs: test: needs: [build] - runs-on: ${{ matrix.os }} - + runs-on: opencv-cn-mac-arm64-tests strategy: fail-fast: false matrix: - os: [macOS-M1] python-version: ['3.7', '3.8', '3.9', '3.10'] platform: [x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py - steps: + - name: Cleanup + run: find . -mindepth 1 -delete + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }} path: wheelhouse/ - - name: Package installation run: | arch -arm64 python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl cd ${{ github.workspace }}/tests arch -arm64 python${{ matrix.python-version }} get_build_info.py - - name: Run tests run: | cd ${{ github.workspace }}/opencv arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo . - - name: Pylint test run: | arch -arm64 python${{ matrix.python-version }} -m pip install pylint==2.12.2 @@ -117,7 +107,7 @@ jobs: test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -136,7 +126,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -146,7 +136,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml index 0dad17b5..087efc04 100644 --- a/.github/workflows/build_wheels_windows.yml +++ b/.github/workflows/build_wheels_windows.yml @@ -14,48 +14,43 @@ on: jobs: build-windows-x86_64: - runs-on: ${{ matrix.os }} - defaults: - run: - shell: powershell - + runs-on: windows-2019 strategy: fail-fast: false matrix: - os: [windows-2019] python-version: ['3.6'] platform: [x86, x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true SDIST: ${{ matrix.build_sdist || 0 }} ENABLE_HEADLESS: ${{ matrix.without_gui }} ENABLE_CONTRIB: ${{ matrix.with_contrib }} OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata - steps: + - name: Cleanup + shell: bash + run: | + rm -rf ./* || true + rm -rf ./.??* || true + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: false fetch-depth: 0 - - name: Update submodules if: github.event_name == 'pull_request' run: git submodule update --remote - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Setup MSBuild.exe uses: microsoft/setup-msbuild@v1.1 - - name: Build a package run: | python --version @@ -64,13 +59,11 @@ jobs: python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp36 --dist-dir=%cd%\wheelhouse -v shell: cmd - - name: Saving all wheels uses: actions/upload-artifact@v2 with: name: wheels path: wheelhouse/opencv*.whl - - name: Saving a wheel accordingly to matrix uses: actions/upload-artifact@v2 with: @@ -79,45 +72,44 @@ jobs: test: needs: [build-windows-x86_64] - runs-on: ${{ matrix.os }} + runs-on: windows-2019 defaults: run: - shell: powershell - + shell: cmd strategy: fail-fast: false matrix: - os: [windows-2019] python-version: ['3.6', '3.7', '3.8', '3.9', '3.10'] platform: [x86, x64] with_contrib: [0, 1] without_gui: [0, 1] build_sdist: [0] - env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py - steps: + - name: Cleanup + shell: bash + run: | + rm -rf ./* || true + rm -rf ./.??* || true + working-directory: ${{ github.workspace }} - name: Checkout uses: actions/checkout@v2 with: submodules: true fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.platform }} - - name: Download a wheel accordingly to matrix uses: actions/download-artifact@v2 with: name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }} path: wheelhouse/ - - name: Package installation run: | cd ${{ github.workspace }}/tests @@ -125,24 +117,20 @@ jobs: 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 . - shell: cmd - - name: Pylint test run: | python -m pip install pylint==2.12.2 cd ${{ github.workspace }}\tests python -m pylint $PYLINT_TEST_FILE - shell: cmd test_release_opencv_python: if: github.event_name == 'release' && github.event.release.prerelease needs: [build-windows-x86_64, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: test-opencv-python-release defaults: run: @@ -152,7 +140,6 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload all wheels run: | python -m pip install twine @@ -161,7 +148,7 @@ jobs: release_opencv_python: if: github.event_name == 'release' && !github.event.release.prerelease needs: [build-windows-x86_64, test] - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 environment: opencv-python-release defaults: run: @@ -171,22 +158,18 @@ jobs: with: name: wheels path: wheelhouse/ - - name: Upload wheels for opencv_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* - - name: Upload wheels for opencv_contrib_python run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* - - name: Upload wheels for opencv_python_headless run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - - name: Upload wheels for opencv_contrib_python_headless run: | python -m pip install twine diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64 index 03889a51..2679cbbf 100644 --- a/docker/manylinux2014/Dockerfile_aarch64 +++ b/docker/manylinux2014/Dockerfile_aarch64 @@ -1,3 +1,6 @@ +# Version: 20220628 +# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64 + FROM quay.io/pypa/manylinux2014_aarch64:latest ARG CCACHE_VERSION=3.7.9 @@ -35,7 +38,7 @@ RUN mkdir ~/freetype_sources && \ curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ cd freetype-${FREETYPE_VERSION} && \ - ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + ./configure --prefix="/ffmpeg_build" --enable-freetype-config && \ make && \ make install && \ cd .. && \ @@ -59,7 +62,7 @@ RUN mkdir ~/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="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ + ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ @@ -70,7 +73,7 @@ RUN mkdir ~/nasm_sources && \ cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -81,7 +84,7 @@ RUN mkdir ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -91,7 +94,7 @@ RUN mkdir ~/libvpx_sources && \ cd ~/libvpx_sources && \ git clone --depth 1 https://github.com/webmproject/libvpx.git && \ cd libvpx && \ - ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ + ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -103,10 +106,10 @@ RUN mkdir ~/ffmpeg_sources && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ PATH=~/bin:$PATH && \ - PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ + PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ - echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ + echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ rm -rf ~/ffmpeg_sources && \ yum remove bzip2-devel -y @@ -120,10 +123,20 @@ RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERS 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 mkdir /io && \ - git config --global --add safe.directory /io +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_x86_64 b/docker/manylinux2014/Dockerfile_x86_64 index 13325756..8bb77341 100644 --- a/docker/manylinux2014/Dockerfile_x86_64 +++ b/docker/manylinux2014/Dockerfile_x86_64 @@ -1,5 +1,9 @@ +# Version: 20220628 +# Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64 + FROM quay.io/pypa/manylinux2014_x86_64:latest +ARG CCACHE_VERSION=3.7.9 ARG FFMPEG_VERSION=4.4.1 ARG FREETYPE_VERSION=2.12.1 ARG LIBPNG_VERSION=1.6.37 @@ -34,7 +38,7 @@ RUN mkdir ~/freetype_sources && \ curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \ tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \ cd freetype-${FREETYPE_VERSION} && \ - ./configure --prefix="$HOME/ffmpeg_build" --enable-freetype-config && \ + ./configure --prefix="/ffmpeg_build" --enable-freetype-config && \ make && \ make install && \ cd .. && \ @@ -58,7 +62,7 @@ RUN mkdir ~/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="$HOME/ffmpeg_build" --openssldir="$HOME/ffmpeg_build" no-pinshared shared zlib && \ + ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \ make -j$(getconf _NPROCESSORS_ONLN) && \ # skip installing documentation make install_sw && \ @@ -69,7 +73,7 @@ RUN mkdir ~/nasm_sources && \ cd ~/nasm_sources && \ curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \ tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -80,7 +84,7 @@ RUN mkdir ~/yasm_sources && \ curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-${YASM_VERSION}.tar.gz && \ tar -xf yasm-${YASM_VERSION}.tar.gz && \ cd yasm-${YASM_VERSION} && \ - ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ + ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -90,7 +94,7 @@ RUN mkdir ~/libvpx_sources && \ cd ~/libvpx_sources && \ git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ cd libvpx && \ - ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ + ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ cd .. && \ @@ -102,18 +106,37 @@ RUN mkdir ~/ffmpeg_sources && \ tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \ cd ffmpeg-${FFMPEG_VERSION} && \ PATH=~/bin:$PATH && \ - PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ + PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \ make -j$(getconf _NPROCESSORS_ONLN) && \ make install && \ - echo "/root/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ + echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \ ldconfig && \ rm -rf ~/ffmpeg_sources && \ yum remove bzip2-devel -y +RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \ + tar -xf ccache-${CCACHE_VERSION}.tar.gz && \ + cd ccache-${CCACHE_VERSION} && \ + ./configure && \ + make -j$(getconf _NPROCESSORS_ONLN) && \ + make install && \ + cd .. && \ + rm -rf ccache-${CCACHE_VERSION}.tar.gz + +# GitHub Actions user`s UID is 1001 +RUN useradd ci -m -s /bin/bash -G users --uid=1001 && \ + mkdir /io && \ + chown -R ci:ci /io && \ + # This needs to find ffmpeg packages from ci user + chown -R ci:ci /ffmpeg_build && \ + # This calls in mutlibuild scripts and cannot be run without permissions + chown -R ci:ci /opt/_internal/pipx/venvs/auditwheel + +USER ci + # Git security vulnerability: https://github.blog/2022-04-12-git-security-vulnerability-announced -RUN mkdir /io && \ - git config --global --add safe.directory /io +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"