From ac51f1ee37b3ac64b99b43cb1171f84daa12aa45 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 30 May 2016 06:28:08 -0700 Subject: [PATCH 1/4] Fixes to run cleanly on alpine linux --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 76e2dfc97..511422e7b 100644 --- a/setup.py +++ b/setup.py @@ -405,6 +405,8 @@ class pil_build_ext(build_ext): _add_directory(library_dirs, "/usr/lib") _add_directory(include_dirs, "/usr/include") + # alpine, at least + _add_directory(library_dirs, "/lib") # on Windows, look for the OpenJPEG libraries in the location that # the official installer puts them @@ -789,8 +791,11 @@ class pil_build_ext(build_ext): if not os.path.exists(self.build_temp): os.makedirs(self.build_temp) with open(tmpfile, 'wb') as fp: - ret = subprocess.call([ - 'dpkg-architecture', '-qDEB_HOST_MULTIARCH'], stdout=fp) + try: + ret = subprocess.call(['dpkg-architecture', + '-qDEB_HOST_MULTIARCH'], stdout=fp) + except: + return try: if ret >> 8 == 0: fp = open(tmpfile, 'r') From d81c01605215633bdf9999d6ca9ec4d348a404ed Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 30 May 2016 06:51:45 -0700 Subject: [PATCH 2/4] Sample dockerfile for alpine linux --- depends/alpine_Dockerfile | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 depends/alpine_Dockerfile diff --git a/depends/alpine_Dockerfile b/depends/alpine_Dockerfile new file mode 100644 index 000000000..aeb2a242c --- /dev/null +++ b/depends/alpine_Dockerfile @@ -0,0 +1,43 @@ +# This is a sample Dockerfile to build Pillow on Alpine Linux +# with all/most of the dependencies working. +# +# Tcl/Tk isn't detecting +# Freetype has different metrics so tests are failing. +# sudo and bash are required for the webp build script. + +FROM alpine +USER root + +RUN apk --no-cache add python \ + build-base \ + python-dev \ + py-pip \ + # Pillow depenencies + jpeg-dev \ + zlib-dev \ + freetype-dev \ + lcms2-dev \ + openjpeg-dev \ + tiff-dev \ + tk-dev \ + tcl-dev + +# install from pip, without webp +#RUN LIBRARY_PATH=/lib:/usr/lib /bin/sh -c "pip install Pillow" + +# install from git, run tests, including webp +RUN apk --no-cache add git \ + bash \ + sudo + +RUN git clone https://github.com/wiredfool/Pillow.git /Pillow +RUN pip install virtualenv && virtualenv /vpy && source /vpy/bin/activate && pip install nose + +RUN echo "#!/bin/bash" >> /test && \ + echo "source /vpy/bin/activate && cd /Pillow && git checkout alpine-setup " >> test && \ + echo "pushd depends && ./install_webp.sh && popd" >> test && \ + echo "LIBRARY_PATH=/lib:/usr/lib make install && make test" >> test + +RUN chmod +x /test + +CMD ["/test"] From d316c185b3d4b392801f3538ced37781e6dc6500 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 30 May 2016 07:02:06 -0700 Subject: [PATCH 3/4] Main git repo, on master. Will fail till PR is merged --- depends/alpine_Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/depends/alpine_Dockerfile b/depends/alpine_Dockerfile index aeb2a242c..b95131b5a 100644 --- a/depends/alpine_Dockerfile +++ b/depends/alpine_Dockerfile @@ -30,11 +30,11 @@ RUN apk --no-cache add git \ bash \ sudo -RUN git clone https://github.com/wiredfool/Pillow.git /Pillow +RUN git clone https://github.com/python-pillow/Pillow.git /Pillow RUN pip install virtualenv && virtualenv /vpy && source /vpy/bin/activate && pip install nose RUN echo "#!/bin/bash" >> /test && \ - echo "source /vpy/bin/activate && cd /Pillow && git checkout alpine-setup " >> test && \ + echo "source /vpy/bin/activate && cd /Pillow " >> test && \ echo "pushd depends && ./install_webp.sh && popd" >> test && \ echo "LIBRARY_PATH=/lib:/usr/lib make install && make test" >> test From 187c0f48d7543d4fb61af776bd9c0a5a8f98ad13 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 30 May 2016 07:18:23 -0700 Subject: [PATCH 4/4] imagequant build --- depends/alpine_Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/alpine_Dockerfile b/depends/alpine_Dockerfile index b95131b5a..1ab624690 100644 --- a/depends/alpine_Dockerfile +++ b/depends/alpine_Dockerfile @@ -35,7 +35,7 @@ RUN pip install virtualenv && virtualenv /vpy && source /vpy/bin/activate && pip RUN echo "#!/bin/bash" >> /test && \ echo "source /vpy/bin/activate && cd /Pillow " >> test && \ - echo "pushd depends && ./install_webp.sh && popd" >> test && \ + echo "pushd depends && ./install_webp.sh && ./install_imagequant.sh && popd" >> test && \ echo "LIBRARY_PATH=/lib:/usr/lib make install && make test" >> test RUN chmod +x /test