|
36 | 36 | 'linux2' : ['/usr/local', '/usr',], |
37 | 37 | 'linux' : ['/usr/local', '/usr',], |
38 | 38 | 'darwin' : [os.getenv('MPLIB_BASE') or '/usr/local', '/usr', '/sw'], |
39 | | - 'freebsd4' : [os.getenv('MBLIB_BASE') or '/usr/local', '/usr'], |
| 39 | + 'freebsd4' : [os.getenv('MPLIB_BASE') or '/usr/local', '/usr'], |
40 | 40 | 'sunos5' : [os.getenv('MPLIB_BASE') or '/usr/local',], |
41 | 41 | } |
42 | 42 |
|
@@ -212,15 +212,59 @@ def add_tk_flags(module): |
212 | 212 | module.include_dirs.extend(['win32_static/include/tcl']) |
213 | 213 | module.library_dirs.extend(['C:/Python23/dlls']) |
214 | 214 | module.libraries.extend(['tk84', 'tcl84']) |
215 | | - else: |
216 | | - o = find_tcltk() |
217 | | - if sys.platform == 'darwin' and '/Library/Framework' in o.tk_lib: |
218 | | - module.extra_link_args.extend(['-framework','Tcl']) |
219 | | - module.extra_link_args.extend(['-framework','Tk']) |
220 | | - else: |
221 | | - module.include_dirs.extend([o.tcl_inc, o.tk_inc]) |
222 | | - module.library_dirs.extend([o.tcl_lib, o.tk_lib]) |
223 | | - module.libraries.extend(['tk'+o.tkv, 'tcl'+o.tkv]) |
| 215 | + return |
| 216 | + |
| 217 | + elif sys.platform == 'darwin' : |
| 218 | + # this config section lifted directly from Imaging - thanks to |
| 219 | + # the effbot! |
| 220 | + |
| 221 | + # First test for a MacOSX/darwin framework install |
| 222 | + from os.path import join, exists |
| 223 | + framework_dirs = [ |
| 224 | + '/System/Library/Frameworks/', |
| 225 | + '/Library/Frameworks', |
| 226 | + join(os.getenv('HOME'), '/Library/Frameworks') |
| 227 | + ] |
| 228 | + |
| 229 | + # Find the directory that contains the Tcl.framwork and Tk.framework |
| 230 | + # bundles. |
| 231 | + # XXX distutils should support -F! |
| 232 | + for F in framework_dirs: |
| 233 | + # both Tcl.framework and Tk.framework should be present |
| 234 | + for fw in 'Tcl', 'Tk': |
| 235 | + if not exists(join(F, fw + '.framework')): |
| 236 | + break |
| 237 | + else: |
| 238 | + # ok, F is now directory with both frameworks. Continure |
| 239 | + # building |
| 240 | + tk_framework_found = 1 |
| 241 | + break |
| 242 | + if tk_framework_found: |
| 243 | + # For 8.4a2, we must add -I options that point inside the Tcl and Tk |
| 244 | + # frameworks. In later release we should hopefully be able to pass |
| 245 | + # the -F option to gcc, which specifies a framework lookup path. |
| 246 | + # |
| 247 | + tk_include_dirs = [ |
| 248 | + join(F, fw + '.framework', H) |
| 249 | + for fw in 'Tcl', 'Tk' |
| 250 | + for H in 'Headers', 'Versions/Current/PrivateHeaders' |
| 251 | + ] |
| 252 | + |
| 253 | + # For 8.4a2, the X11 headers are not included. Rather than include a |
| 254 | + # complicated search, this is a hard-coded path. It could bail out |
| 255 | + # if X11 libs are not found... |
| 256 | + # tk_include_dirs.append('/usr/X11R6/include') |
| 257 | + frameworks = ['-framework', 'Tcl', '-framework', 'Tk'] |
| 258 | + module.include_dirs.extend(tk_include_dirs) |
| 259 | + module.extra_link_args.extend(frameworks) |
| 260 | + module.extra_compile_args.extend(frameworks) |
| 261 | + return |
| 262 | + |
| 263 | + # you're still here? ok we'll try it this way |
| 264 | + o = find_tcltk() |
| 265 | + module.include_dirs.extend([o.tcl_inc, o.tk_inc]) |
| 266 | + module.library_dirs.extend([o.tcl_lib, o.tk_lib]) |
| 267 | + module.libraries.extend(['tk'+o.tkv, 'tcl'+o.tkv]) |
224 | 268 |
|
225 | 269 |
|
226 | 270 | def add_windowing_flags(module): |
|
0 commit comments