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