From 80bce359a34e472177934602e1468416215fe20e Mon Sep 17 00:00:00 2001 From: David McKeone Date: Thu, 19 Dec 2013 12:34:32 -0700 Subject: [PATCH] Prefer homebrew freetype over X11 freetype (but still allow both) I've recently included Pillow with a py2app build of a frozen application on OS X. When Pillow is installed on a machine that has X11, the preference for X11's libfreetype causes a new dependency for my frozen app. I don't want my users to be required to install X11 if they don't have to (it's not included by default after OS X 10.8). This PR adds a preference for homebrew's libfreetype (if available), which py2app detects and includes, and which doesn't create an X11 dependency in apps that are frozen and use Pillow (PIL). --- setup.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index f4b8532de..7890cccd6 100644 --- a/setup.py +++ b/setup.py @@ -201,9 +201,6 @@ class pil_build_ext(build_ext): # darwin ports installation directories _add_directory(library_dirs, "/opt/local/lib") _add_directory(include_dirs, "/opt/local/include") - # freetype2 ships with X11 - _add_directory(library_dirs, "/usr/X11/lib") - _add_directory(include_dirs, "/usr/X11/include") # if homebrew is installed, use its lib and include directories import subprocess try: @@ -212,9 +209,16 @@ class pil_build_ext(build_ext): prefix = prefix.strip() _add_directory(library_dirs, os.path.join(prefix, 'lib')) _add_directory(include_dirs, os.path.join(prefix, 'include')) + # freetype2 is a keg-only brew under opt/ + _add_directory(library_dirs, os.path.join(prefix, 'opt', 'freetype', 'lib')) + _add_directory(include_dirs, os.path.join(prefix, 'opt', 'freetype', 'include')) except: pass # homebrew not installed - + + # freetype2 ships with X11 (after homebrew, so that homebrew freetype is prefered) + _add_directory(library_dirs, "/usr/X11/lib") + _add_directory(include_dirs, "/usr/X11/include") + elif sys.platform.startswith("linux"): for platform_ in (plat.processor(), plat.architecture()[0]):