summaryrefslogtreecommitdiffstats
path: root/packaging/macosx/ports/python/py-Pillow/files/patch-setup.py.diff
blob: fe300cfe5228da9199deae34e9cf633672b41a7c (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
--- 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]))