[CalendarServer-changes] [5170] CalendarServer/trunk/support/py.sh

source_changes at macosforge.org source_changes at macosforge.org
Sun Feb 21 13:47:56 PST 2010


Revision: 5170
          http://trac.macosforge.org/projects/calendarserver/changeset/5170
Author:   wsanchez at apple.com
Date:     2010-02-21 13:47:56 -0800 (Sun, 21 Feb 2010)
Log Message:
-----------
Check module.version if module.__version__ doesn't work.

Modified Paths:
--------------
    CalendarServer/trunk/support/py.sh

Modified: CalendarServer/trunk/support/py.sh
===================================================================
--- CalendarServer/trunk/support/py.sh	2010-02-21 21:30:00 UTC (rev 5169)
+++ CalendarServer/trunk/support/py.sh	2010-02-21 21:47:56 UTC (rev 5170)
@@ -91,14 +91,27 @@
   result=$?;
 
   if [ $result == 0 ] && [ -n "${version}" ]; then
-    module_version="$(PYTHONPATH="" "${python}" -c 'print __import__("'"${module}"'").__version__')";
+    for symbol in "xxxx" "__version__" "version"; do
+      if module_version="$(
+        PYTHONPATH="" "${python}" -c \
+        'print __import__("'"${module}"'").'"$symbol"';' \
+        2>/dev/null
+      )"; then
+        break;
+      fi;
+    done;
 
+    if [ -z "${module_version}" ]; then
+      echo "Unable to determine version for ${module}.";
+      result=1;
+    fi;
+
      v="${version}";
     mv="${module_version}";
 
     no_such_luck="A system version of ${module} exists, but version is ${module_version} (< ${version}).";
 
-    while true; do
+    while [ $result != 1 ]; do
        vh="${v%%.*}"; # Get highest-order segment
       mvh="${mv%%.*}";
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100221/49bad746/attachment.html>


More information about the calendarserver-changes mailing list