Skip to content

Commit

Permalink
elif
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Nov 14, 2023
1 parent 5c49887 commit f3e313d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 71 deletions.
34 changes: 3 additions & 31 deletions .github/workflows/wheels-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ function build {
build_simple libpthread-stubs 0.5 https://xcb.freedesktop.org/dist
if [ -f /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc ]; then
cp /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc /Library/Frameworks/Python.framework/Versions/Current/lib/pkgconfig
elif [ -f /Users/runner/hostedtoolcache/Python/Current/x64/share/pkgconfig/xcb-proto.pc ]; then
cp /Users/runner/hostedtoolcache/Python/Current/x64/share/pkgconfig/xcb-proto.pc /Users/runner/hostedtoolcache/Python/Current/x64/share/pkgconfig
fi
find / -iname xcb.h
else
sed s/\${pc_sysrootdir\}// /usr/local/share/pkgconfig/xcb-proto.pc > /usr/local/lib/pkgconfig/xcb-proto.pc
fi
Expand All @@ -94,37 +97,6 @@ function build {
if [[ -n "$IS_MACOS" ]]; then
rm /usr/local/lib/libjpeg.dylib
fi
build_tiff
build_libpng
build_lcms2
build_openjpeg

ORIGINAL_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -O3 -DNDEBUG"
if [[ -n "$IS_MACOS" ]]; then
CFLAGS="$CFLAGS -Wl,-headerpad_max_install_names"
fi
build_libwebp
CFLAGS=$ORIGINAL_CFLAGS

build_brotli

if [ -n "$IS_MACOS" ]; then
# Custom freetype build
build_simple freetype $FREETYPE_VERSION https://download.savannah.gnu.org/releases/freetype tar.gz --with-harfbuzz=no
else
build_freetype
fi

if [ -z "$IS_MACOS" ]; then
export FREETYPE_LIBS=-lfreetype
export FREETYPE_CFLAGS=-I/usr/local/include/freetype2/
fi
build_simple harfbuzz $HARFBUZZ_VERSION https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION tar.xz --with-freetype=yes --with-glib=no
if [ -z "$IS_MACOS" ]; then
export FREETYPE_LIBS=""
export FREETYPE_CFLAGS=""
fi
}

# Any stuff that you need to do before you start building the wheels
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/wheels-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,6 @@ EXP_CODECS="jpg jpg_2000 libtiff zlib"
EXP_MODULES="freetype2 littlecms2 pil tkinter webp"
EXP_FEATURES="fribidi harfbuzz libjpeg_turbo raqm transp_webp webp_anim webp_mux xcb"

if [[ "$OSTYPE" == "darwin"* ]]; then
brew install fribidi
export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
elif [ "${AUDITWHEEL_POLICY:9}" == "musllinux" ]; then
apk add curl fribidi
else
yum install -y fribidi openblas-devel pkgconfig
fi
if [ "${AUDITWHEEL_POLICY:9}" != "musllinux" ]; then
python3 -m pip install numpy
fi

curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip
unzip pillow-test-images.zip
mv test-images-main/* Tests/images

# Runs tests
python3 selftest.py
python3 -m pytest

# Test against expected codecs, modules and features
codecs=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_codecs())))')
if [ "$codecs" != "$EXP_CODECS" ]; then
echo "Codecs should be: '$EXP_CODECS'; but are '$codecs'"
exit 1
fi
modules=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_modules())))')
if [ "$modules" != "$EXP_MODULES" ]; then
echo "Modules should be: '$EXP_MODULES'; but are '$modules'"
exit 1
fi
features=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_features())))')
if [ "$features" != "$EXP_FEATURES" ]; then
echo "Features should be: '$EXP_FEATURES'; but are '$features'"
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,10 @@ jobs:
- name: "macOS x86_64"
os: macos-latest
archs: x86_64
- name: "macOS arm64"
os: macos-latest
archs: arm64
- name: "manylinux2014 and musllinux x86_64"
os: ubuntu-latest
archs: x86_64
- name: "manylinux_2_28 x86_64"
- name: "manylinux2014"
os: ubuntu-latest
archs: x86_64
build: "*manylinux*"
manylinux: "manylinux_2_28"
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -42,7 +35,6 @@ jobs:
env:
CIBW_ARCHS: ${{ matrix.archs }}
CIBW_BUILD: ${{ matrix.build }}
CIBW_CONFIG_SETTINGS: raqm=enable raqm=vendor fribidi=vendor
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux }}
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }}
- uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Twitter = "https://twitter.com/PythonPillow"
before-all = ".github/workflows/wheels-dependencies.sh"
test-command = "cd {project} && .github/workflows/wheels-test.sh"
test-extras = "tests"
build-frontend = { name = "pip", args = ["-v"] }

[tool.setuptools]
packages = ["PIL"]
Expand Down
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ def _find_include_file(self, include):
_dbg("Checking for include file %s in %s", (include, directory))
if os.path.isfile(os.path.join(directory, include)):
_dbg("Found %s", include)
print(os.path.join(directory, include))
return 1
return 0

Expand Down Expand Up @@ -802,8 +803,14 @@ def build_extensions(self):
if feature.want("xcb"):
_dbg("Looking for xcb")
if _find_include_file(self, "xcb/xcb.h"):
print("torch include found")
if _find_library_file(self, "xcb"):
print("torch library found")
feature.xcb = "xcb"
else:
print("torch library missing")
else:
print("torch include missing")

for f in feature:
if not getattr(feature, f) and feature.require(f):
Expand Down

0 comments on commit f3e313d

Please sign in to comment.