Modify tabix.py to look for libraries built with libtool.
authorDiane Trout <diane@caltech.edu>
Sat, 22 Dec 2012 01:09:54 +0000 (17:09 -0800)
committerDiane Trout <diane@caltech.edu>
Sat, 22 Dec 2012 01:09:54 +0000 (17:09 -0800)
debian/patches/use-libtool

index eeed40f2b002a48900181c1f927b2fea3de1b6d5..58cde517e8e4c6a1c48c5c188399642abe726b7f 100644 (file)
@@ -1,7 +1,7 @@
 Index: tabix/Makefile
 ===================================================================
---- tabix.orig/Makefile        2012-12-21 16:05:38.710131804 -0800
-+++ tabix/Makefile     2012-12-21 16:08:18.234126173 -0800
+--- tabix.orig/Makefile        2012-12-21 16:59:37.846017464 -0800
++++ tabix/Makefile     2012-12-21 16:59:57.586016768 -0800
 @@ -1,47 +1,47 @@
 -CC=                   gcc
 -CFLAGS=               -g -Wall -O2 -fPIC #-m64 #-arch ppc
@@ -96,3 +96,35 @@ Index: tabix/Makefile
 -clean:cleanlocal-recur
 +clean:
 +      $(LIBTOOL) --mode=clean rm -fr gmon.out $(LOBJS) $(AOBJS) $(BOBJS) a.out *.dSYM $(PROG) *~ tabix.aux tabix.log tabix.pdf *.class libtabix.la
+Index: tabix/tabix.py
+===================================================================
+--- tabix.orig/tabix.py        2012-12-21 16:59:37.846017464 -0800
++++ tabix/tabix.py     2012-12-21 17:06:31.342002867 -0800
+@@ -8,20 +8,22 @@
+ from ctypes.util import find_library
+ import glob, platform
+-def load_shared_library(lib, _path='.', ver='*'):
++def load_shared_library(lib, _path=None, ver='*'):
+     """Search for and load the tabix library. The
+     expectation is that the library is located in
+     the current directory (ie. "./")
+     """
+     # find from the system path
+     path = find_library(lib)
+-    if (path == None): # if fail, search in the custom directory
++    if path is None: # if fail, search in the custom directory
++        _path = list(_path) if _path is not None else ['.', '.libs']
+         s = platform.system()
+         if (s == 'Darwin'): suf = ver+'.dylib'
+         elif (s == 'Linux'): suf = '.so'+ver
+-        candidates = glob.glob(_path+'/lib'+lib+suf);
+-        if (len(candidates) == 1): path = candidates[0]
+-        else: return None
++        for _p in _path:
++            candidates = glob.glob(_p+'/lib'+lib+suf);
++            if (len(candidates) > 0): path = candidates[0]
++        if path is None: return None
+     cdll.LoadLibrary(path)
+     return CDLL(path)