I followed the documentation at this URL for building python-sybase with FreeTDS:
http://python-sybase.sourceforge.net/sybase/node5.html
These instructions did not work as-is. The following is an explanation of what I did to get it to work:
The system constraints I dealt with:
CentOS 5.6 (64-bit: x86-64)
Python 2.7.2 (64-bit)
FreeTDS 0.91 (64-bit)
python-sybase 0.39
Here is what worked:
1. patch setup.py to respect 64-bit:
@@ -120,7 +120,10 @@
sys.exit(1)
syb_incdir = os.path.join(sybase, 'include')
-syb_libdir = os.path.join(sybase, 'lib')
+if have64bit:
+ syb_libdir = os.path.join(sybase, 'lib64')
+else:
+ syb_libdir = os.path.join(sybase, 'lib')
for dir in (syb_incdir, syb_libdir):
if not os.access(dir, os.F_OK):
2. build the extension with the FreeTDS libs:
export SYBASE=/usr
export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH
python setup.py build_ext -D WANT_THREADS,HAVE_FREETDS -U WANT_BULKCOPY -l ct,sybdb
python setup.py install
Also, due to an open bug in distutils (see http://bugs.python.org/issue1326113\), I had to patch lib/python2.7/distutils/command/build_ext.py to get the -l flag to handle multiple libraries:
@@ -160,8 +160,7 @@
if plat_py_include != py_include:
self.include_dirs.append(plat_py_include)
- if isinstance(self.libraries, str):
- self.libraries = [self.libraries]
+ self.ensure_string_list('libraries')