mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-28 07:50:39 +00:00
Python setup: Clean up some merge failures, adapt for changes on next branch
This commit is contained in:
parent
5acdd97ca2
commit
b2504b963e
@ -62,6 +62,7 @@ clean:
|
||||
rm -f pyx/*.c pyx/__init__.py
|
||||
for f in capstone/*.py; do rm -f pyx/$$(basename $$f)x; done
|
||||
rm -f MANIFEST
|
||||
rm -f *.pyc capstone/*.pyc
|
||||
|
||||
|
||||
TESTS = test_basic.py test_detail.py test_arm.py test_arm64.py test_m68k.py test_mips.py
|
||||
|
@ -256,10 +256,10 @@ def _load_lib(path):
|
||||
try:
|
||||
return ctypes.cdll.LoadLibrary(lib_file)
|
||||
except OSError:
|
||||
# if we're on linux, try again with .so.3 extension
|
||||
# if we're on linux, try again with .so.4 extension
|
||||
if lib_file.endswith('.so'):
|
||||
try:
|
||||
return ctypes.cdll.LoadLibrary(lib_file + '.3')
|
||||
return ctypes.cdll.LoadLibrary(lib_file + '.4')
|
||||
except OSError:
|
||||
return None
|
||||
return None
|
||||
|
@ -85,7 +85,7 @@ def build_libraries():
|
||||
os.mkdir(LIBS_DIR)
|
||||
|
||||
# copy public headers
|
||||
shutil.copytree(os.path.join(BUILD_DIR, 'include'), os.path.join(HEADERS_DIR, 'capstone'))
|
||||
shutil.copytree(os.path.join(BUILD_DIR, 'include', 'capstone'), os.path.join(HEADERS_DIR, 'capstone'))
|
||||
|
||||
os.chdir(BUILD_DIR)
|
||||
|
||||
@ -102,7 +102,10 @@ def build_libraries():
|
||||
else: # Unix incl. cygwin
|
||||
os.system("CAPSTONE_BUILD_CORE_ONLY=yes bash ./make.sh")
|
||||
|
||||
shutil.copy(LIBRARY_FILE, LIBS_DIR)
|
||||
if LIBRARY_FILE.endswith('.so'):
|
||||
shutil.copy(LIBRARY_FILE + '.4', os.path.join(LIBS_DIR, LIBRARY_FILE))
|
||||
else:
|
||||
shutil.copy(LIBRARY_FILE, LIBS_DIR)
|
||||
if STATIC_LIBRARY_FILE: shutil.copy(STATIC_LIBRARY_FILE, LIBS_DIR)
|
||||
os.chdir(cwd)
|
||||
|
||||
|
@ -1,12 +1,15 @@
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
from distutils import log
|
||||
from distutils.core import setup
|
||||
from distutils.extension import Extension
|
||||
from distutils.command.build import build
|
||||
from Cython.Distutils import build_ext
|
||||
|
||||
VERSION = '4.0'
|
||||
|
||||
SYSTEM = sys.platform
|
||||
VERSION = '3.0.4'
|
||||
|
||||
# adapted from commit e504b81 of Nguyen Tan Cong
|
||||
# Reference: https://docs.python.org/2/library/platform.html#cross-platform
|
||||
@ -34,7 +37,7 @@ else:
|
||||
compile_args = ['-O3', '-fomit-frame-pointer', '-I' + HEADERS_DIR]
|
||||
link_args = ['-L' + LIBS_DIR]
|
||||
|
||||
ext_module_names = ['arm', 'arm_const', 'arm64', 'arm64_const', 'mips', 'mips_const', 'ppc', 'ppc_const', 'x86', 'x86_const', 'sparc', 'sparc_const', 'systemz', 'sysz_const', 'xcore', 'xcore_const']
|
||||
ext_module_names = ['arm', 'arm_const', 'arm64', 'arm64_const', 'm68k', 'm68k_const', 'mips', 'mips_const', 'ppc', 'ppc_const', 'x86', 'x86_const', 'sparc', 'sparc_const', 'systemz', 'sysz_const', 'xcore', 'xcore_const']
|
||||
ext_modules = [Extension("capstone.ccapstone",
|
||||
["pyx/ccapstone.pyx"],
|
||||
libraries=["capstone"],
|
||||
@ -73,7 +76,7 @@ def build_libraries():
|
||||
os.mkdir(LIBS_DIR)
|
||||
|
||||
# copy public headers
|
||||
shutil.copytree(os.path.join(BUILD_DIR, 'include'), os.path.join(HEADERS_DIR, 'capstone'))
|
||||
shutil.copytree(os.path.join(BUILD_DIR, 'include', 'capstone'), os.path.join(HEADERS_DIR, 'capstone'))
|
||||
|
||||
os.chdir(BUILD_DIR)
|
||||
|
||||
@ -90,7 +93,10 @@ def build_libraries():
|
||||
else: # Unix incl. cygwin
|
||||
os.system("CAPSTONE_BUILD_CORE_ONLY=yes bash ./make.sh")
|
||||
|
||||
shutil.copy(LIBRARY_FILE, LIBS_DIR)
|
||||
if LIBRARY_FILE.endswith('.so'):
|
||||
shutil.copy(LIBRARY_FILE + '.4', os.path.join(LIBS_DIR, LIBRARY_FILE))
|
||||
else:
|
||||
shutil.copy(LIBRARY_FILE, LIBS_DIR)
|
||||
if STATIC_LIBRARY_FILE: shutil.copy(STATIC_LIBRARY_FILE, LIBS_DIR)
|
||||
os.chdir(cwd)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user