Skip to content

Commit d1cbd27

Browse files
authored
update libheif; move away from using homebrew for building wheels (#383)
Signed-off-by: Alexander Piskun <[email protected]>
1 parent a41568e commit d1cbd27

File tree

19 files changed

+253
-240
lines changed

19 files changed

+253
-240
lines changed

.github/workflows/analysis-coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ jobs:
314314
- name: Install from source
315315
run: |
316316
sudo -H python3 -m pip install pillow==11.1.0 pytest defusedxml packaging numpy coverage
317-
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
317+
sudo -H PH_LIGHT_ACTION=1 python3 libheif/build_libs.py
318318
sudo -H python3 -m pip -v install --no-build-isolation .
319319
320320
- name: LibHeif info
@@ -362,7 +362,7 @@ jobs:
362362
- name: Install from source
363363
run: |
364364
sudo -H python3 -m pip install pillow==11.1.0 pytest defusedxml packaging numpy
365-
sudo -H PH_LIGHT_ACTION=1 python3 libheif/linux_build_libs.py
365+
sudo -H PH_LIGHT_ACTION=1 python3 libheif/build_libs.py
366366
sudo -H python3 -m pip -v install --no-build-isolation .
367367
368368
- name: LibHeif info

.github/workflows/test-src-build-linux.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ on:
77
paths:
88
- '.github/workflows/test-src-build-linux.yml'
99
- 'docker/from_src/*.Dockerfile'
10-
- 'libheif/linux/**'
11-
- 'libheif/linux_*.py'
10+
- 'libheif/build_libs.py'
1211
- 'setup.*'
1312
- 'pyproject.toml'
1413
- 'pillow_heif/_pillow_heif.c'
@@ -17,8 +16,7 @@ on:
1716
paths:
1817
- '.github/workflows/test-src-build-linux.yml'
1918
- 'docker/from_src/*.Dockerfile'
20-
- 'libheif/linux/**'
21-
- 'libheif/linux_*.py'
19+
- 'libheif/build_libs.py'
2220
- 'setup.*'
2321
- 'pyproject.toml'
2422
- 'pillow_heif/_pillow_heif.c'

.github/workflows/test-src-build-macos.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,18 @@ on:
66
pull_request:
77
paths:
88
- '.github/workflows/test-src-build-macos.yml'
9-
- 'libheif/macos/**'
109
- 'setup.*'
1110
- 'pyproject.toml'
12-
- 'pi-heif/libheif/macos/**'
11+
- 'libheif/build_libs.py'
1312
- 'pi-heif/setup.cfg'
1413
- 'pillow_heif/_pillow_heif.c'
1514
push:
1615
branches: [master]
1716
paths:
1817
- '.github/workflows/test-src-build-macos.yml'
19-
- 'libheif/macos/**'
2018
- 'setup.*'
2119
- 'pyproject.toml'
22-
- 'pi-heif/libheif/macos/**'
20+
- 'libheif/build_libs.py'
2321
- 'pi-heif/setup.cfg'
2422
- 'pillow_heif/_pillow_heif.c'
2523

@@ -38,10 +36,12 @@ jobs:
3836

3937
steps:
4038
- uses: actions/checkout@v4
41-
- name: Install libheif from formula
39+
- name: Uninstall libheif from homebrew
4240
run: |
43-
brew uninstall --force --ignore-dependencies imagemagick libheif aom
44-
brew install --formula ./libheif/macos/libheif.rb
41+
brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265 jpeg-turbo
42+
43+
- name: Install libheif
44+
run: sudo python3 libheif/build_libs.py
4545

4646
- name: Installing Pillow-Heif
4747
run: python3 -m pip -v install ".[dev]"
@@ -65,10 +65,11 @@ jobs:
6565
with:
6666
python-version: '3.12'
6767

68-
- name: Install libheif from formula
69-
run: |
70-
brew uninstall --force --ignore-dependencies imagemagick libheif aom
71-
brew install --formula ./libheif/macos/libheif.rb
68+
- name: Uninstall libheif from homebrew
69+
run: brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265
70+
71+
- name: Install libheif
72+
run: sudo python3 libheif/build_libs.py
7273

7374
- name: Installing Pillow-Heif
7475
run: python3 -m pip -v install ".[dev]"
@@ -94,10 +95,12 @@ jobs:
9495
cp -r -v ./pi-heif/* .
9596
python3 .github/transform_to-pi_heif.py
9697
97-
- name: Install libheif from formula
98+
- name: Uninstall libheif from homebrew
9899
run: |
99-
brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom
100-
brew install --formula ./libheif/macos/libheif.rb
100+
brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265 jpeg-turbo
101+
102+
- name: Install libheif
103+
run: sudo PH_LIGHT_ACTION=1 python3 libheif/build_libs.py
101104

102105
- name: Installing Pi-Heif
103106
run: python3 -m pip -v install ".[tests]"
@@ -126,10 +129,11 @@ jobs:
126129
cp -r -v ./pi-heif/* .
127130
python3 .github/transform_to-pi_heif.py
128131
129-
- name: Install libheif from formula
130-
run: |
131-
brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom
132-
brew install --formula ./libheif/macos/libheif.rb
132+
- name: Uninstall libheif from homebrew
133+
run: brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265
134+
135+
- name: Install libheif
136+
run: sudo PH_LIGHT_ACTION=1 python3 libheif/build_libs.py
133137

134138
- name: Installing Pi-Heif
135139
run: python3 -m pip -v install ".[tests]"

.github/workflows/wheels-pi_heif.yml

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
paths:
88
- '.github/workflows/wheels-pi_heif.yml'
99
- 'setup.*'
10-
- 'libheif/linux_*.py'
10+
- 'libheif/build_libs.py'
1111
- 'pyproject.toml'
1212

1313
jobs:
@@ -26,10 +26,14 @@ jobs:
2626
cp -r -v ./pi-heif/* .
2727
python3 .github/transform_to-pi_heif.py
2828
29-
- name: Install libheif from formula
30-
run: |
31-
brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom
32-
brew install --formula ./libheif/macos/libheif.rb
29+
- name: Uninstall libheif from homebrew
30+
run: brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265
31+
32+
- name: Install libheif
33+
run: sudo PH_LIGHT_ACTION=1 python3 libheif/build_libs.py
34+
35+
- name: Install dependencies for Pillow
36+
run: brew install libjpeg little-cms2
3337

3438
- name: Run cibuildwheel
3539
run: |
@@ -123,6 +127,15 @@ jobs:
123127
cp -r -v ./pi-heif/* .
124128
python3 .github/transform_to-pi_heif.py
125129
130+
- name: Uninstall libheif from homebrew
131+
run: brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265 jpeg-turbo
132+
133+
- name: Install libheif
134+
run: sudo PH_LIGHT_ACTION=1 python3 libheif/build_libs.py
135+
136+
- name: Install dependencies for Pillow
137+
run: brew install libjpeg little-cms2
138+
126139
- name: Run cibuildwheel
127140
run: |
128141
python3 -m pip install cibuildwheel==3.1.3
@@ -173,7 +186,7 @@ jobs:
173186
CIBW_ARCHS: "x86_64"
174187
CIBW_BEFORE_ALL_LINUX: |
175188
${{ env.INSTALL_OS_PACKAGES }}
176-
python3 {package}/libheif/linux_build_libs.py
189+
python3 {package}/libheif/build_libs.py
177190
CIBW_ENVIRONMENT_LINUX: PH_LIGHT_ACTION=1
178191

179192
- name: Checking built wheels
@@ -218,7 +231,7 @@ jobs:
218231
CIBW_ARCHS: "aarch64"
219232
CIBW_BEFORE_ALL_LINUX: |
220233
${{ env.INSTALL_OS_PACKAGES }}
221-
python3 {package}/libheif/linux_build_libs.py
234+
python3 {package}/libheif/build_libs.py
222235
CIBW_ENVIRONMENT_LINUX: PH_LIGHT_ACTION=1
223236

224237
- name: Checking built wheels
@@ -236,23 +249,28 @@ jobs:
236249

237250
sdist:
238251
name: Source distribution
239-
runs-on: macos-13
252+
runs-on: macos-14
240253

241254
steps:
242255
- uses: actions/checkout@v4
256+
- uses: actions/setup-python@v6
257+
with:
258+
python-version: '3.12'
259+
243260
- name: Transform to Pi-Heif
244261
run: |
245262
cp -r -v ./pi-heif/* .
246263
python3 .github/transform_to-pi_heif.py
247264
248-
- name: Install libheif from formula
249-
run: |
250-
brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom
251-
brew install --formula ./libheif/macos/libheif.rb
252-
253265
- name: Install requirements
254266
run: python3 -m pip install twine wheel build
255267

268+
- name: Uninstall libheif from homebrew
269+
run: brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265
270+
271+
- name: Install libheif
272+
run: sudo PH_LIGHT_ACTION=1 python3 libheif/build_libs.py
273+
256274
- name: Build sdist
257275
run: |
258276
python3 -m pip install pytest pillow numpy pympler defusedxml

.github/workflows/wheels-pillow_heif.yml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
paths:
77
- '.github/workflows/wheels-pillow_heif.yml'
88
- 'setup.*'
9-
- 'libheif/linux_*.py'
9+
- 'libheif/build_libs.py'
1010
- 'pyproject.toml'
1111

1212
jobs:
@@ -20,10 +20,14 @@ jobs:
2020
with:
2121
python-version: '3.12'
2222

23-
- name: Install libheif from formula
24-
run: |
25-
brew uninstall --force --ignore-dependencies imagemagick libheif aom
26-
brew install --formula ./libheif/macos/libheif.rb
23+
- name: Uninstall libheif from homebrew
24+
run: brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265
25+
26+
- name: Install libheif
27+
run: sudo python3 libheif/build_libs.py
28+
29+
- name: Install dependencies for Pillow
30+
run: brew install libjpeg little-cms2
2731

2832
- name: Run cibuildwheel
2933
run: |
@@ -109,6 +113,16 @@ jobs:
109113

110114
steps:
111115
- uses: actions/checkout@v4
116+
117+
- name: Uninstall libheif from homebrew
118+
run: brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265 jpeg-turbo
119+
120+
- name: Install libheif
121+
run: sudo python3 libheif/build_libs.py
122+
123+
- name: Install dependencies for Pillow
124+
run: brew install libjpeg little-cms2
125+
112126
- name: Run cibuildwheel
113127
run: |
114128
python3 -m pip install cibuildwheel==3.1.3
@@ -161,7 +175,7 @@ jobs:
161175
CIBW_BEFORE_ALL_LINUX: |
162176
${{ env.INSTALL_OS_PACKAGES }}
163177
python3 -m pip install cmake==3.31.6
164-
python3 {package}/libheif/linux_build_libs.py
178+
python3 {package}/libheif/build_libs.py
165179
CIBW_ENVIRONMENT_LINUX: PH_FULL_ACTION=1
166180

167181
- name: Checking built wheels
@@ -208,7 +222,7 @@ jobs:
208222
CIBW_BEFORE_ALL_LINUX: |
209223
${{ env.INSTALL_OS_PACKAGES }}
210224
python3 -m pip install cmake==3.31.6
211-
python3 {package}/libheif/linux_build_libs.py
225+
python3 {package}/libheif/build_libs.py
212226
CIBW_ENVIRONMENT_LINUX: PH_FULL_ACTION=1
213227

214228
- name: Checking built wheels
@@ -226,20 +240,25 @@ jobs:
226240

227241
sdist:
228242
name: Source distribution
229-
runs-on: macos-13
243+
runs-on: macos-14
230244

231245
steps:
232246
- uses: actions/checkout@v4
247+
- uses: actions/setup-python@v6
248+
with:
249+
python-version: '3.12'
250+
233251
- name: Install requirements
234-
run: python3 -m pip install check-manifest twine wheel
252+
run: python3 -m pip install twine wheel build check-manifest
235253

236254
- name: Run check-manifest
237255
run: python3 -m check_manifest
238256

239-
- name: Install libheif from formula
240-
run: |
241-
brew uninstall --force --ignore-dependencies imagemagick libheif aom
242-
brew install --formula ./libheif/macos/libheif.rb
257+
- name: Uninstall libheif from homebrew
258+
run: brew uninstall --force --ignore-dependencies imagemagick libheif x265 aom libde265
259+
260+
- name: Install libheif
261+
run: sudo python3 libheif/build_libs.py
243262

244263
- name: Build sdist
245264
run: |

ci/cirrus_general_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ test_src_build_full_freebsd_task:
1616
- pkg install -y gcc cmake aom x265
1717
- pkg install -y py311-pip
1818
- pkg install -y py311-pillow py311-numpy
19-
- python3.11 libheif/linux_build_libs.py
19+
- python3.11 libheif/build_libs.py
2020
install_pillow_heif_script:
2121
- python3.11 -m pip -v install --break-system-packages ".[tests-min]"
2222
libheif_info_script:

docker/from_src/Almalinux_9.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ FROM base as build_test
1515
COPY . /pillow_heif
1616

1717
RUN \
18-
python3 pillow_heif/libheif/linux_build_libs.py && \
18+
python3 pillow_heif/libheif/build_libs.py && \
1919
python3 -m pip install -v "pillow_heif/.[tests]"; \
2020
echo "**** Build Done ****" && \
2121
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \

docker/from_src/Alpine_3_20.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ COPY . /pillow_heif
1919
RUN \
2020
python3 -m venv --system-site-packages myenv && \
2121
source myenv/bin/activate && \
22-
python3 pillow_heif/libheif/linux_build_libs.py && \
22+
python3 pillow_heif/libheif/build_libs.py && \
2323
python3 -m pip install -v "pillow_heif/.[tests]"; \
2424
echo "**** Build Done ****" && \
2525
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \

docker/from_src/Debian_12.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ FROM base as build_test
2323
COPY . /pillow_heif
2424

2525
RUN \
26-
python3 pillow_heif/libheif/linux_build_libs.py && \
26+
python3 pillow_heif/libheif/build_libs.py && \
2727
python3 -m pip install -v --break-system-packages "pillow_heif/.[tests]"; \
2828
echo "**** Build Done ****" && \
2929
python3 -c "import pillow_heif; print(pillow_heif.libheif_info())" && \

docs/installation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Install `gcc`, `cmake`, `aom` and `x265`::
7777
- pkg install -y gcc cmake aom x265
7878
- pkg install -y py39-pip
7979
- pkg install -y py39-pillow py39-numpy
80-
- python3 libheif/linux_build_libs.py
80+
- python3 libheif/build_libs.py
8181

8282
Install Python and Pillow::
8383

0 commit comments

Comments
 (0)