about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xtest/test.sh29
-rwxr-xr-xunicorn_mode/build_unicorn_support.sh17
2 files changed, 38 insertions, 8 deletions
diff --git a/test/test.sh b/test/test.sh
index cb38346d..24b80f03 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -881,8 +881,35 @@ $ECHO "$BLUE[*] Testing: unicorn_mode"
 test -d ../unicorn_mode/unicornafl && {
   test -e ../unicorn_mode/samples/simple/simple_target.bin -a -e ../unicorn_mode/samples/compcov_x64/compcov_target.bin && {
     {
+      # some python version should be available now
+      PYTHONS="`command -v python3` `command -v python` `command -v python2`"
+      EASY_INSTALL_FOUND=0
+      for PYTHON in $PYTHONS ; do
+
+        # work around for installs with executable easy_install
+        MYPYTHONPATH=`${PYTHON} -v </dev/null 2>&1 >/dev/null | sed -n -e '/^# \/.*\/os.py/{ s/.*matches //; s/os.py$//; p;}'`
+        for PATHCANDIDATE in \
+           "dist-packages/" \
+           "site-packages/"
+        do
+          if [ -e "${MYPYTHONPATH}/${PATHCANDIDATE}/easy_install.py" ] ; then
+
+            EASY_INSTALL_FOUND=1
+            PY=$PYTHON
+            break
+
+          fi
+        done
+
+      done
+      if [ "0" = $EASY_INSTALL_FOUND ]; then
+
+        echo "[-] Error: Python setup-tools not found. Run 'sudo apt-get install python-setuptools'."
+        PREREQ_NOTFOUND=1
+
+      fi
+
       # travis workaround
-      PY=`command -v python3 || command -v python`
       test "$PY" = "/opt/pyenv/shims/python" -a -x /usr/bin/python && PY=/usr/bin/python
       mkdir -p in
       echo 0 > in/in
diff --git a/unicorn_mode/build_unicorn_support.sh b/unicorn_mode/build_unicorn_support.sh
index dbe3d009..2fa3c2b2 100755
--- a/unicorn_mode/build_unicorn_support.sh
+++ b/unicorn_mode/build_unicorn_support.sh
@@ -107,11 +107,13 @@ for i in $PYTHONBIN automake autoconf git $MAKECMD $TARCMD; do
 
 done
 
-if ! command -v $EASY_INSTALL >/dev/null; then
+# some python version should be available now
+PYTHONS="`command -v python3` `command -v python` `command -v python2`"
+EASY_INSTALL_FOUND=0
+for PYTHON in $PYTHONS ; do
 
   # work around for installs with executable easy_install
-  EASY_INSTALL_FOUND=0
-  MYPYTHONPATH=`${PYTHONBIN} -v </dev/null 2>&1 >/dev/null | sed -n -e '/^# \/.*\/os.py/{ s/.*matches //; s/os.py$//; p;}'`
+  MYPYTHONPATH=`${PYTHON} -v </dev/null 2>&1 >/dev/null | sed -n -e '/^# \/.*\/os.py/{ s/.*matches //; s/os.py$//; p;}'`
   for PATHCANDIDATE in \
         "dist-packages/" \
         "site-packages/"
@@ -119,16 +121,17 @@ if ! command -v $EASY_INSTALL >/dev/null; then
     if [ -e "${MYPYTHONPATH}/${PATHCANDIDATE}/easy_install.py" ] ; then
 
       EASY_INSTALL_FOUND=1
+      PYTHONBIN=$PYTHON
       break
 
     fi
   done
-  if [ "0" = $EASY_INSTALL_FOUND ]; then
 
-    echo "[-] Error: Python setup-tools not found. Run 'sudo apt-get install python-setuptools'."
-    PREREQ_NOTFOUND=1
+done
+if [ "0" = $EASY_INSTALL_FOUND ]; then
 
-  fi
+  echo "[-] Error: Python setup-tools not found. Run 'sudo apt-get install python-setuptools'."
+  PREREQ_NOTFOUND=1
 
 fi