[CalendarServer-changes] [13377] CalendarServer/trunk/support

source_changes at macosforge.org source_changes at macosforge.org
Mon Apr 28 16:39:50 PDT 2014


Revision: 13377
          http://trac.calendarserver.org//changeset/13377
Author:   wsanchez at apple.com
Date:     2014-04-28 16:39:50 -0700 (Mon, 28 Apr 2014)
Log Message:
-----------
Build virtualenv when needed.

Modified Paths:
--------------
    CalendarServer/trunk/support/Apple.make
    CalendarServer/trunk/support/_cache_deps
    CalendarServer/trunk/support/submit

Modified: CalendarServer/trunk/support/Apple.make
===================================================================
--- CalendarServer/trunk/support/Apple.make	2014-04-28 23:39:32 UTC (rev 13376)
+++ CalendarServer/trunk/support/Apple.make	2014-04-28 23:39:50 UTC (rev 13377)
@@ -69,22 +69,43 @@
 install:: install-python
 install-python:: build
 	@#
+	@# Install virtualenv someplace and put it in PYTHONPATH in case it's not
+	@# on the host system.
+	@#
+	@echo "Installing virtualenv and friends...";
+	$(_v) mkdir -p "$(BuildDirectory)/pytools";
+	$(_v) mkdir -p "$(BuildDirectory)/pytools/lib";
+	$(_v) mkdir -p "$(BuildDirectory)/pytools/junk";
+	$(_v) for pkg in $$(find "$(Sources)/.develop/tools" -type f -name "*.tgz"); do \
+	          tar -C "$(BuildDirectory)" -xvzf "$${pkg}"; 							\
+	          cd "$(BuildDirectory)/$$(basename "$${pkg}" .tgz)" && 				\
+	              PYTHONPATH="$(BuildDirectory)/pytools/lib" 						\
+	              "$(PYTHON)" setup.py install 										\
+	                  --install-base="$(BuildDirectory)/pytools" 					\
+	                  --install-lib="$(BuildDirectory)/pytools/lib" 				\
+	                  --install-headers="$(BuildDirectory)/pytools/junk" 		\
+	                  --install-scripts="$(BuildDirectory)/pytools/junk" 			\
+	                  --install-data="$(BuildDirectory)/pytools/junk" 				\
+	                  ; 															\
+	      done;
+	@#
 	@# Set up a virtual environment in Server.app; we'll install into that.
 	@# Use --system-site-packages so that we use the packages provided by the OS.
 	@#
 	@echo "Creating virtual environment...";
 	$(_v) $(RMDIR) "$(DSTROOT)$(CS_VIRTUALENV)";
-	$(_v) $(PYTHON) -m virtualenv --system-site-packages "$(DSTROOT)$(CS_VIRTUALENV)";
+	$(_v) PYTHONPATH="$(BuildDirectory)/pytools/lib" \
+	          "$(PYTHON)" -m virtualenv --system-site-packages "$(DSTROOT)$(CS_VIRTUALENV)";
 	@#
 	@# Use the pip in the virtual environment to install.
 	@# It knows about where things go in the virtual environment.
 	@#
 	@echo "Installing Python packages...";
 	$(_v) for pkg in $$(find "$(Sources)/.develop/pip_downloads" -type f); do \
-	          $(Environment) "$(DSTROOT)$(CS_VIRTUALENV)/bin/pip" install    \
-                  --pre --allow-all-external --no-index --no-deps            \
-	              --log=/tmp/pip.log                                         \
-	              "$${pkg}";                                                 \
+	          $(Environment) "$(DSTROOT)$(CS_VIRTUALENV)/bin/pip" install     \
+                  --pre --allow-all-external --no-index --no-deps             \
+	              --log=/tmp/pip.log                                          \
+	              "$${pkg}";                                                  \
 	      done;
 	@#
 	@# Make the virtualenv relocatable

Modified: CalendarServer/trunk/support/_cache_deps
===================================================================
--- CalendarServer/trunk/support/_cache_deps	2014-04-28 23:39:32 UTC (rev 13376)
+++ CalendarServer/trunk/support/_cache_deps	2014-04-28 23:39:50 UTC (rev 13377)
@@ -31,6 +31,33 @@
 requirements="${wd}/requirements-apple.txt";
 extra_features="OpenDirectory,Postgres";
 
+
+#
+# Download virtualenv and friends.
+#
+
+mkdir -p "${wd}/.develop/tools";
+
+for pkg in \
+    pip-1.5.4 \
+    virtualenv-1.11.4 \
+    setuptools-3.4.4 \
+; do
+       name="${pkg%-*}";
+    version="${pkg#*-}";
+     first="$(echo "${name}" | sed 's|^\(.\).*$|\1|')";
+       url="https://pypi.python.org/packages/source/${first}/${name}/${pkg}.tar.gz";
+
+    ruler "Downloading ${pkg}";
+
+    curl -L -o "${wd}/.develop/tools/${pkg}.tgz" "${url}";
+done;
+
+
+#
+# Download dependencies
+#
+
 ruler "Downloading Python requirements for .[${extra_features}]";
 echo "";
 pip_download \

Modified: CalendarServer/trunk/support/submit
===================================================================
--- CalendarServer/trunk/support/submit	2014-04-28 23:39:32 UTC (rev 13376)
+++ CalendarServer/trunk/support/submit	2014-04-28 23:39:50 UTC (rev 13377)
@@ -167,7 +167,7 @@
 "${wc}/support/_cache_deps";
 
 # Clean up after _cache_deps
-find "${wc}/.develop" -depth 1 ! -name pip_downloads -print0 | xargs -0 rm -r;
+find "${wc}/.develop" -depth 1 ! '(' -name pip_downloads -o -name tools ')' -print0 | xargs -0 rm -r;
 
 if "${build}"; then
   echo "";
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140428/9cb1cac4/attachment-0001.html>


More information about the calendarserver-changes mailing list