[CalendarServer-changes] [12967] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Tue Mar 18 18:26:08 PDT 2014


Revision: 12967
          http://trac.calendarserver.org//changeset/12967
Author:   wsanchez at apple.com
Date:     2014-03-18 18:26:08 -0700 (Tue, 18 Mar 2014)
Log Message:
-----------
Start work on caching depenencies for B&I.

Modified Paths:
--------------
    CalendarServer/trunk/bin/_build.sh

Added Paths:
-----------
    CalendarServer/trunk/support/_cache_deps

Modified: CalendarServer/trunk/bin/_build.sh
===================================================================
--- CalendarServer/trunk/bin/_build.sh	2014-03-19 01:04:41 UTC (rev 12966)
+++ CalendarServer/trunk/bin/_build.sh	2014-03-19 01:26:08 UTC (rev 12967)
@@ -579,6 +579,16 @@
   export PYTHON="${python}";
   export PYTHONPATH="${wd}:${PYTHONPATH:-}";
 
+  # Work around a change in Xcode tools that breaks Python modules in OS X
+  # 10.9.2 and prior due to a hard error if the -mno-fused-madd is used, as
+  # it was in the system Python, and is therefore passed along by disutils.
+  if [ "$(uname -s)" == "Darwin" ]; then
+    if "${python}" -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_var("CFLAGS")' \
+       | grep -e -mno-fused-madd > /dev/null; then
+      export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future";
+    fi;
+  fi;
+
   if ! "${do_setup}"; then return 0; fi;
 
   # Set up virtual environment
@@ -594,14 +604,10 @@
 
   "${python}" "${wd}/setup.py" check > /dev/null;
 
-  # Work around a change in Xcode tools that breaks Python modules in OS X
-  # 10.9.2 and prior due to a hard error if the -mno-fused-madd is used, as
-  # it was in the system Python, and is therefore passed along by disutils.
-  if [ "$(uname -s)" == "Darwin" ]; then
-    if "${python}" -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_var("CFLAGS")' \
-       | grep -e -mno-fused-madd > /dev/null; then
-      export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future";
-    fi;
+  if [ -d "${wd}/requirements/cache" ]; then
+    pip_install="pip_install_from_cache";
+  else
+    pip_install="pip_install";
   fi;
 
   for requirements in "${wd}/requirements/py_"*".txt"; do
@@ -609,11 +615,7 @@
     ruler "Preparing Python requirements: ${requirements}";
     echo "";
 
-    if ! "${python}" -m pip install               \
-        --requirement "${requirements}"           \
-        --download-cache "${dev_home}/pip_cache"  \
-        --log "${dev_home}/pip.log"               \
-    ; then
+    if ! "${pip_install}" "${requirements}"; then
       err=$?;
       echo "Unable to set up Python requirements: ${requirements}";
       if [ "${requirements#${wd}/requirements/py_opt_}" != "${requirements}" ]; then
@@ -631,7 +633,27 @@
 }
 
 
+pip_install_from_cache () {
+  local requirements="$1"; shift;
 
+  "${python}" -m pip install                 \
+    --requirement="${requirements}"          \
+    --find-links "${wd}/requirements/cache"  \
+    --no-index                               \
+    --log="${dev_home}/pip.log";
+}
+
+
+pip_install () {
+  local requirements="$1"; shift;
+
+  "${python}" -m pip install                  \
+    --requirement="${requirements}"           \
+    --download-cache="${dev_home}/pip_cache"  \
+    --log="${dev_home}/pip.log";
+}
+
+
 #
 # Set up for development
 #

Added: CalendarServer/trunk/support/_cache_deps
===================================================================
--- CalendarServer/trunk/support/_cache_deps	                        (rev 0)
+++ CalendarServer/trunk/support/_cache_deps	2014-03-19 01:26:08 UTC (rev 12967)
@@ -0,0 +1,45 @@
+#!/bin/sh
+# -*- sh-basic-offset: 2 -*-
+
+##
+# Copyright (c) 2005-2014 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+set -e
+set -u
+
+wd="$(cd "$(dirname "$0")/.." && pwd)";
+
+. "${wd}/bin/_build.sh";
+
+do_setup="false";
+
+develop > /dev/null;
+
+mkdir "${wd}/requirements/cache";
+
+find "${wd}/requirements" -type f -name "py_*.txt" | while read requirements; do
+  case "${requirements}" in
+    */py_opt_OpenDirectory.txt) download=false; ;;
+    */py_opt_Oracle.txt) download=false; ;;
+    *) download=true; ;;
+  esac;
+
+  if "${download}"; then
+    echo "Downloading requirements from: ${requirements}";
+
+    "${python}" -m pip install --download "${wd}/requirements/cache" --requirement "${requirements}";
+  fi;
+done;


Property changes on: CalendarServer/trunk/support/_cache_deps
___________________________________________________________________
Added: svn:executable
   + *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140318/27d9bba6/attachment-0001.html>


More information about the calendarserver-changes mailing list