Allow local installations of the python bindings
These changes will allow a pypi user to locally install capstone using the --user flag. If it possible, please update the correspondent package (https://pypi.python.org/pypi/capstone/3.0.3)
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index dbd7717..d9f15e1 100755
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -6,6 +6,7 @@
import stat
import sys
+from site import getusersitepackages
from distutils import log
from distutils import dir_util
from distutils.command.build_clib import build_clib
@@ -25,7 +26,11 @@
VERSION = '3.0.3'
SYSTEM = sys.platform
-SITE_PACKAGES = os.path.join(get_python_lib(), "capstone")
+if "--user" in sys.argv:
+ SITE_PACKAGES = os.path.join(getusersitepackages(), "capstone")
+else:
+ SITE_PACKAGES = os.path.join(get_python_lib(), "capstone")
+
SETUP_DATA_FILES = []