Skip to content

Commit

Permalink
do not build libheif automatically from source
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Piskun <[email protected]>
  • Loading branch information
bigcat88 committed Oct 31, 2023
1 parent bd32c73 commit 707193d
Show file tree
Hide file tree
Showing 18 changed files with 211 additions and 247 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/analysis-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,14 @@ jobs:

- name: Prepare system
run: |
sudo apt -y purge libheif1 libaom-dev libx265-dev
sudo apt -y install libde265-dev nasm
sudo apt -y purge libheif1 libaom-dev libx265-dev libde265-dev
sudo apt -y install nasm
- name: Install from source
run: |
sudo -H python3 -m pip install pillow==9.3.0 pytest defusedxml packaging numpy coverage
sudo -H PH_LIGHT_ACTION=1 python3 -m pip -v install --no-build-isolation .
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
sudo -H python3 -m pip -v install --no-build-isolation .
- name: LibHeif info
run: sudo -H python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"
Expand Down Expand Up @@ -289,13 +290,14 @@ jobs:

- name: Prepare system
run: |
sudo apt -y purge libheif1 libaom-dev libx265-dev
sudo apt -y install libde265-dev nasm
sudo apt -y purge libheif1 libaom-dev libx265-dev libde265-dev
sudo apt -y install nasm
- name: Install from source
run: |
sudo -H python3 -m pip install pillow==9.4.0 pytest defusedxml packaging numpy
sudo -H PH_LIGHT_ACTION=1 python3 -m pip -v install --no-build-isolation .
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
sudo -H python3 -m pip -v install --no-build-isolation .
- name: LibHeif info
run: sudo -H python3 -c "import pi_heif; print(pi_heif.libheif_info())"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build-cache-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ jobs:
env:
CIBW_BUILD: ${{ format('cp38-{0}*', matrix.cibw_buildlinux) }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: |
python3 {package}/libheif/linux_build_libs.py
CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_FULL_ACTION=1
CIBW_TEST_COMMAND: "python3 -c 'import pillow_heif; print(pillow_heif.libheif_info())'"
CIBW_TEST_EXTRAS: ""
CIBW_BUILD_VERBOSITY: 1

- name: Checking built wheels
Expand Down Expand Up @@ -125,10 +125,10 @@ jobs:
env:
CIBW_BUILD: ${{ format('cp38-{0}*', matrix.cibw_buildlinux) }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: ${{ env.INSTALL_OS_PACKAGES }}
CIBW_BEFORE_ALL_LINUX: |
${{ env.INSTALL_OS_PACKAGES }}
python3 {package}/libheif/linux_build_libs.py
CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_LIGHT_ACTION=1
CIBW_TEST_COMMAND: "python3 -c 'import pi_heif; print(pi_heif.libheif_info())'"
CIBW_TEST_EXTRAS: ""
CIBW_BUILD_VERBOSITY: 1

- name: Checking built wheels
Expand Down
31 changes: 7 additions & 24 deletions .github/workflows/test-src-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ jobs:
strategy:
fail-fast: false
matrix:
arch: ["amd64", "arm64", "arm/v7"]
docker_file: ["Alpine_3_17", "Alpine_3_18", "Debian_11", "Debian_12", "Ubuntu_22_04"]
arch: ["amd64", "arm64"]
docker_file: ["Alpine_3_18", "Almalinux_9"]
include:
- arch: "arm/v7"
docker_file: "Alpine_3_18"
- arch: "amd64"
docker_file: "Fedora_38"

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -66,25 +71,3 @@ jobs:
push: false
cache-from: type=gha,scope=${{ matrix.docker_file }}-${{ matrix.arch }}
target: build_test

ubuntu_22:
name: LibHeif==1.12.0
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Install LibHeif from default repo
run: sudo apt -y install libheif-dev

- name: Install from source
run: python3 -m pip -v install ".[dev]"

- name: LibHeif info
run: python3 -c "import pillow_heif; print(pillow_heif.libheif_info())"

- name: Run Tests
run: python3 -m pytest
9 changes: 6 additions & 3 deletions .github/workflows/wheels-pi_heif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
check-name: 'macosx • aarch64 • Pi-Heif • Cirrus'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 60
allowed-conclusions: success

- name: Download artifacts
run: |
Expand Down Expand Up @@ -173,7 +174,9 @@ jobs:
env:
CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, matrix.cibw_arch) }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: ${{ env.INSTALL_OS_PACKAGES }}
CIBW_BEFORE_ALL_LINUX: |
${{ env.INSTALL_OS_PACKAGES }}
python3 {package}/libheif/linux_build_libs.py
CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_LIGHT_ACTION=1

- name: Checking built wheels
Expand Down Expand Up @@ -231,7 +234,7 @@ jobs:
env:
CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, matrix.cibw_arch) }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: "yum makecache && yum install -y libjpeg-turbo-devel lcms2-devel"
CIBW_BEFORE_ALL_LINUX: "yum makecache && yum install -y libjpeg-turbo-devel lcms2-devel && python3 {package}/libheif/linux_build_libs.py"
CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_LIGHT_ACTION=1

