forked from codedreality/homebrew-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pillow.rb
33 lines (28 loc) · 1.5 KB
/
pillow.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'formula'
class Pillow < Formula
homepage 'https://github.com/python-imaging/Pillow'
url 'https://github.com/python-imaging/Pillow/archive/2.3.0.tar.gz'
sha1 'f269109be21d27df3210e43fe11a17657bbfc261'
head 'https://github.com/python-imaging/Pillow.git'
depends_on :python => :recommended
depends_on 'little-cms'
depends_on 'graphicsmagick'
depends_on 'freetype'
depends_on 'jpeg'
depends_on 'libtiff'
def install
# Help pillow find zlib and little-cms (Note freetype2 is detected correctly)
inreplace "setup.py" do |s|
s.gsub! "ZLIB_ROOT = None", "ZLIB_ROOT = ('#{MacOS.sdk_path}/usr/lib', '#{MacOS.sdk_path}/usr/include')" unless MacOS::CLT.installed?
s.gsub! "LCMS_ROOT = None", "LCMS_ROOT = ('#{Formula["littlecms"].opt_prefix}/lib', '#{Formula["littlecms"].opt_prefix}/include')"
s.gsub! "JPEG_ROOT = None", "JPEG_ROOT = ('#{Formula["jpeg"].opt_prefix}/lib', '#{Formula["jpeg"].opt_prefix}/include')"
s.gsub! "TIFF_ROOT = None", "TIFF_ROOT = ('#{Formula["libtiff"].opt_prefix}/lib', '#{Formula["libtiff"].opt_prefix}/include')"
s.gsub! "FREETYPE_ROOT = None", "FREETYPE_ROOT = ('#{Formula["freetype"].opt_prefix}/lib', '#{Formula["freetype"].opt_prefix}/include')"
end
system "python", "setup.py", "install", "--prefix=#{prefix}", "--record=installed.txt", "--single-version-externally-managed"
end
def test
# Only a small test until https://github.com/python-imaging/Pillow/issues/17
system "python", "-c", "import PIL.Image"
end
end