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 # check if a prebuilt library exists
# if so, use it instead of building # if so, use it instead of building
if os.path.exists(os.path.join(ROOT_DIR, 'prebuilt', LIBRARY_FILE)): 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 return
# otherwise, build!! # otherwise, build!!

View file

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