From 4613580e078416487aed10c051f5bad5df0e0436 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Sun, 4 Dec 2016 18:18:24 +0800 Subject: [PATCH] python: typo 'prebuilt' dir --- bindings/python/setup.py | 2 +- bindings/python/unicorn/unicorn.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 8a366ac..553e7f1 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -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!! diff --git a/bindings/python/unicorn/unicorn.py b/bindings/python/unicorn/unicorn.py index 8c76163..0a05f46 100644 --- a/bindings/python/unicorn/unicorn.py +++ b/bindings/python/unicorn/unicorn.py @@ -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