[Python-checkins] python/dist/src setup.py,1.162,1.163

montanaro@users.sourceforge.net montanaro@users.sourceforge.net
Tue, 06 May 2003 13:43:37 -0700


Update of /cvsroot/python/python/dist/src
In directory sc8-pr-cvs1:/tmp/cvs-serv20887

Modified Files:
	setup.py 
Log Message:
build bsddb185 module in certain restricted circumstances


Index: setup.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/setup.py,v
retrieving revision 1.162
retrieving revision 1.163
diff -C2 -d -r1.162 -r1.163
*** setup.py	3 May 2003 08:45:51 -0000	1.162
--- setup.py	6 May 2003 20:43:34 -0000	1.163
***************
*** 288,291 ****
--- 288,296 ----
              inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
  
+         # OSF/1 has some stuff in /usr/ccs/lib (like -ldb)
+         if platform[:4] == 'osf1':
+             platform = 'osf1'
+             lib_dirs += ['/usr/ccs/lib']
+ 
          # Check for MacOS X, which doesn't need libm.a at all
          math_libs = ['m']
***************
*** 560,563 ****
--- 565,591 ----
              dblibs = []
              dblib_dir = None
+ 
+ 
+         # Look for Berkeley db 1.85.   Note that it is built as a different
+         # module name so it can be included even when later versions are
+         # available.  A very restrictive search is performed to avoid
+         # accidentally building this module with a later version of the
+         # underlying db library.  May BSD-ish Unixes incorporate db 1.85
+         # symbols into libc and place the include file in /usr/include.
+         f = "/usr/include/db.h"
+         if os.path.exists(f):
+             data = open(f).read()
+             m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data)
+             if m is not None:
+                 # bingo - old version used hash file format version 2
+                 ### XXX this should be fixed to not be platform-dependent
+                 ### but I don't have direct access to an osf1 platform and
+                 ### seemed to be muffing the search somehow
+                 libraries = platform == "osf1" and ['db'] or None
+                 if libraries is not None:
+                     exts.append(Extension('bsddb185', ['bsddbmodule.c'],
+                                           libraries=libraries))
+                 else:
+                     exts.append(Extension('bsddb185', ['bsddbmodule.c']))
  
          # The standard Unix dbm module: