From aa26990977aa021b7d9559666b5674b5ca76c2ec Mon Sep 17 00:00:00 2001 From: Olli-Pekka Heinisuo Date: Sat, 1 May 2021 23:40:51 +0300 Subject: [PATCH 1/2] make it possible to compile from sources against numpy on macOS aarch64 (#475) --- pyproject.toml | 1 + setup.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d7c5527d..07bcc4bb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,6 +3,7 @@ requires = [ "setuptools", "wheel", "scikit-build", "cmake", "pip", "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64'", "numpy==1.19.3; python_version>='3.6' and sys_platform == 'linux' and platform_machine == 'aarch64'", + "numpy==1.20.1; python_version>='3.6' and sys_platform == 'darwin' and platform_machine == 'aarch64'", "numpy==1.14.5; python_version=='3.7' and platform_machine != 'aarch64'", "numpy==1.17.3; python_version=='3.8' and platform_machine != 'aarch64'", "numpy==1.19.3; python_version>='3.9' and platform_machine != 'aarch64'" diff --git a/setup.py b/setup.py index 67f22c60..a3265206 100644 --- a/setup.py +++ b/setup.py @@ -31,10 +31,14 @@ def main(): if sys.version_info[:2] >= (3, 9): minimum_supported_numpy = "1.19.3" - # arm64 is a special case - if sys.version_info[:2] >= (3, 6) and platform.machine() == "aarch64": + # linux arm64 is a special case + if sys.platform.startswith("linux") and sys.version_info[:2] >= (3, 6) and platform.machine() == "aarch64": minimum_supported_numpy = "1.19.3" + # macos arm64 is a special case + if sys.platform == "darwin" and sys.version_info[:2] >= (3, 6) and platform.machine() == "aarch64": + minimum_supported_numpy = "1.20.1" + numpy_version = "numpy>=%s" % minimum_supported_numpy python_version = cmaker.CMaker.get_python_version() From 88c1735deff42f2b2eacf66bf59aafc5c0f25763 Mon Sep 17 00:00:00 2001 From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com> Date: Thu, 6 May 2021 22:37:49 +0300 Subject: [PATCH 2/2] Fixed if condition for release job (#478) * Fixed if condition for release job * Added the test release job, changed if condition * Merged all upload steps into one for pre-release --- .github/workflows/build_wheels.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index cbed8b6c..67f7ad8d 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -244,8 +244,27 @@ jobs: name: wheels path: dist/opencv*.tar.gz + test_release_opencv_python: + if: github.event_name == 'release' && github.event.release.prerelease + needs: [build, build-windows-x86_64, build_sdist] + runs-on: ubuntu-latest + environment: test-opencv-python-release + defaults: + run: + shell: bash + steps: + - uses: actions/download-artifact@v2 + with: + name: wheels + path: wheelhouse/ + + - name: Upload all wheels + run: | + python -m pip install twine + python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* + release_opencv_python: - if: startsWith(github.ref, 'refs/tags/v') + if: github.event_name == 'release' && !github.event.release.prerelease needs: [build, build-windows-x86_64, build_sdist] runs-on: ubuntu-latest environment: opencv-python-release @@ -257,6 +276,7 @@ jobs: with: name: wheels path: wheelhouse/ + - name: Upload wheels for opencv_python run: | python -m pip install twine @@ -273,7 +293,6 @@ jobs: python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* - name: Upload wheels for opencv_contrib_python_headless - run: | python -m pip install twine python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-*