2016-06-20 21:30:30 +03:00
|
|
|
# Define custom utilities
|
|
|
|
# Test for OSX with [ -n "$IS_OSX" ]
|
|
|
|
|
2018-07-03 12:41:06 +03:00
|
|
|
ARCHIVE_SDIR=pillow-depends-master
|
|
|
|
|
2016-07-31 23:09:20 +03:00
|
|
|
# Package versions for fresh source builds
|
2019-07-13 05:07:00 +03:00
|
|
|
FREETYPE_VERSION=2.10.1
|
2019-04-16 13:00:11 +03:00
|
|
|
LIBPNG_VERSION=1.6.37
|
2017-01-17 12:41:21 +03:00
|
|
|
ZLIB_VERSION=1.2.11
|
2018-05-18 14:40:20 +03:00
|
|
|
JPEG_VERSION=9c
|
2019-04-03 03:40:02 +03:00
|
|
|
OPENJPEG_VERSION=2.3.1
|
2018-09-16 05:12:25 +03:00
|
|
|
XZ_VERSION=5.2.4
|
2019-11-04 11:06:16 +03:00
|
|
|
TIFF_VERSION=4.1.0
|
2017-11-27 11:38:28 +03:00
|
|
|
LCMS2_VERSION=2.9
|
2018-09-16 05:12:25 +03:00
|
|
|
GIFLIB_VERSION=5.1.4
|
2019-07-13 14:39:47 +03:00
|
|
|
LIBWEBP_VERSION=1.0.3
|
2016-07-31 23:09:20 +03:00
|
|
|
|
2016-06-20 21:30:30 +03:00
|
|
|
function pre_build {
|
|
|
|
# Any stuff that you need to do before you start building the wheels
|
|
|
|
# Runs in the root directory of this repository.
|
2018-07-03 12:41:06 +03:00
|
|
|
curl -fsSL -o pillow-depends-master.zip https://github.com/python-pillow/pillow-depends/archive/master.zip
|
|
|
|
untar pillow-depends-master.zip
|
2016-06-20 21:30:30 +03:00
|
|
|
if [ -n "$IS_OSX" ]; then
|
2016-07-31 23:09:20 +03:00
|
|
|
# Update to latest zlib for OSX build
|
|
|
|
build_new_zlib
|
|
|
|
fi
|
2019-04-08 12:07:51 +03:00
|
|
|
|
|
|
|
# Custom flags to include both multibuild and jpeg defaults
|
|
|
|
ORIGINAL_CFLAGS=$CFLAGS
|
|
|
|
CFLAGS="$CFLAGS -g -O2"
|
2016-07-31 23:09:20 +03:00
|
|
|
build_jpeg
|
2019-04-08 12:07:51 +03:00
|
|
|
CFLAGS=$ORIGINAL_CFLAGS
|
|
|
|
|
2016-07-31 23:09:20 +03:00
|
|
|
build_tiff
|
|
|
|
build_libpng
|
|
|
|
build_openjpeg
|
|
|
|
build_lcms2
|
2018-10-13 13:54:45 +03:00
|
|
|
|
|
|
|
if [ -n "$IS_OSX" ]; then
|
|
|
|
# Custom flags to allow building on OS X 10.10 and 10.11
|
|
|
|
build_giflib
|
|
|
|
|
|
|
|
ORIGINAL_CPPFLAGS=$CPPFLAGS
|
|
|
|
CPPFLAGS=""
|
|
|
|
fi
|
2019-09-02 15:13:42 +03:00
|
|
|
CFLAGS="$CFLAGS -O3 -DNDEBUG"
|
2016-07-31 23:09:20 +03:00
|
|
|
build_libwebp
|
2019-09-02 15:13:42 +03:00
|
|
|
CFLAGS=$ORIGINAL_CFLAGS
|
2018-10-13 13:54:45 +03:00
|
|
|
if [ -n "$IS_OSX" ]; then
|
|
|
|
CPPFLAGS=$ORIGINAL_CPPFLAGS
|
|
|
|
fi
|
|
|
|
|
2016-07-31 23:09:20 +03:00
|
|
|
if [ -n "$IS_OSX" ]; then
|
|
|
|
# Custom freetype build
|
2018-08-04 04:18:39 +03:00
|
|
|
build_simple freetype $FREETYPE_VERSION https://download.savannah.gnu.org/releases/freetype tar.gz --with-harfbuzz=no
|
2016-06-20 21:30:30 +03:00
|
|
|
else
|
|
|
|
build_freetype
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function run_tests_in_repo {
|
|
|
|
# Run Pillow tests from within source repo
|
2019-05-12 23:03:56 +03:00
|
|
|
python selftest.py
|
2017-12-27 17:43:53 +03:00
|
|
|
pytest
|
2016-06-20 21:30:30 +03:00
|
|
|
}
|
|
|
|
|
2016-07-31 23:09:20 +03:00
|
|
|
EXP_CODECS="jpg jpg_2000 libtiff zlib"
|
|
|
|
EXP_MODULES="freetype2 littlecms2 pil tkinter webp"
|
|
|
|
|
2016-06-20 21:30:30 +03:00
|
|
|
function run_tests {
|
|
|
|
# Runs tests on installed distribution from an empty directory
|
|
|
|
(cd ../Pillow && run_tests_in_repo)
|
2016-07-31 23:09:20 +03:00
|
|
|
# Show supported codecs and modules
|
|
|
|
local codecs=$(python -c 'from PIL.features import *; print(" ".join(sorted(get_supported_codecs())))')
|
|
|
|
# Test against expected codecs and modules
|
|
|
|
local ret=0
|
|
|
|
if [ "$codecs" != "$EXP_CODECS" ]; then
|
|
|
|
echo "Codecs should be: '$EXP_CODECS'; but are '$codecs'"
|
|
|
|
ret=1
|
|
|
|
fi
|
|
|
|
local modules=$(python -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'"
|
|
|
|
ret=1
|
|
|
|
fi
|
|
|
|
return $ret
|
2016-06-20 21:30:30 +03:00
|
|
|
}
|