python: typo 'prebuilt' dir

This commit is contained in:
Nguyen Anh Quynh 2016-12-04 18:18:24 +08:00
parent 236a29841d
commit 4613580e07
2 changed files with 10 additions and 6 deletions

View file

@ -123,7 +123,7 @@ def build_libraries():
# check if a prebuilt library exists
# if so, use it instead of building
if os.path.exists(os.path.join(ROOT_DIR, 'prebuilt', LIBRARY_FILE)):
shutil.copy(os.path.join(ROOT_DIR, 'prebuild', LIBRARY_FILE), LIBS_DIR)
shutil.copy(os.path.join(ROOT_DIR, 'prebuilt', LIBRARY_FILE), LIBS_DIR)
return
# otherwise, build!!

View file

@ -23,6 +23,7 @@ _lib = { 'darwin': 'libunicorn.dylib',
'linux': 'libunicorn.so',
'linux2': 'libunicorn.so' }
# Windows DLL in dependency order
_all_windows_dlls = (
"libwinpthread-1.dll",
@ -44,12 +45,12 @@ def _load_win_support(path):
lib_file = os.path.join(path, dll)
if ('/' not in path and '\\' not in path) or os.path.exists(lib_file):
try:
#print('Trying to load windows library', lib_file)
#print('Trying to load Windows library', lib_file)
ctypes.cdll.LoadLibrary(lib_file)
#print('SUCCESS')
_loaded_windows_dlls.add(dll)
except OSError:
#print('FAILURE')
except OSError as e:
#print('FAIL to load %s' %lib_file, e)
continue
# Initial attempt: load all dlls globally
@ -66,8 +67,8 @@ def _load_lib(path):
dll = ctypes.cdll.LoadLibrary(lib_file)
#print('SUCCESS')
return dll
except OSError:
#print('FAILURE')
except OSError as e:
print('FAIL to load %s' %lib_file, e)
return None
_uc = None
@ -86,6 +87,9 @@ _path_list = [pkg_resources.resource_filename(__name__, 'lib'),
"/usr/local/lib/" if sys.platform == 'darwin' else '/usr/lib64',
os.environ['PATH']]
#print(_path_list)
#print("-" * 80)
for _path in _path_list:
_uc = _load_lib(_path)
if _uc is not None: break