--- setup.py.orig 2014-07-04 17:25:36.000000000 +0200 +++ setup.py 2014-07-04 17:33:05.000000000 +0200 @@ -19,7 +19,7 @@ from setuptools import Extension, setup, find_packages # monkey patch import hook. Even though flake8 says it's not used, it is. -# comment this out to disable multi threaded builds. +# comment this out to disable multi threaded builds. import mp_compile _IMAGING = ( @@ -200,44 +200,8 @@ "/usr/lib", "python%s" % sys.version[:3], "config")) elif sys.platform == "darwin": - # attempt to make sure we pick freetype2 over other versions - _add_directory(include_dirs, "/sw/include/freetype2") - _add_directory(include_dirs, "/sw/lib/freetype2/include") - # fink installation directories - _add_directory(library_dirs, "/sw/lib") - _add_directory(include_dirs, "/sw/include") - # darwin ports installation directories - _add_directory(library_dirs, "/opt/local/lib") - _add_directory(include_dirs, "/opt/local/include") - - # if Homebrew is installed, use its lib and include directories - import subprocess - try: - prefix = subprocess.check_output( - ['brew', '--prefix'] - ).strip().decode('latin1') - except: - # Homebrew not installed - prefix = None - - ft_prefix = None - - if prefix: - # add Homebrew's include and lib directories - _add_directory(library_dirs, os.path.join(prefix, 'lib')) - _add_directory(include_dirs, os.path.join(prefix, 'include')) - ft_prefix = os.path.join(prefix, 'opt', 'freetype') - - if ft_prefix and os.path.isdir(ft_prefix): - # freetype might not be linked into Homebrew's prefix - _add_directory(library_dirs, os.path.join(ft_prefix, 'lib')) - _add_directory( - include_dirs, os.path.join(ft_prefix, 'include')) - else: - # fall back to freetype from XQuartz if - # Homebrew's freetype is missing - _add_directory(library_dirs, "/usr/X11/lib") - _add_directory(include_dirs, "/usr/X11/include") + _add_directory(library_dirs, "@prefix@/lib") + _add_directory(include_dirs, "@prefix@/include") elif sys.platform.startswith("linux"): arch_tp = (plat.processor(), plat.architecture()[0]) @@ -337,21 +301,6 @@ else: TCL_ROOT = None - # add standard directories - - # look for tcl specific subdirectory (e.g debian) - if _tkinter: - tcl_dir = "/usr/include/tcl" + TCL_VERSION - if os.path.isfile(os.path.join(tcl_dir, "tk.h")): - _add_directory(include_dirs, tcl_dir) - - # standard locations - _add_directory(library_dirs, "/usr/local/lib") - _add_directory(include_dirs, "/usr/local/include") - - _add_directory(library_dirs, "/usr/lib") - _add_directory(include_dirs, "/usr/include") - # on Windows, look for the OpenJPEG libraries in the location that # the official installer puts them if sys.platform == "win32": @@ -410,7 +359,7 @@ for directory in self.compiler.include_dirs: try: listdir = os.listdir(directory) - except Exception: + except Exception: # WindowsError, FileNotFoundError continue for name in listdir: @@ -570,29 +519,7 @@ exts.append(Extension( "PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs)) - if sys.platform == "darwin": - # locate Tcl/Tk frameworks - frameworks = [] - framework_roots = [ - "/Library/Frameworks", - "/System/Library/Frameworks"] - for root in framework_roots: - if ( - os.path.exists(os.path.join(root, "Tcl.framework")) and - os.path.exists(os.path.join(root, "Tk.framework"))): - print("--- using frameworks at %s" % root) - frameworks = ["-framework", "Tcl", "-framework", "Tk"] - dir = os.path.join(root, "Tcl.framework", "Headers") - _add_directory(self.compiler.include_dirs, dir, 0) - dir = os.path.join(root, "Tk.framework", "Headers") - _add_directory(self.compiler.include_dirs, dir, 1) - break - if frameworks: - exts.append(Extension( - "PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"], - extra_compile_args=frameworks, extra_link_args=frameworks)) - feature.tcl = feature.tk = 1 # mark as present - elif feature.tcl and feature.tk: + if feature.tcl and feature.tk: exts.append(Extension( "PIL._imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"], libraries=[feature.tcl, feature.tk]))