bsddb185 module changes checked in

Nick Vargish nav at adams.patriot.net
Wed May 7 11:21:44 EDT 2003


Skip Montanaro <skip at pobox.com> writes:

> I suspect others can clean it up later during the beta cycle.  The
> current detection code in setup.py should work for Nick on OSF/1 and
> for platforms which don't require a separate db library.

Hey, I see a ternary-like construct in there... :^) It won't quite
work since sys.platform for OSF/1 reports osf1V5 or whatever depending
on the version. Here's a diff to the setup.py as found in CVS that
should take care of things:

=============== CUT HERE ====================

*** setup.py    Wed May  7 10:39:44 2003
--- setup.py.new        Wed May  7 10:41:12 2003
***************
*** 243,248 ****
--- 243,250 ----
              platform = 'darwin'
          elif platform[:6] == 'atheos':
              platform = 'atheos'
+         elif platform[:4] == 'osf1':
+             platform = 'osf1'

          return platform

=============== CUT HERE ====================

The bsddb185.so module is built and works when imported explicitly as
bsddb185. 

However, anydbm seems to be falling back to using dbm rather than
bsddb185 when creating new databases. It does use bsddb185 when
opening existing hash files. Here's a little interactive exploration
to show what I mean:

nvargish at frwebgate2$ /usr/local/python-2.3b1/bin/python        
Python 2.3b1 (#1, May  7 2003, 10:53:10) [C] on osf1V5
Type "help", "copyright", "credits" or "license" for more information.
>>> import anydbm
>>> fdb = anydbm.open('foo.dbm', 'n')
>>> fdb
<dbm.dbm object at 0x1400ad050>
>>> import bsddb185 as bsddb
>>> fdb2 = bsddb.open('foo2.dbm', 'n')
>>> fdb2
<bsddb.bsddb object at 0x14009f058>
>>> import whichdb
>>> whichdb.whichdb('foo.dbm')
'dbm'
>>> fdb2['a'] = 'test a'
>>> fdb2.close()
>>> fdb.close()
>>> whichdb.whichdb('foo2.dbm')
'bsddb185'
>>> fdb3 = anydbm.open('foo2.dbm')
>>> fdb3
<bsddb.bsddb object at 0x14009f288>
>>> fdb3['a']
'test a'
>>> fdb3.close()
>>> ^D

Is that the expected behavior?  I can certainly survive if it is, I
may just have to do a little import dance when the databases need to
be created.

Nick

p.s I'm more conservative with the ternary-analogue, and probably would
have gone for:

                libraries = None
                if platform in ['osf1']:
                    libraries = ['db']

But they seem functionally equivalent.

-- 
# sigmask.py  ||  version 0.2  ||  2003-01-07  ||  Feed this to your Python.
print reduce(lambda x,y:x+chr(ord(y)-1),'Ojdl!Wbshjti!=obwAqbusjpu/ofu?','')




More information about the Python-list mailing list