diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 04983b277..b936c70db 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -28,12 +28,15 @@ SRC_DIR = os.path.join(ROOT_DIR, 'src') BUILD_DIR = SRC_DIR if os.path.exists(SRC_DIR) else os.path.join(ROOT_DIR, '../..') if SYSTEM == 'darwin': + VERSIONED_LIBRARY_FILE = "libcapstone.4.dylib" LIBRARY_FILE = "libcapstone.dylib" STATIC_LIBRARY_FILE = 'libcapstone.a' elif SYSTEM in ('win32', 'cygwin'): + VERSIONED_LIBRARY_FILE = "capstone.dll" LIBRARY_FILE = "capstone.dll" STATIC_LIBRARY_FILE = None else: + VERSIONED_LIBRARY_FILE = "libcapstone.so.4" LIBRARY_FILE = "libcapstone.so" STATIC_LIBRARY_FILE = 'libcapstone.a' @@ -102,10 +105,7 @@ def build_libraries(): else: # Unix incl. cygwin os.system("CAPSTONE_BUILD_CORE_ONLY=yes bash ./make.sh") - if LIBRARY_FILE.endswith('.so'): - shutil.copy(LIBRARY_FILE + '.4', os.path.join(LIBS_DIR, LIBRARY_FILE)) - else: - shutil.copy(LIBRARY_FILE, LIBS_DIR) + shutil.copy(VERSIONED_LIBRARY_FILE, os.path.join(LIBS_DIR, LIBRARY_FILE)) if STATIC_LIBRARY_FILE: shutil.copy(STATIC_LIBRARY_FILE, LIBS_DIR) os.chdir(cwd) diff --git a/bindings/python/setup_cython.py b/bindings/python/setup_cython.py index a81985f96..f2b73dbe6 100644 --- a/bindings/python/setup_cython.py +++ b/bindings/python/setup_cython.py @@ -25,12 +25,15 @@ PYPACKAGE_DIR = os.path.join(ROOT_DIR, 'capstone') CYPACKAGE_DIR = os.path.join(ROOT_DIR, 'pyx') if SYSTEM == 'darwin': + VERSIONED_LIBRARY_FILE = "libcapstone.4.dylib" LIBRARY_FILE = "libcapstone.dylib" STATIC_LIBRARY_FILE = 'libcapstone.a' elif SYSTEM in ('win32', 'cygwin'): + VERSIONED_LIBRARY_FILE = "capstone.dll" LIBRARY_FILE = "capstone.dll" STATIC_LIBRARY_FILE = None else: + VERSIONED_LIBRARY_FILE = "libcapstone.so.4" LIBRARY_FILE = "libcapstone.so" STATIC_LIBRARY_FILE = 'libcapstone.a' @@ -93,10 +96,7 @@ def build_libraries(): else: # Unix incl. cygwin os.system("CAPSTONE_BUILD_CORE_ONLY=yes bash ./make.sh") - if LIBRARY_FILE.endswith('.so'): - shutil.copy(LIBRARY_FILE + '.4', os.path.join(LIBS_DIR, LIBRARY_FILE)) - else: - shutil.copy(LIBRARY_FILE, LIBS_DIR) + shutil.copy(VERSIONED_LIBRARY_FILE, os.path.join(LIBS_DIR, LIBRARY_FILE)) if STATIC_LIBRARY_FILE: shutil.copy(STATIC_LIBRARY_FILE, LIBS_DIR) os.chdir(cwd)