Skip to content

Commit 3bbcd7b

Browse files
authored
Merge pull request #4642 from nulano/gha-msys
2 parents 63ef8be + 0b6f909 commit 3bbcd7b

7 files changed

Lines changed: 90 additions & 27 deletions

File tree

.appveyor.yml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ environment:
1616
ARCHITECTURE: x86
1717
- PYTHON: C:/Python35-x64
1818
ARCHITECTURE: x64
19-
- PYTHON: C:/msys64/mingw32
20-
EXECUTABLE: bin/python3
21-
ARCHITECTURE: x86
22-
PIP_DIR: bin
23-
TEST_OPTIONS: --processes=0
24-
DEPLOY: NO
2519

2620

2721
install:
@@ -35,31 +29,15 @@ install:
3529
- path c:\nasm-2.14.02;C:\Program Files (x86)\gs\gs9.52\bin;%PATH%
3630
- cd c:\pillow\winbuild\
3731
- ps: |
38-
if ($env:PYTHON -eq "c:/msys64/mingw32")
39-
{
40-
c:\msys64\usr\bin\bash -l -c c:\\pillow\\winbuild\\appveyor_install_msys2_deps.sh
41-
}
42-
else
43-
{
4432
c:\python37\python.exe c:\pillow\winbuild\build_prepare.py -v --depends=C:\pillow-depends\
4533
c:\pillow\winbuild\build\build_dep_all.cmd
4634
$host.SetShouldExit(0)
47-
}
4835
- path C:\pillow\winbuild\build\bin;%PATH%
4936

5037
build_script:
5138
- ps: |
52-
if ($env:PYTHON -eq "c:/msys64/mingw32")
53-
{
54-
c:\msys64\usr\bin\bash -l -c c:\\pillow\\winbuild\\appveyor_build_msys2.sh
55-
Write-Host "through install"
56-
$host.SetShouldExit(0)
57-
}
58-
else
59-
{
6039
c:\pillow\winbuild\build\build_pillow.cmd install
6140
$host.SetShouldExit(0)
62-
}
6341
- cd c:\pillow
6442
- '%PYTHON%\%EXECUTABLE% selftest.py --installed'
6543

.github/workflows/test-windows.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,76 @@ jobs:
154154
with:
155155
name: ${{ steps.wheel.outputs.dist }}
156156
path: dist\*.whl
157+
158+
msys:
159+
runs-on: windows-2019
160+
161+
strategy:
162+
fail-fast: false
163+
matrix:
164+
mingw: ["MINGW32", "MINGW64"]
165+
include:
166+
- mingw: "MINGW32"
167+
package: "mingw-w64-i686"
168+
- mingw: "MINGW64"
169+
package: "mingw-w64-x86_64"
170+
171+
defaults:
172+
run:
173+
shell: bash.exe --login -eo pipefail "{0}"
174+
env:
175+
MSYSTEM: ${{ matrix.mingw }}
176+
CHERE_INVOKING: 1
177+
178+
timeout-minutes: 30
179+
name: MSYS2 ${{ matrix.mingw }}
180+
181+
steps:
182+
- uses: actions/checkout@v2
183+
184+
- name: Set up shell
185+
run: echo ::add-path::C:\msys64\usr\bin\
186+
shell: pwsh
187+
188+
- name: Install Dependencies
189+
run: |
190+
pacman -S --noconfirm \
191+
${{ matrix.package }}-python3-pip \
192+
${{ matrix.package }}-python3-setuptools \
193+
${{ matrix.package }}-python3-pytest \
194+
${{ matrix.package }}-python3-pytest-cov \
195+
${{ matrix.package }}-python3-cffi \
196+
${{ matrix.package }}-python3-olefile \
197+
${{ matrix.package }}-python3-numpy \
198+
${{ matrix.package }}-python3-pyqt5 \
199+
${{ matrix.package }}-python3-numpy \
200+
${{ matrix.package }}-freetype \
201+
${{ matrix.package }}-lcms2 \
202+
${{ matrix.package }}-libwebp \
203+
${{ matrix.package }}-libjpeg-turbo \
204+
${{ matrix.package }}-openjpeg2 \
205+
${{ matrix.package }}-libimagequant \
206+
${{ matrix.package }}-libraqm \
207+
${{ matrix.package }}-ghostscript \
208+
subversion
209+
210+
python3 -m pip install pyroma
211+
212+
pushd depends && ./install_extra_test_images.sh && popd
213+
214+
- name: Build Pillow
215+
run: |
216+
# libtiff is unable to open files
217+
CFLAGS="-coverage" python3 setup.py build_ext --disable-tiff install
218+
219+
- name: Test Pillow
220+
run: |
221+
python3 selftest.py --installed
222+
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
223+
224+
- name: Upload coverage
225+
run: |
226+
python3 -m pip install codecov
227+
bash <(curl -s https://codecov.io/bash) -F GHA_Windows
228+
env:
229+
CODECOV_NAME: MSYS2 ${{ matrix.mingw }}

Tests/helper.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import os
77
import shutil
88
import sys
9+
import sysconfig
910
import tempfile
1011
from io import BytesIO
1112

@@ -288,6 +289,10 @@ def is_pypy():
288289
return hasattr(sys, "pypy_translation_info")
289290

290291

292+
def is_mingw():
293+
return sysconfig.get_platform() == "mingw"
294+
295+
291296
if sys.platform == "win32":
292297
IMCONVERT = os.environ.get("MAGICK_HOME", "")
293298
if IMCONVERT:

Tests/test_imagefont.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
assert_image_equal,
1414
assert_image_similar,
1515
assert_image_similar_tofile,
16+
is_mingw,
1617
is_pypy,
1718
is_win32,
1819
skip_unless_feature,
@@ -660,6 +661,7 @@ def test_variation_get(self):
660661
{"name": b"Size", "minimum": 0, "maximum": 300, "default": 0}
661662
]
662663

