|
|
|
@ -11,18 +11,51 @@ import re
|
|
|
|
|
from setuptools import find_packages, setup, Command, Extension, Distribution
|
|
|
|
|
from codecs import open
|
|
|
|
|
|
|
|
|
|
VERSION = (0, 1, 0)
|
|
|
|
|
VERSION = (0, 1, 2)
|
|
|
|
|
LIBRARY_VERSION = (1, 28, 0)
|
|
|
|
|
LIBRARY_INSTRUX_SIZE = 856
|
|
|
|
|
|
|
|
|
|
packages = ['pybddisasm']
|
|
|
|
|
requires = [ "setuptools"]
|
|
|
|
|
requires = ['setuptools']
|
|
|
|
|
here = os.path.abspath(os.path.dirname(__file__))
|
|
|
|
|
|
|
|
|
|
def _check_library_version():
|
|
|
|
|
version_header = '../inc/version.h'
|
|
|
|
|
with open(version_header, 'r') as file:
|
|
|
|
|
data = file.read()
|
|
|
|
|
|
|
|
|
|
major = re.search(r'(?<=\bDISASM_VERSION_MAJOR).*(\d+)', data)
|
|
|
|
|
if not major:
|
|
|
|
|
print('error: Major version not found!')
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
minor = re.search(r'(?<=\bDISASM_VERSION_MINOR).*(\d+)', data)
|
|
|
|
|
if not minor:
|
|
|
|
|
print('error: Minor version not found!')
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
revision = re.search(r'(?<=\bDISASM_VERSION_REVISION).*(\d+)', data)
|
|
|
|
|
if not revision:
|
|
|
|
|
print('error: Revision version not found!')
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
major = major.group(0).strip()
|
|
|
|
|
minor = minor.group(0).strip()
|
|
|
|
|
revision = revision.group(0).strip()
|
|
|
|
|
|
|
|
|
|
if int(major) != LIBRARY_VERSION[0] or int(minor) != LIBRARY_VERSION[1] or int(revision) != LIBRARY_VERSION[2]:
|
|
|
|
|
print('error: The version of the library is not compatible with the pybddisasm!')
|
|
|
|
|
print('error: Library : %s.%s.%s - pybddisasm : %d.%d.%d' % (major, minor, revision, LIBRARY_VERSION[0],
|
|
|
|
|
LIBRARY_VERSION[1], LIBRARY_VERSION[2]))
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
_check_library_version()
|
|
|
|
|
|
|
|
|
|
with open('README.md', 'r', 'utf-8') as f:
|
|
|
|
|
readme = f.read()
|
|
|
|
|
|
|
|
|
|
class BinaryDistribution(Distribution):
|
|
|
|
|
"""Distribution which always forces a binary package with platform name"""
|
|
|
|
|
def has_ext_modules(foo):
|
|
|
|
|
def has_ext_modules(arg):
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
def is_pure(self):
|
|
|
|
@ -56,7 +89,7 @@ setup(
|
|
|
|
|
],
|
|
|
|
|
ext_modules = [Extension("_pybddisasm",
|
|
|
|
|
sources = ["_pybddisasm/_pybddisasm.c", "_pybddisasm/pybddisasm.c"],
|
|
|
|
|
define_macros = [('AMD64', None), ('Py_LIMITED_API', None)],
|
|
|
|
|
define_macros = [('AMD64', None), ('Py_LIMITED_API', None), ('LIBRARY_INSTRUX_SIZE', LIBRARY_INSTRUX_SIZE)],
|
|
|
|
|
include_dirs = ['../inc'],
|
|
|
|
|
libraries = ['bddisasm'],
|
|
|
|
|
library_dirs = ['/usr/local/lib', '../bin/x64/Release'],
|
|
|
|
|