mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Merge pull request #1937 from wiredfool/alpine-setup
Alpine setup.py fixes
This commit is contained in:
commit
45b28a2a4b
43
depends/alpine_Dockerfile
Normal file
43
depends/alpine_Dockerfile
Normal file
|
@ -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/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 " >> 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
|
||||||
|
|
||||||
|
CMD ["/test"]
|
9
setup.py
9
setup.py
|
@ -405,6 +405,8 @@ class pil_build_ext(build_ext):
|
||||||
|
|
||||||
_add_directory(library_dirs, "/usr/lib")
|
_add_directory(library_dirs, "/usr/lib")
|
||||||
_add_directory(include_dirs, "/usr/include")
|
_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
|
# on Windows, look for the OpenJPEG libraries in the location that
|
||||||
# the official installer puts them
|
# the official installer puts them
|
||||||
|
@ -789,8 +791,11 @@ class pil_build_ext(build_ext):
|
||||||
if not os.path.exists(self.build_temp):
|
if not os.path.exists(self.build_temp):
|
||||||
os.makedirs(self.build_temp)
|
os.makedirs(self.build_temp)
|
||||||
with open(tmpfile, 'wb') as fp:
|
with open(tmpfile, 'wb') as fp:
|
||||||
ret = subprocess.call([
|
try:
|
||||||
'dpkg-architecture', '-qDEB_HOST_MULTIARCH'], stdout=fp)
|
ret = subprocess.call(['dpkg-architecture',
|
||||||
|
'-qDEB_HOST_MULTIARCH'], stdout=fp)
|
||||||
|
except:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
if ret >> 8 == 0:
|
if ret >> 8 == 0:
|
||||||
fp = open(tmpfile, 'r')
|
fp = open(tmpfile, 'r')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user