From 754b609628ac9430c6705d8791f4d775da69b8ae Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 31 Jul 2016 13:09:20 -0700 Subject: [PATCH 1/3] RF: switch to using multibuild for OSX Update to latest multibuild Remove terryfy submodule. Adapt config.sh to do OSX-specifics for build. Add tests for installed codecs and modules. --- .gitmodules | 3 --- .travis.yml | 8 +++---- Pillow | 2 +- config.sh | 58 ++++++++++++++++++++++++++++++++++++++++------- multibuild | 2 +- osx_build_deps.sh | 36 ----------------------------- terryfy | 1 - 7 files changed, 56 insertions(+), 54 deletions(-) delete mode 100644 osx_build_deps.sh delete mode 160000 terryfy diff --git a/.gitmodules b/.gitmodules index 8d2587026..1d7e2128d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "multibuild"] path = multibuild url = https://github.com/matthew-brett/multibuild.git -[submodule "terryfy"] - path = terryfy - url = https://github.com/MacPython/terryfy.git diff --git a/.travis.yml b/.travis.yml index ea7647798..14f0083a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,18 +54,18 @@ matrix: - MB_PYTHON_VERSION=3.5 - PLAT=i686 - os: osx - language: objective-c + language: generic env: MB_PYTHON_VERSION=2.7 - os: osx - language: objective-c + language: generic env: - MB_PYTHON_VERSION=3.3 - os: osx - language: objective-c + language: generic env: - MB_PYTHON_VERSION=3.4 - os: osx - language: objective-c + language: generic env: - MB_PYTHON_VERSION=3.5 diff --git a/Pillow b/Pillow index 4f4c98222..f54c60c16 160000 --- a/Pillow +++ b/Pillow @@ -1 +1 @@ -Subproject commit 4f4c98222914353470336ab7288c1f1876b4b2b7 +Subproject commit f54c60c162bb6f97421e4712ca65cfe9f0b3cc94 diff --git a/config.sh b/config.sh index d8d4b89c8..45c01c91d 100644 --- a/config.sh +++ b/config.sh @@ -1,19 +1,44 @@ # Define custom utilities # Test for OSX with [ -n "$IS_OSX" ] +# Package versions for fresh source builds +FREETYPE_VERSION=2.6.4 +LIBPNG_VERSION=1.6.23 +ZLIB_VERSION=1.2.8 +JPEG_VERSION=9b +OPENJPEG_VERSION=2.1 +TIFF_VERSION=4.0.6 +LCMS2_VERSION=2.7 +LIBWEBP_VERSION=0.5.1 + function pre_build { # Any stuff that you need to do before you start building the wheels # Runs in the root directory of this repository. - set -e if [ -n "$IS_OSX" ]; then - source osx_build_deps.sh + # Update to latest zlib for OSX build + build_new_zlib + else # Linux tests may depend on specific versions + FREETYPE_VERSION=2.6.3 + fi + build_jpeg + build_tiff + build_libpng + build_openjpeg + if [ -n "$IS_OSX" ]; then + # Fix openjpeg library install id + # https://code.google.com/p/openjpeg/issues/detail?id=367 + install_name_tool -id $BUILD_PREFIX/lib/libopenjp2.7.dylib $BUILD_PREFIX/lib/libopenjp2.2.1.0.dylib + fi + build_lcms2 + build_libwebp + if [ -n "$IS_OSX" ]; then + # Custom freetype build + local ft_name_ver=freetype-${FREETYPE_VERSION} + fetch_unpack http://download.savannah.gnu.org/releases/freetype/${ft_name_ver}.tar.gz + (cd $ft_name_ver \ + && ./configure --prefix=$BUILD_PREFIX "--with-harfbuzz=no" \ + && make && make install) else - source multibuild/library_builders.sh - build_jpeg - build_tiff - build_openjpeg - build_lcms2 - build_libwebp build_freetype fi } @@ -27,9 +52,26 @@ function run_tests_in_repo { fi } +EXP_CODECS="jpg jpg_2000 libtiff zlib" +EXP_MODULES="freetype2 littlecms2 pil tkinter webp" + function run_tests { # Runs tests on installed distribution from an empty directory export NOSE_PROCESS_TIMEOUT=600 export NOSE_PROCESSES=0 (cd ../Pillow && run_tests_in_repo) + # 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 } diff --git a/multibuild b/multibuild index d7ba4ae3e..db8f38459 160000 --- a/multibuild +++ b/multibuild @@ -1 +1 @@ -Subproject commit d7ba4ae3e76af2a6ea13d3c83ddea41d8c2e1cad +Subproject commit db8f384596bbe436efdfa205f181f6c5209abbc4 diff --git a/osx_build_deps.sh b/osx_build_deps.sh deleted file mode 100644 index c9d708dc3..000000000 --- a/osx_build_deps.sh +++ /dev/null @@ -1,36 +0,0 @@ -# Script for building Pillow dependencies on OSX -source terryfy/library_installers.sh - -# Compiler -export CC=clang -export CXX=clang++ - -# Package versions for fresh source builds -FT_VERSION=2.6.4 -PNG_VERSION=1.6.23 -ZLIB_VERSION=1.2.8 -JPEG_VERSION=9b -OPENJPEG_VERSION=2.1.0 -TIFF_VERSION=4.0.6 -LCMS_VERSION=2.7 -WEBP_VERSION=0.5.1 - -# Need cmake for openjpeg -brew install cmake -# Need pkg-config for freetype to find libpng -brew install pkg-config -# Set up build -clean_builds -clean_submodule Pillow -standard_install zlib $ZLIB_VERSION .tar.xz -standard_install jpeg $JPEG_VERSION .tar.gz jpegsrc.v -standard_install tiff $TIFF_VERSION -standard_install libpng $PNG_VERSION -standard_install lcms2 $LCMS_VERSION -WEBP_EXTRAS="--enable-libwebpmux --enable-libwebpdemux" -standard_install libwebp $WEBP_VERSION .tar.gz libwebp- "$WEBP_EXTRAS" -standard_install openjpeg $OPENJPEG_VERSION .tar.gz openjpeg- cmake -# Fix openjpeg library install id -# https://code.google.com/p/openjpeg/issues/detail?id=367 -install_name_tool -id $PWD/build/lib/libopenjp2.7.dylib build/lib/libopenjp2.2.1.0.dylib -standard_install freetype $FT_VERSION .tar.gz freetype- "--with-harfbuzz=no" diff --git a/terryfy b/terryfy deleted file mode 160000 index 48785a36b..000000000 --- a/terryfy +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 48785a36b56e17a53def971153bd775aae230eba From a0ed8d5e4188856172bad593f7e21a3163506480 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 2 Aug 2016 13:51:52 -0700 Subject: [PATCH 2/3] Fix numpy / scipy version for Python 3.3 Set numpy / scipy versions for Python 3.3 build - these aren't on pypi for the latest versions. --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 14f0083a8..cb647b545 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,6 +60,8 @@ matrix: language: generic env: - MB_PYTHON_VERSION=3.3 + # Last numpy / scipy version built for Python 3.3 + - TEST_DEPENDS="nose numpy==1.11.0 scipy==0.17.1" - os: osx language: generic env: From e6eea5470afd3aa526e7773a8c1f0f1edcbaf8ce Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 2 Aug 2016 14:48:13 -0700 Subject: [PATCH 3/3] DOC: README to discourage additions to archives Can usually get away with not downloading archives to the `archives` directory. --- archives/README.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 archives/README.rst diff --git a/archives/README.rst b/archives/README.rst new file mode 100644 index 000000000..c3ead01f1 --- /dev/null +++ b/archives/README.rst @@ -0,0 +1,18 @@ +################################## +Archives for pillow library builds +################################## + +This directory contains archives for libraries that will be built as part of +the Pillow build. + +In general, there is no need to put library archives here, because the +``multibuild`` scripts will download them from their respective URLs. + +But, ``multibuild`` will look in this directory before downloading from the +URL, so if there is a library that often fails to download, or you think might +fail to download, then download it to this directory and add it to the git +repository. + +See the ``fetch_unpack`` routine in ``multibuild/common_utils.sh`` for the +logic, and the build recipes in ``multibuild/library_builders.sh`` for the +filename to give to the downloaded archive.