未验证 提交 d49b9487 编写于 作者: A Andrey Senyaev 提交者: GitHub

Merge pull request #567 from asenyaev/asen/update_3.4

Updated 3.4 branch to 3.4.16 release and added changes from master branch
......@@ -23,7 +23,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
platform: [x64]
with_contrib: [0, 1]
without_gui: [0, 1]
......@@ -38,9 +38,10 @@ jobs:
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
MB_ML_VER: 2014
NP_TEST_DEP: numpy==1.19.4
NP_TEST_DEP_LATEST: numpy==1.21.2
TRAVIS_BUILD_DIR: ${{ github.workspace }}
CONFIG_PATH: travis_config.sh
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT}
USE_CCACHE: 1
UNICODE_WIDTH: 32
SDIST: ${{ matrix.build_sdist || 0 }}
......@@ -63,8 +64,7 @@ jobs:
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
if [ "x64" == "${{ matrix.platform }}" ]; then echo "PLAT=x86_64" >> $GITHUB_ENV; fi
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
- name: build
run: source scripts/build.sh
......@@ -107,7 +107,7 @@ jobs:
NP_TEST_DEP: numpy==1.19.4
TRAVIS_BUILD_DIR: ${{ github.workspace }}
CONFIG_PATH: travis_config.sh
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT}
USE_CCACHE: 1
UNICODE_WIDTH: 32
SDIST: ${{ matrix.build_sdist || 0 }}
......@@ -135,8 +135,6 @@ jobs:
run: |
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
- name: before install
run: |
......
......@@ -23,7 +23,7 @@ jobs:
fail-fast: false
matrix:
os: [ARM64]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
platform: [x64]
with_contrib: [0, 1]
without_gui: [0, 1]
......@@ -39,10 +39,11 @@ jobs:
PLAT: aarch64
MB_ML_VER: 2014
NP_TEST_DEP: numpy==1.19.4
NP_TEST_DEP_LATEST: numpy==1.21.2
TRAVIS_BUILD_DIR: ${{ github.workspace }}
CONFIG_PATH: travis_config.sh
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
DOCKER_TEST_IMAGE: multibuild/xenial_arm64v8
DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT}
DOCKER_TEST_IMAGE: multibuild/focal_arm64v8
USE_CCACHE: 0
UNICODE_WIDTH: 32
SDIST: ${{ matrix.build_sdist || 0 }}
......@@ -63,8 +64,7 @@ jobs:
- name: Setup Environment variables
run: |
if [ "ARM64" == "${{ matrix.os }}" ]; then echo "PLAT=aarch64" >> $GITHUB_ENV; fi
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
- name: build
run: source scripts/build.sh
......
......@@ -22,12 +22,23 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
os: [macos-10.15, macos-11]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
platform: [x64]
with_contrib: [0, 1]
without_gui: [0, 1]
build_sdist: [0]
exclude:
- os: macos-10.15
python-version: '3.10'
- os: macos-11
python-version: '3.6'
- os: macos-11
python-version: '3.7'
- os: macos-11
python-version: '3.8'
- os: macos-11
python-version: '3.9'
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
......@@ -38,9 +49,11 @@ jobs:
TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
MB_ML_VER: 2014
NP_TEST_DEP: numpy==1.19.4
NP_TEST_DEP_LATEST: numpy==1.21.2
TRAVIS_BUILD_DIR: ${{ github.workspace }}
TRAVIS_OS_NAME: osx
CONFIG_PATH: travis_config.sh
DOCKER_IMAGE: quay.io/skvark/manylinux2014_${PLAT}
DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT}
USE_CCACHE: 1
UNICODE_WIDTH: 32
SDIST: ${{ matrix.build_sdist || 0 }}
......@@ -58,22 +71,13 @@ jobs:
if: github.event_name == 'pull_request'
run: git submodule update --remote
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
if: ${{ 'macos-latest' == matrix.os }}
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform }}
- name: Setup Environment variables
run: |
if [ "macos-latest" == "${{ matrix.os }}" ]; then echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV; else echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "TRAVIS_EVENT_TYPE=cron" >> $GITHUB_ENV; else echo "TRAVIS_EVENT_TYPE=${{ github.event_name }}" >> $GITHUB_ENV; fi
if [ "schedule" == "${{ github.event_name }}" ]; then echo "BUILD_COMMIT=master" >> $GITHUB_ENV; else echo "BUILD_COMMIT=$BUILD_COMMIT" >> $GITHUB_ENV; fi
if [ "x64" == "${{ matrix.platform }}" ]; then echo "PLAT=x86_64" >> $GITHUB_ENV; fi
if [ "x86" == "${{ matrix.platform }}" ]; then echo "PLAT=i686" >> $GITHUB_ENV; fi
echo "BUILD_DEPENDS=$(echo $NP_BUILD_DEP)" >> $GITHUB_ENV;
echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV;
if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
- name: before install
run: |
......
......@@ -20,13 +20,14 @@ jobs:
fail-fast: false
matrix:
os: [macOS-M1]
python-version: [3.7, 3.8, 3.9]
python-version: ['3.7', '3.8', '3.9', '3.10']
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 }}
......@@ -50,16 +51,20 @@ jobs:
echo $ENABLE_HEADLESS > headless.enabled
export MACOSX_DEPLOYMENT_TARGET=11.0
arch -arm64 python${{ matrix.python-version }} -m pip wheel --wheel-dir=wheelhouse . --verbose
delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
- name: before test
run: |
git submodule update --init --recursive
arch -arm64 python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl
cd ${{ github.workspace }}/tests
arch -arm64 python${{ matrix.python-version }} get_build_info.py
- name: run test
run: |
cd ${{ github.workspace }}/opencv
arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
- name: saving artifacts
uses: actions/upload-artifact@v2
with:
......
......@@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
platform: [x86, x64]
with_contrib: [0, 1]
without_gui: [0, 1]
......
env:
global:
- "PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'"
# pip dependencies to _test_ your project
- TEST_DEPENDS="numpy==1.11.1"
# params to bdist_wheel. used to set osx build target.
- CONFIG_PATH="travis_config.sh"
- USE_CCACHE=1
- UNICODE_WIDTH=32
- SDIST=0
# Save some time, we and setup check them out on demand instead
# https://docs.travis-ci.com/user/customizing-the-build/#Git-Clone-Depth
git:
submodules: false
# https://docs.travis-ci.com/user/caching
cache:
directories:
# `cache: ccache: true` has no effect if `language:` is not `c` or `cpp`
- $HOME/.ccache
# Add more cache stages (s2 etc) and corresponding OSX jobs like s1
# if brew builds start to take longer than one Travis time limit
stages:
- final
jobs:
fast_finish: true
# Travis exclude is buggy, this seems to be the only way to disable default build
exclude:
- language: ruby
include:
# default builds for Linux
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.6
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=0
- ENABLE_HEADLESS=0
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.7
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=0
- ENABLE_HEADLESS=0
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.8
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=0
- ENABLE_HEADLESS=0
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.9
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=0
- ENABLE_HEADLESS=0
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
# headless builds for Linux
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.6
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=0
- ENABLE_HEADLESS=1
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.7
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=0
- ENABLE_HEADLESS=1
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.8
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=0
- ENABLE_HEADLESS=1
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.9
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=0
- ENABLE_HEADLESS=1
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
# contrib builds for Linux
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.6
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=1
- ENABLE_HEADLESS=0
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.7
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=1
- ENABLE_HEADLESS=0
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.8
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=1
- ENABLE_HEADLESS=0
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.9
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=1
- ENABLE_HEADLESS=0
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
# headless contrib builds for Linux
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.6
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=1
- ENABLE_HEADLESS=1
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.7
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=1
- ENABLE_HEADLESS=1
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.8
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=1
- ENABLE_HEADLESS=1
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
- os: linux
arch: arm64
language: generic
dist: xenial
services: docker
env:
- MB_PYTHON_VERSION=3.9
- PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_arm64v8
- ENABLE_CONTRIB=1
- ENABLE_HEADLESS=1
- TEST_DEPENDS=numpy==1.19.0
- USE_CCACHE=0
cache:
directories: $HOME/.ccache
# The first line is printed in the folding header in Travis output
before_install: |
set -e
if [[ $SDIST == 0 ]]; then
# Check out and prepare the source
# Multibuild doesn't have releases, so --depth would break eventually (see
# https://superuser.com/questions/1240216/server-does-not-allow-request-for-unadvertised)
git submodule update --init multibuild
source multibuild/common_utils.sh
# https://github.com/matthew-brett/multibuild/issues/116
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export ARCH_FLAGS=" "; fi
source multibuild/travis_steps.sh
# This sets -x
source travis_multibuild_customize.sh
echo $ENABLE_CONTRIB > contrib.enabled
echo $ENABLE_HEADLESS > headless.enabled
echo "end"
# Not interested in travis internal scripts' output
fi
set +x
install: |
# Build and package
set -x
if [[ $SDIST == 1 ]]; then
python -m pip install --upgrade pip
python -m pip install scikit-build
python setup.py sdist
else
build_wheel $REPO_DIR $PLAT
fi
set +x
script: |
# Install and run tests
set -x
if [[ $SDIST == 1 ]]; then
echo "skipping tests because of sdist"
else
install_run $PLAT && rc=$? || rc=$?
fi
set +x
#otherwise, Travis logic terminates prematurely
#https://travis-ci.community/t/shell-session-update-command-not-found-in-build-log-causes-build-to-fail-if-trap-err-is-set/817
trap ERR
test "$rc" -eq 0
after_success: |
# Upload wheels to pypi if tag is set
set -x
if [ -n "$TRAVIS_TAG" ]; then
if [[ $ENABLE_CONTRIB == 0 ]]; then
if [[ $ENABLE_HEADLESS == 0 ]]; then
echo "This is default build. Deployment will be done to to PyPI entry opencv-python."
else
echo "This is headless contrib build. Deployment will be done to to PyPI entry opencv-python-headless."
fi
else
if [[ $ENABLE_HEADLESS == 0 ]]; then
echo "This is contrib build. Deployment will be done to to PyPI entry opencv-contrib-python."
else
echo "This is headless contrib build. Deployment will be done to to PyPI entry opencv-contrib-python-headless."
fi
fi
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ $SDIST == 1 ]]; then
pip install twine
twine upload -u ${PYPI_USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist/opencv*
else
pip install --user twine
pip install --user --upgrade six
twine upload -u ${PYPI_USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
fi
fi
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
# macpython 3.5 doesn't support recent TLS protocols which causes twine
# upload to fail, so we use the system Python to run twine
/usr/bin/python -m ensurepip --user
/usr/bin/python -m pip install --user -U pip
/usr/bin/python -m pip install --user -U -I twine
if [[ $SDIST == 1 ]]; then
/usr/bin/python -m twine upload -u ${PYPI_USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/dist/opencv*
else
/usr/bin/python -m twine upload -u ${PYPI_USER} -p ${PASS} --skip-existing ${TRAVIS_BUILD_DIR}/wheelhouse/opencv*
fi
fi
fi
# # Save to Azure storage always
# if [[ $TRAVIS_CPU_ARCH != "arm64" ]]; then
# if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
# curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
# else
# brew install azure-cli
# fi
# az storage container create -n ${TRAVIS_COMMIT} --public-access blob
# if [[ $SDIST == 1 ]]; then
# az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/dist --pattern *.gz
# else
# az storage blob upload-batch -d ${TRAVIS_COMMIT} -s ${TRAVIS_BUILD_DIR}/wheelhouse --pattern opencv*.whl
# fi
# fi
set +x
......@@ -65,9 +65,9 @@ If you still encounter the error after you have checked all the previous solutio
A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages).
**Q: Function foo() or method bar() returns wrong result, throws exception or crashes interpriter. What should I do?**
**Q: Function foo() or method bar() returns wrong result, throws exception or crashes interpreter. What should I do?**
A: The repository contains only OpenCV-Python package build scripts, but not OpenCV itself. Python bindings for OpenCV are developed in official OpenCV repository and it's the best place to report issues. Also please check {OpenCV wiki](https://github.com/opencv/opencv/wiki) and [the fficial OpenCV forum](https://forum.opencv.org/) before file new bugs.
A: The repository contains only OpenCV-Python package build scripts, but not OpenCV itself. Python bindings for OpenCV are developed in official OpenCV repository and it's the best place to report issues. Also please check {OpenCV wiki](https://github.com/opencv/opencv/wiki) and [the official OpenCV forum](https://forum.opencv.org/) before file new bugs.
**Q: Why the packages do not include non-free algorithms?**
......@@ -79,15 +79,16 @@ A: It's easier for users to understand ``opencv-python`` than ``cv2`` and it mak
## Documentation for opencv-python
[![AppVeyor CI test status (Windows)](https://img.shields.io/appveyor/ci/skvark/opencv-python.svg?maxAge=3600&label=Windows)](https://ci.appveyor.com/project/skvark/opencv-python)
[![Travis CI test status (Linux and macOS)](https://img.shields.io/travis/com/skvark/opencv-python/master?label=Linux%20%26%20macOS)](https://travis-ci.com/github/skvark/opencv-python/)
[![Windows Buld 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
......
import importlib
import os
import sys
from .cv2 import *
from .data import *
# wildcard import above does not import "private" variables like __version__
# this makes them available
globals().update(importlib.import_module("cv2.cv2").__dict__)
ci_and_not_headless = False
try:
from .version import ci_build, headless
ci_and_not_headless = ci_build and not headless
except:
pass
# the Qt plugin is included currently only in the pre-built wheels
if sys.platform.startswith("linux") and ci_and_not_headless:
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "qt", "plugins"
)
# Qt will throw warning on Linux if fonts are not found
if sys.platform.startswith("linux") and ci_and_not_headless:
os.environ["QT_QPA_FONTDIR"] = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "qt", "fonts"
)
......@@ -28,8 +28,8 @@ 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/2.15.04/nasm-2.15.04.tar.bz2 && \
tar -xf nasm-2.15.04.tar.bz2 && cd nasm-2.15.04 && ./autogen.sh && \
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
make -j$(getconf _NPROCESSORS_ONLN) && \
make install
......@@ -50,9 +50,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-4.3.2.tar.bz2 && \
tar -xf ffmpeg-4.3.2.tar.bz2 && \
cd ffmpeg-4.3.2 && \
PATH=~/bin:$PATH && \
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
make -j$(getconf _NPROCESSORS_ONLN) && \
......
......@@ -30,8 +30,8 @@ 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/2.15.04/nasm-2.15.04.tar.bz2 && \
tar -xf nasm-2.15.04.tar.bz2 && cd nasm-2.15.04 && ./autogen.sh && \
linux32 ./configure && \
make -j$(getconf _NPROCESSORS_ONLN) && \
make install
......@@ -52,9 +52,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-4.3.2.tar.bz2 && \
tar -xf ffmpeg-4.3.2.tar.bz2 && \
cd ffmpeg-4.3.2 && \
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) && \
......
......@@ -28,8 +28,8 @@ 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/2.15.04/nasm-2.15.04.tar.bz2 && \
tar -xf nasm-2.15.04.tar.bz2 && cd nasm-2.15.04 && ./autogen.sh && \
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \
make -j$(getconf _NPROCESSORS_ONLN) && \
make install
......@@ -50,9 +50,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-4.3.2.tar.bz2 && \
tar -xf ffmpeg-4.3.2.tar.bz2 && \
cd ffmpeg-4.3.2 && \
PATH=~/bin:$PATH && \
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
make -j$(getconf _NPROCESSORS_ONLN) && \
......
Subproject commit 8882150df6529658700b66bec124dfb77eefca26
Subproject commit b89bb903e94308be79abefa4f436bf123ebb1313
Subproject commit 591708903b4393b5d33c3a2f4af5be4daeb94c4d
Subproject commit 62252d157ea53d9c51df9d7043bba49e053aa3c0
Subproject commit e9e507039d41fed009b72f9e163a22d9ae9f0712
Subproject commit 02c2b56c44503e983c3eacd5b79744a24f433c36
Subproject commit e79fc1824042cc57ff95547a50d5084881cb6056
Subproject commit 38d49adaabb08618ff9fb224004362de80fdcbcc
......@@ -3,9 +3,8 @@ index 4c0b3880fc..dffa0a4caa 100644
--- a/opencv/CMakeLists.txt
+++ b/opencv/CMakeLists.txt
@@ -1187,6 +1187,13 @@ if(WITH_QT OR HAVE_QT)
if(HAVE_QT5)
status(" QT:" "YES (ver ${Qt5Core_VERSION_STRING})")
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt5OpenGL_LIBRARIES} ${Qt5OpenGL_VERSION_STRING})" ELSE NO)
if(HAVE_QT)
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
+ if(APPLE)
+ install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt)
+ endif()
......@@ -13,6 +12,14 @@ index 4c0b3880fc..dffa0a4caa 100644
+ install(DIRECTORY /opt/Qt5.15.0/plugins DESTINATION lib/qt)
+ install(DIRECTORY /usr/share/fonts DESTINATION lib/qt)
+ endif()
elseif(HAVE_QT)
status(" QT:" "YES (ver ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH} ${QT_EDITION})")
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
if(HAVE_QT_OPENGL)
if(Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES)
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${Qt${QT_VERSION_MAJOR}OpenGL_LIBRARIES} ${Qt${QT_VERSION_MAJOR}OpenGL_VERSION_STRING})" ELSE NO)
else()
status(" QT OpenGL support:" HAVE_QT_OPENGL THEN "YES (${QT_QTOPENGL_LIBRARY})" ELSE NO)
endif()
else()
status(" QT OpenGL support:" "NO")
endif()
else()
status(" QT:" "NO")
......@@ -2,9 +2,10 @@
requires = [
"setuptools", "wheel", "scikit-build", "cmake", "pip",
"numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
"numpy==1.19.3; python_version>='3.6' and sys_platform == 'linux' and platform_machine == 'aarch64'",
"numpy==1.21.0; python_version>='3.6' and sys_platform == 'darwin' and platform_machine == 'arm64'",
"numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
"numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
"numpy==1.19.3; python_version>='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'"
"numpy==1.19.3; python_version<='3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'",
"numpy==1.21.0; python_version<='3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'",
"numpy==1.19.3; python_version=='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
"numpy==1.21.2; python_version>='3.10'"
]
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"
)
......@@ -30,6 +30,8 @@ def main():
minimum_supported_numpy = "1.17.3"
if sys.version_info[:2] >= (3, 9):
minimum_supported_numpy = "1.19.3"
if sys.version_info[:2] >= (3, 10):
minimum_supported_numpy = "1.21.2"
# linux arm64 is a special case
if sys.platform.startswith("linux") and sys.version_info[:2] >= (3, 6) and platform.machine() == "aarch64":
......@@ -106,12 +108,32 @@ def main():
# Naming conventions vary so widely between versions and OSes
# had to give up on checking them.
[
"python/cv2[^/]*%(ext)s"
% {"ext": re.escape(sysconfig.get_config_var("EXT_SUFFIX"))}
"python/cv2/python-%s.%s/cv2[^/]*%s"
% (sys.version_info[0], sys.version_info[1], re.escape(sysconfig.get_config_var("EXT_SUFFIX")))
]
+
[
r"python/cv2/__init__.py"
]
+
[
r"python/cv2/.*config.*.py"
],
"cv2.data": [ # OPENCV_OTHER_INSTALL_PATH
("etc" if os.name == "nt" else "share/OpenCV") + r"/haarcascades/.*\.xml"
],
"cv2.gapi": [
"python/cv2" + r"/gapi/.*\.py"
],
"cv2.mat_wrapper": [
"python/cv2" + r"/mat_wrapper/.*\.py"
],
"cv2.misc": [
"python/cv2" + r"/misc/.*\.py"
],
"cv2.utils": [
"python/cv2" + r"/utils/.*\.py"
],
}
# Files in sourcetree outside package dir that should be copied to package.
......@@ -135,8 +157,6 @@ def main():
"-DBUILD_opencv_python2=OFF",
# Disable the Java build by default as it is not needed
"-DBUILD_opencv_java=%s" % build_java,
# When off, adds __init__.py and a few more helper .py's. We use our own helper files with a different structure.
"-DOPENCV_SKIP_PYTHON_LOADER=ON",
# Relative dir to install the built module to in the build tree.
# The default is generated from sysconfig, we'd rather have a constant for simplicity
"-DOPENCV_PYTHON3_INSTALL_PATH=python",
......@@ -151,6 +171,12 @@ def main():
"-DBUILD_PERF_TESTS=OFF",
"-DBUILD_DOCS=OFF",
]
+ (
# If it is not defined 'linker flags: /machine:X86' on Windows x64
["-DCMAKE_GENERATOR_PLATFORM=x64"]
if x64 and sys.platform == "win32"
else []
)
+ (
["-DOPENCV_EXTRA_MODULES_PATH=" + os.path.abspath("opencv_contrib/modules")]
if build_contrib
......@@ -252,6 +278,7 @@ def main():
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: C++",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Scientific/Engineering",
......@@ -350,6 +377,13 @@ class RearrangeCMakeOutput(object):
print("Copying files from CMake output")
# add lines from the old __init__.py file to the config file
with open('scripts/__init__.py', 'r') as custom_init:
custom_init_data = custom_init.read()
with open('%spython/cv2/config-%s.%s.py'
% (cmake_install_dir, sys.version_info[0], sys.version_info[1]), 'w') as opencv_init_config:
opencv_init_config.write(custom_init_data)
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:
......
......@@ -20,7 +20,10 @@ function bdist_wheel_cmd {
TOOLS_PATH=/opt/_internal/tools
/opt/python/cp37-cp37m/bin/python -m venv $TOOLS_PATH
source $TOOLS_PATH/bin/activate
python patch_auditwheel_whitelist.py
python$PYTHON_VERSION -m pip install auditwheel==3.2.0
python$PYTHON_VERSION patch_auditwheel_whitelist.py
# to avoid issues with numpy wheels
rm /io/wheelhouse/numpy*
deactivate
fi
if [ -n "$USE_CCACHE" -a -z "$BREW_BOOTSTRAP_MODE" ]; then ccache -s; fi
......@@ -92,6 +95,15 @@ function pre_build {
echo "Starting pre-build"
set -e -o pipefail
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
echo "Running for OSX"
......
......@@ -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'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册