Skip to content

Commit

Permalink
Merge pull request capstone-engine#406 from achernet/python-virtualen…
Browse files Browse the repository at this point in the history
…v-fix-master

[master] Virtualenv support for Python binding
  • Loading branch information
aquynh committed Jun 20, 2015
2 parents 36d0594 + 6f1e543 commit c31f698
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

# python
bindings/python/build/
bindings/python/capstone.egg-info/
*.pyc

# java
Expand Down
11 changes: 7 additions & 4 deletions bindings/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
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
Expand All @@ -26,10 +25,14 @@
VERSION = '3.0.3'
SYSTEM = sys.platform

# virtualenv breaks import, but get_python_lib() will work.
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")
try:
from site import getusersitepackages
SITE_PACKAGES = os.path.join(getusersitepackages(), "capstone")
except ImportError:
pass


SETUP_DATA_FILES = []
Expand Down

0 comments on commit c31f698

Please sign in to comment.