Revision: 798 http://trac.macosforge.org/projects/calendarserver/changeset/798 Author: tfitz@apple.com Date: 2006-12-11 19:10:47 -0800 (Mon, 11 Dec 2006) Log Message: ----------- Caldavd now uses ./run's method of finding the right python. Modified Paths: -------------- CalendarServer/trunk/bin/caldavd Modified: CalendarServer/trunk/bin/caldavd =================================================================== --- CalendarServer/trunk/bin/caldavd 2006-12-12 01:17:45 UTC (rev 797) +++ CalendarServer/trunk/bin/caldavd 2006-12-12 03:10:47 UTC (rev 798) @@ -24,10 +24,48 @@ configfile=""; twistdpath="$(type -p twistd)"; -python="$(type -p python2.5)"; +py_version () +{ + local python="$1"; shift + echo "$("${python}" -c "from distutils.sysconfig import get_python_version; print get_python_version()")"; +} -if [ "$?" != "0" ]; then - python="$(type -p python2.4)"; +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.5" "2.4"; 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; fi; usage ()
participants (1)
-
source_changes@macosforge.org