]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport Patch #850977: Detect Tk on FreeBSD and OpenBSD.
authorKurt B. Kaiser <kbk@shore.net>
Mon, 17 Jan 2005 21:07:52 +0000 (21:07 +0000)
committerKurt B. Kaiser <kbk@shore.net>
Mon, 17 Jan 2005 21:07:52 +0000 (21:07 +0000)
Misc/NEWS
setup.py

index 9823f04eb80c3edc62f3e6eac10c620b48817397..542e954a5f0547d533a21e058ab6c8c0489010f8 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -7,7 +7,7 @@ Python News
 What's New in Python 2.3.5?
 ===========================
 
-*Release date: xx-xxx-2004*
+*Release date: xx-xxx-2005*
 
 Core and builtins
 -----------------
@@ -162,6 +162,8 @@ Macintosh
 Build
 -----
 
+- Patch #850977: Detect Tk on FreeBSD and OpenBSD.
+
 - Bug #1034496: Use -h instead of -soname for Solaris compatibility.
 
 - Patch #973204: Use -rpath instead of -R for runtime_library_dirs
index d2cae8ae7f2f68f1c556b7c507bee16cd21a7794..028ed1cf7622cc7a06fe4cc08d4a98008fc97483 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -960,17 +960,25 @@ class PyBuildExt(build_ext):
 
         # Now check for the header files
         if tklib and tcllib:
-            # Check for the include files on Debian, where
+            # Check for the include files on Debian and {Free,Open}BSD, where
             # they're put in /usr/include/{tcl,tk}X.Y
-            debian_tcl_include = [ '/usr/include/tcl' + version ]
-            debian_tk_include =  [ '/usr/include/tk'  + version ] + \
-                                 debian_tcl_include
-            tcl_includes = find_file('tcl.h', inc_dirs, debian_tcl_include)
-            tk_includes = find_file('tk.h', inc_dirs, debian_tk_include)
+            dotversion = version
+            if '.' not in dotversion and "bsd" in sys.platform.lower():
+                # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a,
+                # but the include subdirs are named like .../include/tcl8.3.
+                dotversion = dotversion[:-1] + '.' + dotversion[-1]
+            tcl_include_sub = []
+            tk_include_sub = []
+            for dir in inc_dirs:
+                tcl_include_sub += [dir + os.sep + "tcl" + dotversion]
+                tk_include_sub += [dir + os.sep + "tk" + dotversion]
+            tk_include_sub += tcl_include_sub
+            tcl_includes = find_file('tcl.h', inc_dirs, tcl_include_sub)
+            tk_includes = find_file('tk.h', inc_dirs, tk_include_sub)
 
         if (tcllib is None or tklib is None or
             tcl_includes is None or tk_includes is None):
-            # Something's missing, so give up
+            self.announce("INFO: Can't locate Tcl/Tk libs and/or headers", 2)
             return
 
         # OK... everything seems to be present for Tcl/Tk.