From ca1e7f9d824aceeea2c11f74b54b1019b77dec88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeremy=20Lain=C3=A9?= Date: Thu, 2 Nov 2023 07:40:31 +0100 Subject: [PATCH] Build our wheels against FFmpeg 6.0 --- .github/workflows/tests.yml | 18 ++++++------------ scripts/fetch-vendor.py | 7 +++---- scripts/ffmpeg-5.0.json | 3 +++ scripts/{fetch-vendor.json => ffmpeg-5.1.json} | 0 scripts/ffmpeg-6.0.json | 3 +++ 5 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 scripts/ffmpeg-5.0.json rename scripts/{fetch-vendor.json => ffmpeg-5.1.json} (100%) create mode 100644 scripts/ffmpeg-6.0.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8037ba891..9f880a6bb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -117,6 +117,7 @@ jobs: fail-fast: false matrix: config: + - {os: windows-latest, python: 3.8, ffmpeg: "6.0"} - {os: windows-latest, python: 3.8, ffmpeg: "5.1"} - {os: windows-latest, python: 3.8, ffmpeg: "5.0"} @@ -136,21 +137,14 @@ jobs: pillow \ python=${{ matrix.config.python }} \ setuptools - if [[ "${{ matrix.config.ffmpeg }}" == "5.1" ]]; then - curl -L -o ffmpeg.tar.gz https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/5.1.3-1/ffmpeg-win_amd64.tar.gz - elif [[ "${{ matrix.config.ffmpeg }}" == "5.0" ]]; then - curl -L -o ffmpeg.tar.gz https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/5.0.1-1/ffmpeg-win_amd64.tar.gz - else - exit 1 - fi - name: Build shell: bash run: | . $CONDA/etc/profile.d/conda.sh conda activate pyav - tar -xf ffmpeg.tar.gz -C $CONDA_PREFIX/Library/ - python setup.py build_ext --inplace --ffmpeg-dir=$CONDA_PREFIX/Library + python scripts\\fetch-vendor.py --config-file scripts\\ffmpeg-${{ matrix.config.ffmpeg }}.json $CONDA_PREFIX\\Library + python setup.py build_ext --inplace --ffmpeg-dir=$CONDA_PREFIX\\Library - name: Test shell: bash @@ -169,7 +163,7 @@ jobs: - name: Build source package run: | pip install cython - python scripts/fetch-vendor.py /tmp/vendor + python scripts/fetch-vendor.py --config-file scripts/ffmpeg-6.0.json /tmp/vendor PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig python setup.py sdist - name: Upload source package uses: actions/upload-artifact@v3 @@ -212,8 +206,8 @@ jobs: env: CIBW_ARCHS: ${{ matrix.arch }} CIBW_BEFORE_ALL_LINUX: yum install -y alsa-lib libxcb - CIBW_BEFORE_BUILD: pip install cython && python scripts/fetch-vendor.py /tmp/vendor - CIBW_BEFORE_BUILD_WINDOWS: pip install cython && python scripts\fetch-vendor.py C:\cibw\vendor + CIBW_BEFORE_BUILD: python scripts/fetch-vendor.py --config-file scripts/ffmpeg-6.0.json /tmp/vendor + CIBW_BEFORE_BUILD_WINDOWS: python scripts\fetch-vendor.py --config-file scripts\ffmpeg-6.0.json C:\cibw\vendor CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig CIBW_ENVIRONMENT_MACOS: PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig LDFLAGS=-headerpad_max_install_names CIBW_ENVIRONMENT_WINDOWS: INCLUDE=C:\\cibw\\vendor\\include LIB=C:\\cibw\\vendor\\lib PYAV_SKIP_TESTS=unicode_filename diff --git a/scripts/fetch-vendor.py b/scripts/fetch-vendor.py index 3ea3a0c6d..9ea329eb3 100644 --- a/scripts/fetch-vendor.py +++ b/scripts/fetch-vendor.py @@ -39,11 +39,10 @@ def get_platform(): with open(args.config_file, "r") as fp: config = json.load(fp) -# create fresh destination directory +# ensure destination directory exists logging.info("Creating directory %s" % args.destination_dir) -if os.path.exists(args.destination_dir): - shutil.rmtree(args.destination_dir) -os.makedirs(args.destination_dir) +if not os.path.exists(args.destination_dir): + os.makedirs(args.destination_dir) for url_template in config["urls"]: tarball_url = url_template.replace("{platform}", get_platform()) diff --git a/scripts/ffmpeg-5.0.json b/scripts/ffmpeg-5.0.json new file mode 100644 index 000000000..41969df2c --- /dev/null +++ b/scripts/ffmpeg-5.0.json @@ -0,0 +1,3 @@ +{ + "urls": ["https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/5.0.1-1/ffmpeg-{platform}.tar.gz"] +} diff --git a/scripts/fetch-vendor.json b/scripts/ffmpeg-5.1.json similarity index 100% rename from scripts/fetch-vendor.json rename to scripts/ffmpeg-5.1.json diff --git a/scripts/ffmpeg-6.0.json b/scripts/ffmpeg-6.0.json new file mode 100644 index 000000000..0eb2034ee --- /dev/null +++ b/scripts/ffmpeg-6.0.json @@ -0,0 +1,3 @@ +{ + "urls": ["https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/6.0.0-1/ffmpeg-{platform}.tar.gz"] +}