Skip to content

Commit

Permalink
Python: Clean up the capstone-windows stuff with extreme prejudice
Browse files Browse the repository at this point in the history
  • Loading branch information
rhelmot committed Oct 25, 2016
1 parent ced66e3 commit 85cd24b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 139 deletions.
49 changes: 9 additions & 40 deletions bindings/python/README.TXT → bindings/python/BUILDING.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
0. This documentation explains how to install Python binding for Capstone
from source. If you want to install it from PyPi package, see the below
docs instead:
from source. If you want to install it from PyPi package (recommended if you
are on Window), see README.txt.

- README.pypi-src: How to compile the Capstone core & install binding
at the same time from PyPi package "capstone"

- README.pypi-win: How to install binding for Windows from PyPi package
"capstone-windows". Note that this package already has prebuilt core
inside, so no compilation is needed.

1. To install pure Python binding on *nix, run the command below:
1. To install capstone and the python bindings on *nix, run the command below:

$ sudo make install

To install Python3 binding package, run the command below:
To install capstone for python 3, run the command below:
(Note: this requires python3 installed in your machine)

$ sudo make install3
Expand All @@ -22,8 +15,8 @@

$ sudo make install_cython

Note that this requires cython installed in your machine first.
To install cython, see section 3 below.
Note that this requires cython installed first. To install cython, see
below.

3. To install cython, you have to ensure that the header files
and the static library for Python are installed beforehand.
Expand All @@ -32,8 +25,8 @@

$ sudo apt-get install python-dev

Depending on if you already have pip or easy_install
installed, install cython with either:
Depending on if you already have pip or easy_install installed, install
cython with either:

$ sudo pip install cython
or:
Expand All @@ -56,8 +49,7 @@

Which should at least print version 0.19


This directory contains some test code to show how to use Capstone API.
4. This directory contains some test code to show how to use Capstone API.

- test.py
This code shows the most simple form of API where we only want to get basic
Expand All @@ -81,26 +73,3 @@ This directory contains some test code to show how to use Capstone API.
- test_<arch>.py
These code show how to access architecture-specific information for each
architecture.


2. To install Python binding on Windows:

Recommended method:

Use the Python module installer for 32/64 bit Windows from:

http://www.capstone-engine.org/download.html


Manual method:

If the module installer fails to locate your Python install, or if you have
additional Python installs (e.g. Anaconda / virtualenv), run the following
command in command prompt:

C:\> C:\location_to_python\python.exe setup.py install

Next, copy capstone.dll from the 'Core engine for Windows' package available
on the same Capstone download page and paste it in the path:

C:\location_to_python\Lib\site-packages\capstone\
4 changes: 3 additions & 1 deletion bindings/python/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
recursive-include src *
include LICENSE.TXT
include README
include README.txt
include BUILDING.txt
include Makefile
14 changes: 0 additions & 14 deletions bindings/python/PKG-INFO.src

This file was deleted.

14 changes: 0 additions & 14 deletions bindings/python/PKG-INFO.win

This file was deleted.

54 changes: 0 additions & 54 deletions bindings/python/README.pypi-src

This file was deleted.

18 changes: 11 additions & 7 deletions bindings/python/README.pypi-win → bindings/python/README.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
NOTE: This package includes prebuilt Windows core of Capstone, so no external
Capstone library is needed.
To install capstone, you should run `pip install capstone`.

On Windows, download this PyPi package and run "python setup.py install" from
"Command Prompt" is all you need to install it.
If you would like to build capstone with just the source distribution, without
pip, just run `python setup.py install` in the same folder as this text file.

If you want to compile everything from source code instead, use the
PyPi package "capstone" instead.
In order to use this source distribution, you will need an environment that can
compile C code. On linux, this is usually easy, but on windows, this involves
installing Visual Studio and using the "Developer Command Prompt" to perform the
installation. See BUILDING.txt for more information.

https://pypi.python.org/pypi/capstone
If you don't want to build your own copy of capstone, you can use a precompiled
binary distribution frm PyPI. Saying `pip install capstone` should automatically
obtain an appropriate copy for your system. If it does not, please inform
<[email protected]> - they will fix this, probably.

--------------------------------------------------------------------------------

Expand Down
3 changes: 0 additions & 3 deletions bindings/python/prebuilt/win32/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions bindings/python/prebuilt/win64/.gitignore

This file was deleted.

7 changes: 4 additions & 3 deletions bindings/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,18 @@ def run(self):
print "Proper 'develop' support unavailable."

if 'bdist_wheel' in sys.argv and '--plat-name' not in sys.argv:
sys.argv.append('--plat-name')
idx = sys.argv.index('bdist_wheel') + 1
sys.argv.insert(idx, '--plat-name')
name = get_platform()
if 'linux' in name:
# linux_* platform tags are disallowed because the python ecosystem is fubar
# linux builds should be built in the centos 5 vm for maximum compatibility
# see https://github.com/pypa/manylinux
# see also https://github.com/angr/angr-dev/blob/master/bdist.sh
sys.argv.append('manylinux1_' + platform.machine())
sys.argv.insert(idx + 1, 'manylinux1_' + platform.machine())
else:
# https://www.python.org/dev/peps/pep-0425/
sys.argv.append(name.replace('.', '_').replace('-', '_'))
sys.argv.insert(idx + 1, name.replace('.', '_').replace('-', '_'))

setup(
provides=['capstone'],
Expand Down

0 comments on commit 85cd24b

Please sign in to comment.