[python-sybase] Python sybase-0.36 module with RedHat 9

Dave Cole djc at object-craft.com.au
Tue, 16 Mar 2004 15:42:26 +1100


--=-vzKVju11h2/DCokK+KZb
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Tue, 2004-03-16 at 15:04, Brian Beaver wrote:
> Full output below, with the ldd following...thanks
> 
> # python setup.py build_ext

[snip]

> gcc -shared build/temp.linux-i686-2.2/blk.o
> build/temp.linux-i686-2.2/databuf.o build/temp.linux-i686-2.2/cmd.o
> build/temp.linux-i686-2.2/conn.o build/temp.linux-i686-2.2/ctx.o
> build/temp.linux-i686-2.2/datafmt.o build/temp.linux-i686-2.2/iodesc.o
> build/temp.linux-i686-2.2/locale.o build/temp.linux-i686-2.2/msgs.o
> build/temp.linux-i686-2.2/numeric.o build/temp.linux-i686-2.2/money.o
> build/temp.linux-i686-2.2/datetime.o build/temp.linux-i686-2.2/sybasect.o
> -L/opt/sybase-12.5/OCS/lib -o build/lib.linux-i686-2.2/sybasect.so

Just as I suspected - it is not finding the Sybase libraries.  Can you
please try the attached patch to setup.py?

- Dave

-- 
http://www.object-craft.com.au

--=-vzKVju11h2/DCokK+KZb
Content-Disposition: attachment; filename=setup.py-patch
Content-Type: text/x-patch; name=setup.py-patch; charset=
Content-Transfer-Encoding: 7bit

Index: setup.py
===================================================================
RCS file: /usr/local/cvsroot/object-craft/sybase/setup.py,v
retrieving revision 1.50
diff -u -r1.50 setup.py
--- setup.py	24 Nov 2003 23:58:35 -0000	1.50
+++ setup.py	16 Mar 2004 04:37:57 -0000
@@ -24,12 +24,17 @@
     if re.search(r'CS_PUBLIC %s' % func, text):
         return 1
 
+sybase = None
+if os.environ.has_key('SYBASE'):
+    sybase = os.environ['SYBASE']
+    if os.environ.has_key('SYBASE_OCS'):
+        ocs = os.environ['SYBASE_OCS']
+        sybase = os.path.join(sybase, ocs)
+
 if os.name == 'posix':                  # unix
     # Most people will define the location of their Sybase
     # installation in their environment.
-    if os.environ.has_key('SYBASE'):
-        sybase = os.environ['SYBASE']
-    else:
+    if sybase is None:
         # Not in environment - assume /opt/sybase
         sybase = '/opt/sybase'
         if not os.access(sybase, os.F_OK):
@@ -52,9 +57,7 @@
 
 elif os.name == 'nt':                   # win32
     # Not sure how the installation location is specified under NT
-    if os.environ.has_key('SYBASE'):
-        sybase = os.environ['SYBASE']
-    else:
+    if sybase is None:
         sybase = r'i:\sybase\sql11.5'
         if not os.access(sybase, os.F_OK):
             sys.stderr.write(
@@ -72,10 +75,6 @@
         'figure out how to get it working for your platform, please send\n'
         'mail to djc@object-craft.com.au so you can help other people.\n')
     sys.exit(1)
-
-if os.environ.has_key('SYBASE_OCS'):
-    ocs = os.environ['SYBASE_OCS']
-    sybase = os.path.join(sybase, ocs)
 
 syb_incdir = os.path.join(sybase, 'include')
 syb_libdir = os.path.join(sybase, 'lib')

--=-vzKVju11h2/DCokK+KZb--