[CalendarServer-changes] [4501] CalendarServer/trunk/test

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 20 13:17:46 PDT 2009


Revision: 4501
          http://trac.macosforge.org/projects/calendarserver/changeset/4501
Author:   wsanchez at apple.com
Date:     2009-08-20 13:17:42 -0700 (Thu, 20 Aug 2009)
Log Message:
-----------
Choose PYTHON in the same manner as caldavd

Modified Paths:
--------------
    CalendarServer/trunk/test

Modified: CalendarServer/trunk/test
===================================================================
--- CalendarServer/trunk/test	2009-08-18 23:23:11 UTC (rev 4500)
+++ CalendarServer/trunk/test	2009-08-20 20:17:42 UTC (rev 4501)
@@ -24,6 +24,52 @@
 until_fail="";
   coverage="";
 
+py_version ()
+{
+  local python="$1"; shift
+  echo "$("${python}" -c "from distutils.sysconfig import get_python_version; print get_python_version()")";
+}
+
+try_python ()
+{
+  local python="$1"; shift
+
+  if [ -z "${python}" ]; then return 1; fi;
+
+  if ! type "${python}" > /dev/null 2>&1; then return 1; fi;
+  local py_version="$(py_version "${python}")";
+  if [ "${py_version/./}" -lt "24" ]; then return 1; fi;
+
+  return 0;
+}
+
+for v in "" "2.6" "2.5"; do
+  for p in                                                              \
+    "${PYTHON:=}"                                                       \
+    "python${v}"                                                        \
+    "/usr/local/bin/python${v}"                                         \
+    "/usr/local/python/bin/python${v}"                                  \
+    "/usr/local/python${v}/bin/python${v}"                              \
+    "/opt/bin/python${v}"                                               \
+    "/opt/python/bin/python${v}"                                        \
+    "/opt/python${v}/bin/python${v}"                                    \
+    "/Library/Frameworks/Python.framework/Versions/${v}/bin/python"     \
+    "/opt/local/bin/python${v}"                                         \
+    "/sw/bin/python${v}"                                                \
+    ;
+  do
+    if try_python "${p}"; then python="${p}"; break; fi;
+  done;
+  if [ -n "${python:-}" ]; then break; fi;
+done;
+
+if [ -z "${python:-}" ]; then
+  echo "No suitable python found.";
+  exit 1;
+else
+  echo "Using ${python} as Python";
+fi;
+
 usage ()
 {
   program="$(basename "$0")";
@@ -67,4 +113,4 @@
     test_modules="calendarserver twistedcaldav twext twisted";
 fi;
 
-cd "${wd}" && "${twisted}/bin/trial" ${random} ${until_fail} ${no_colour} ${coverage} ${test_modules};
+cd "${wd}" && "${python}" "${twisted}/bin/trial" ${random} ${until_fail} ${no_colour} ${coverage} ${test_modules};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090820/7736c77b/attachment.html>


More information about the calendarserver-changes mailing list