python: fix installer

This commit is contained in:
Nguyen Anh Quynh 2015-02-03 11:45:20 +08:00
parent 0498085a1c
commit 35ceed7b8f
3 changed files with 43 additions and 20 deletions

View File

@ -44,34 +44,39 @@ install_cython:
mv $(OBJDIR)/build/lib/python/capstone/* capstone mv $(OBJDIR)/build/lib/python/capstone/* capstone
cd $(OBJDIR) && python setup_cython.py build -b ./tmp install cd $(OBJDIR) && python setup_cython.py build -b ./tmp install
# build Python package with source # build & upload PyPi package with source code of the core
sdist: sdist:
rm -rf src/
rm -rf prebuilt/win64/*.dll rm -rf prebuilt/win64/*.dll
rm -rf prebuilt/win32/*.dll rm -rf prebuilt/win32/*.dll
rm -rf README cp README.pypi-src README
mv README.pypi-src README cp PKG-INFO.src PKG-INFO
python setup.py sdist python setup.py sdist register upload
# build Python package with source # build & upload PyPi package with source code of the core
sdist3: sdist3:
rm -rf src/
rm -rf prebuilt/win64/*.dll rm -rf prebuilt/win64/*.dll
rm -rf prebuilt/win32/*.dll rm -rf prebuilt/win32/*.dll
rm -rf README cp README.pypi-src README
mv README.pypi-src README cp PKG-INFO.src PKG-INFO
python3 setup.py sdist python3 setup.py sdist register upload
# build Python package with prebuilt core # build & upload PyPi package with prebuilt core
sdist_bin: # NOTE: be sure to have precompiled core under prebuilt/win*/ beforehand
sdist_win:
rm -rf src/ rm -rf src/
rm -rf README cp README.pypi-win README
mv README.pypi-win README cp PKG-INFO.win PKG-INFO
python setup.py sdist python setup.py sdist register upload
# build Python package with prebuilt core # build & upload PyPi package with prebuilt core
sdist3_bin: # NOTE: be sure to have precompiled core under prebuilt/win*/ beforehand
sdist3_win:
rm -rf src/ rm -rf src/
mv README.pypi-win README cp README.pypi-win README
python3 setup.py sdist cp PKG-INFO.win PKG-INFO
python3 setup.py sdist register upload
clean: clean:
rm -rf $(OBJDIR) src/ README rm -rf $(OBJDIR) src/ README

View File

@ -0,0 +1,14 @@
Metadata-Version: 1.3
Name: capstone
Version: 3.0.1
Author: Nguyen Anh Quynh
Author-email: aquynh at gmail com
Maintainer: Nguyen Anh Quynh
Maintainer-email: aquynh at gmail com
Home-page: http://www.capstone-engine.org
Download-url: www.capstone-engine.org
Summary: Capstone disassembly framework
License: BSD
Description: Capstone is a lightweight multi-platform, multi-architecture disassembly framework with some advanced features. Further information is available at the homepage http://www.capstone-engine.org
Keywords: disassembly reverse binary arm arm64 aarch64 powerpc ppc mips x86 x86_64 sparc systemz xcore
Platform: Windows MacOSX Linux NetBSD FreeBSD OpenBSD Solaris Android iOS

View File

@ -17,7 +17,11 @@ from distutils.sysconfig import get_python_lib
PATH_LIB64 = "prebuilt/win64/capstone.dll" PATH_LIB64 = "prebuilt/win64/capstone.dll"
PATH_LIB32 = "prebuilt/win32/capstone.dll" PATH_LIB32 = "prebuilt/win32/capstone.dll"
# platform description refers at https://docs.python.org/2/library/sys.html#sys.platform # package name can be 'capstone' or 'capstone-win'
PKG_NAME = 'capstone'
if os.path.exists(PATH_LIB64) and os.path.exists(PATH_LIB32):
PKG_NAME = 'capstone-win'
SYSTEM = sys.platform SYSTEM = sys.platform
VERSION = '4.0' VERSION = '4.0'
@ -68,7 +72,7 @@ class custom_sdist(sdist):
def run(self): def run(self):
# if prebuilt libraries are existent, then do not copy source # if prebuilt libraries are existent, then do not copy source
if os.path.exists(PATH_LIB64) and os.path.exists(PATH_LIB32): if os.path.exists(PATH_LIB64) and os.path.exists(PATH_LIB32):
return return sdist.run(self)
copy_sources() copy_sources()
return sdist.run(self) return sdist.run(self)
@ -146,7 +150,7 @@ def dummy_src():
setup( setup(
provides=['capstone'], provides=['capstone'],
packages=['capstone'], packages=['capstone'],
name='capstone', name=PKG_NAME,
version=VERSION, version=VERSION,
author='Nguyen Anh Quynh', author='Nguyen Anh Quynh',
author_email='aquynh@gmail.com', author_email='aquynh@gmail.com',