Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pylsd/pylsd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# @Link : https://github.com/primetang/pylsd
# @Version : 0.0.1

from lsd import lsd
from .lsd import lsd
2 changes: 1 addition & 1 deletion pylsd/pylsd/bindings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# @Link : https://github.com/primetang/pylsd
# @Version : 0.0.1

from lsd_ctypes import *
from .lsd_ctypes import *
28 changes: 4 additions & 24 deletions pylsd/pylsd/bindings/lsd_ctypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import sys
import random
import numpy as np
from pkg_resources import resource_filename
from .. import lib


def load_lsd_library():
Expand All @@ -26,30 +28,8 @@ def load_lsd_library():
elif sys.platform == 'darwin':
libnames = ['darwin/liblsd.dylib']

while root_dir != None:
for libname in libnames:
try:
lsdlib = ctypes.cdll[os.path.join(root_dir, libdir, libname)]
return lsdlib
except Exception, e:
pass
tmp = os.path.dirname(root_dir)
if tmp == root_dir:
root_dir = None
else:
root_dir = tmp

# if we didn't find the library so far, try loading without
# a full path as a last resort
for libname in libnames:
try:
# print "Trying",libname
lsdlib = ctypes.cdll[libname]
return lsdlib
except:
pass

return None
lsdlib = ctypes.cdll[os.path.join(resource_filename('pylsd', libdir), libnames[0])]
return lsdlib

lsdlib = load_lsd_library()
if lsdlib == None:
Expand Down
2 changes: 1 addition & 1 deletion pylsd/pylsd/lsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @Link : https://github.com/primetang/pylsd
# @Version : 0.0.1

from bindings.lsd_ctypes import *
from .bindings.lsd_ctypes import *


def lsd(src):
Expand Down
3 changes: 3 additions & 0 deletions pylsd/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import pylsd
from pylsd.bindings.lsd_ctypes import *
print('If this prints, there was no error in loading the library')