[PATCH] Support python in other than /usr/bin/python

Ed Maste emaste at freebsd.org
Thu May 21 08:41:26 PDT 2015


Hi samsonov,

Use /usr/local/bin/python if it exists and /usr/bin/python does not.  If that also does not exist, try python from $PATH.

This allows check_lint.sh to work on FreeBSD without the need to manually specify PYTHON_EXECUTABLE.

http://reviews.llvm.org/D9914

Files:
  lib/sanitizer_common/scripts/check_lint.sh

Index: lib/sanitizer_common/scripts/check_lint.sh
===================================================================
--- lib/sanitizer_common/scripts/check_lint.sh
+++ lib/sanitizer_common/scripts/check_lint.sh
@@ -10,6 +10,17 @@
 # python tools setup
 CPPLINT=${SCRIPT_DIR}/cpplint.py
 LITLINT=${SCRIPT_DIR}/litlint.py
+if [ -z "${PYTHON_EXECUTABLE}" ] && [ ! -x /usr/bin/python ]; then
+  if [ -x /usr/local/bin/python ]; then
+    PYTHON_EXECUTABLE=/usr/local/bin/python
+  elif PYTHON_EXECUTABLE=$(which python 2>/dev/null); then
+    echo "Using python executable $PYTHON_EXECUTABLE from \$PATH."
+  else
+    echo "Python not found in /usr/bin/python, /usr/local/bin/python, or \$PATH."
+    echo "Set the PYTHON_EXECUTABLE environment variable to the path to your python."
+    exit 1
+  fi
+fi
 if [ "${PYTHON_EXECUTABLE}" != "" ]; then
   CPPLINT="${PYTHON_EXECUTABLE} ${CPPLINT}"
   LITLINT="${PYTHON_EXECUTABLE} ${LITLINT}"

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9914.26248.patch
Type: text/x-patch
Size: 936 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150521/80603f58/attachment.bin>


More information about the llvm-commits mailing list