664+
@pytest.mark.skipif(is_mingw(), reason="epsilon too high for meaningful test")
663665
def test_variation_set_by_name(self):
664666
font = self.get_font()
665667

@@ -692,6 +694,7 @@ def _check_text(font, path, epsilon):
692694
font.set_variation_by_name(name)
693695
_check_text(font, "Tests/images/variation_tiny_name.png", 40)
694696

697+
@pytest.mark.skipif(is_mingw(), reason="epsilon too high for meaningful test")
695698
def test_variation_set_by_axes(self):
696699
font = self.get_font()
697700

Tests/test_imagefontctl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_complex_unicode_text():
6060

6161
target = "Tests/images/test_complex_unicode_text2.png"
6262
with Image.open(target) as target_img:
63-
assert_image_similar(im, target_img, 2.3)
63+
assert_image_similar(im, target_img, 2.33)
6464

6565

6666
def test_text_direction_rtl():

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ def build_extensions(self):
711711
if feature.jpeg2000:
712712
libs.append(feature.jpeg2000)
713713
defs.append(("HAVE_OPENJPEG", None))
714-
if sys.platform == "win32":
714+
if sys.platform == "win32" and not PLATFORM_MINGW:
715715
defs.append(("OPJ_STATIC", None))
716716
if feature.zlib:
717717
libs.append(feature.zlib)

src/_imagingft.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
#define KEEP_PY_UNICODE
3333

34-
#if !defined(_MSC_VER)
34+
#ifndef _WIN32
3535
#include <dlfcn.h>
3636
#endif
3737

@@ -155,20 +155,24 @@ setraqm(void)
155155
p_raqm.raqm = NULL;
156156

157157
/* Microsoft needs a totally different system */
158-
#if !defined(_MSC_VER)
158+
#ifndef _WIN32
159159
p_raqm.raqm = dlopen("libraqm.so.0", RTLD_LAZY);
160160
if (!p_raqm.raqm) {
161161
p_raqm.raqm = dlopen("libraqm.dylib", RTLD_LAZY);
162162
}
163163
#else
164164
p_raqm.raqm = LoadLibrary("libraqm");
165+
/* MSYS */
166+
if (!p_raqm.raqm) {
167+
p_raqm.raqm = LoadLibrary("libraqm-0");
168+
}
165169
#endif
166170

167171
if (!p_raqm.raqm) {
168172
return 1;
169173
}
170174

171-
#if !defined(_MSC_VER)
175+
#ifndef _WIN32
172176
p_raqm.version_atleast = (t_raqm_version_atleast)dlsym(p_raqm.raqm, "raqm_version_atleast");
173177
p_raqm.create = (t_raqm_create)dlsym(p_raqm.raqm, "raqm_create");
174178
p_raqm.set_text = (t_raqm_set_text)dlsym(p_raqm.raqm, "raqm_set_text");

0 commit comments

Comments
 (0)