- name: Checking built wheels
Expand All @@ -257,7 +260,7 @@ jobs:
i: [
{ "docker_file": "manylinux_armv7l_wheels", "name": "manylinux" },
]
v: ["3.8", "3.9", "3.10", "3.11"]
v: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- v: "3.10"
i: { "docker_file": "musllinux_armv7l_wheels", "name": "musllinux" }
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/wheels-pillow_heif.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
check-name: 'macosx • aarch64 • Cirrus'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 60
allowed-conclusions: success

- name: Download artifacts
run: |
Expand Down Expand Up @@ -167,7 +168,9 @@ jobs:
env:
CIBW_BUILD: ${{ format('cp3*-{0}_{1}', matrix.cibw_buildlinux, matrix.cibw_arch) }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: ${{ env.INSTALL_OS_PACKAGES }}
CIBW_BEFORE_ALL_LINUX: |
${{ env.INSTALL_OS_PACKAGES }}
python3 {package}/libheif/linux_build_libs.py
CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_FULL_ACTION=1
CIBW_ENVIRONMENT_PASS_LINUX: PH_TESTS_NO_HEVC_ENC

Expand Down Expand Up @@ -229,7 +232,9 @@ jobs:
env:
CIBW_BUILD: ${{ format('pp3*-{0}_{1}', matrix.cibw_buildlinux, matrix.cibw_arch) }}
CIBW_ARCHS: ${{ matrix.cibw_arch }}
CIBW_BEFORE_ALL_LINUX: "yum makecache && yum install -y libjpeg-turbo-devel lcms2-devel"
CIBW_BEFORE_ALL_LINUX: |
yum makecache && yum install -y libjpeg-turbo-devel lcms2-devel
python3 {package}/libheif/linux_build_libs.py
CIBW_ENVIRONMENT_LINUX: BUILD_DIR=/host${{ env.BUILD_DIR }} PH_FULL_ACTION=1
CIBW_ENVIRONMENT_PASS_LINUX: PH_TESTS_NO_HEVC_ENC

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
### Changed

- Minimum supported Pillow version raised to `9.2.0`.
- Linux: When building from source, `libheif` and other libraries are no longer try built automatically. #158

### Fixed

Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
FROM ubuntu:jammy as base
FROM almalinux:9 as base

RUN \
apt-get -qq update && \
apt-get -y -q install \
curl \
python3-pip \
libfribidi-dev \
libharfbuzz-dev \
libjpeg-dev \
liblcms2-dev \
libffi-dev \
libtool \
git \
cmake \
nasm \
libde265-dev \
libaom-dev
dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-$(rpm -E %rhel).noarch.rpm -y && \
dnf makecache && \
dnf install -y python3 python3-devel python3-pip libheif-freeworld && \
dnf install -y libheif-devel && \
dnf groupinstall -y 'Development Tools'

RUN \
python3 -m pip install --upgrade pip

RUN \
python3 -m pip install Pillow==9.3.0

FROM base as build_test

COPY . /pillow_heif
Expand Down
39 changes: 0 additions & 39 deletions docker/from_src/Debian_11.Dockerfile

This file was deleted.

31 changes: 0 additions & 31 deletions docker/from_src/Debian_12.Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
FROM alpine:3.17 as base
FROM fedora:38 as base

RUN \
apk add --no-cache \
python3-dev \
py3-pip \
perl \
alpine-sdk \
libffi-dev \
cmake \
nasm \
aom-dev \
py3-numpy \
py3-pillow
dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm && \
dnf makecache && \
dnf install -y python3 python3-devel python3-pip libheif-freeworld && \
dnf install -y libheif-devel && \
dnf groupinstall -y 'Development Tools'

RUN \
python3 -m pip install --upgrade pip
Expand Down
1 change: 1 addition & 0 deletions docker/manylinux_armv7l_wheels.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ RUN \
python3 -m pip install pytest Pillow && \
echo "**** Start building ****" && \
export BUILD_DIR="/build_cache" && \
python3 libheif/linux_build_libs.py && \
python3 setup.py bdist_wheel -d dist_manylinux && \
echo "**** Repairing wheel ****" && \
PTAG=$(echo $PY_VERSION | tr -d '.' | tr -d '"') && \
Expand Down
1 change: 1 addition & 0 deletions docker/musllinux_armv7l_wheels.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ RUN \
python3 -m pip install pytest Pillow && \
echo "**** Start building ****" && \
export BUILD_DIR="/build_cache" && \
python3 libheif/linux_build_libs.py && \
python3 setup.py bdist_wheel -d dist_musllinux && \
echo "**** Repairing wheel ****" && \
PTAG=$(echo $PY_VERSION | tr -d '.' | tr -d '"') && \
Expand Down
Loading

0 comments on commit 707193d

Please sign in to comment.