[CalendarServer-changes] [14979] CalendarServer/trunk/support
source_changes at macosforge.org
source_changes at macosforge.org
Mon Jul 20 12:08:02 PDT 2015
Revision: 14979
http://trac.calendarserver.org//changeset/14979
Author: cdaboo at apple.com
Date: 2015-07-20 12:08:02 -0700 (Mon, 20 Jul 2015)
Log Message:
-----------
Fix issue with virtualenv being locked to specific system Python versions.
Modified Paths:
--------------
CalendarServer/trunk/support/Apple.make
Added Paths:
-----------
CalendarServer/trunk/support/undo-virtualenv
Modified: CalendarServer/trunk/support/Apple.make
===================================================================
--- CalendarServer/trunk/support/Apple.make 2015-07-17 01:25:23 UTC (rev 14978)
+++ CalendarServer/trunk/support/Apple.make 2015-07-20 19:08:02 UTC (rev 14979)
@@ -85,18 +85,15 @@
@#
@# Set up a virtual environment in Server.app; we'll install into that.
@# That creates a self-contained environment which has specific version of
- @# (almost) all of our dependancies in it.
+ @# (almost) all of our dependencies in it.
@# Use --system-site-packages so that we use the packages provided by the
@# OS, such as PyObjC.
- @# Use --always-copy because we want copies of, not links to, the system
- @# python, as Server.app is an independent product train.
@#
@echo "Creating virtual environment...";
$(_v) $(RMDIR) "$(DSTROOT)$(CS_VIRTUALENV)";
$(_v) PYTHONPATH="$(BuildDirectory)/pytools/lib" \
"$(PYTHON)" -m virtualenv \
--system-site-packages \
- --always-copy \
"$(DSTROOT)$(CS_VIRTUALENV)";
@#
@# Use the pip in the virtual environment (as opposed to pip in the OS) to
@@ -131,7 +128,7 @@
--ignore-installed \
Twisted;
- @echo "Installing CalendarServer and remaining dependancies...";
+ @echo "Installing CalendarServer and remaining dependencies...";
$(_v) $(Environment) \
"$(DSTROOT)$(CS_VIRTUALENV)/bin/pip" install \
--disable-pip-version-check \
@@ -153,14 +150,16 @@
$(_v) perl -i -pe "s|#PATH|export PYTHON=$(CS_VIRTUALENV)/bin/python;|" "$(DSTROOT)$(CS_VIRTUALENV)/bin/caldavd";
@echo "Stripping binaries...";
$(_v) find "$(DSTROOT)$(CS_VIRTUALENV)" -type f -name "*.so" -print0 | xargs -0 $(STRIP) -Sx;
- @echo "Updating install location of Python library...";
- $(_v) find "$(DSTROOT)$(CS_VIRTUALENV)/bin" -type f -name "python*" -print0 | \
- xargs -0 -n 1 install_name_tool -change "@executable_path/../.Python" "$(CS_VIRTUALENV)/.Python";
- $(_v) install_name_tool -id "$(CS_VIRTUALENV)/.Python" "$(DSTROOT)$(CS_VIRTUALENV)/.Python";
@echo "Putting comments into empty files...";
$(_v) find "$(DSTROOT)$(CS_VIRTUALENV)" -type f -size 0 -name "*.py" -exec sh -c 'printf "# empty\n" > {}' ";";
$(_v) find "$(DSTROOT)$(CS_VIRTUALENV)" -type f -size 0 -name "*.h" -exec sh -c 'printf "/* empty */\n" > {}' ";";
+ @#
+ @# Undo virtualenv so we use the system Python
+ @#
+ @echo "Undo virtualenv...";
+ $(_v) "$(Sources)/support/undo-virtualenv" "$(DSTROOT)$(CS_VIRTUALENV)"
+
install:: install-config
install-config::
$(_v) $(INSTALL_DIRECTORY) "$(DSTROOT)$(SIPP)$(ETCDIR)$(CALDAVDSUBDIR)";
Added: CalendarServer/trunk/support/undo-virtualenv
===================================================================
--- CalendarServer/trunk/support/undo-virtualenv (rev 0)
+++ CalendarServer/trunk/support/undo-virtualenv 2015-07-20 19:08:02 UTC (rev 14979)
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+set -e
+set -u
+
+base="${1}";
+
+# Remove python binaries
+rm -f "${base}/bin/python";
+rm -f "${base}/bin/python2";
+rm -f "${base}/bin/python2.7";
+
+# Remove unused virtualenv files
+rm -f "${base}/lib/python2.7/"*.py*;
+rm -f "${base}/lib/python2.7/config";
+rm -rf "${base}/lib/python2.7/distutils";
+rm -f "${base}/lib/python2.7/encodings";
+rm -f "${base}/lib/python2.7/lib-dynload";
+rm -f "${base}/lib/python2.7/orig-prefix.txt";
+
+# New python shim that sets up paths and runs the system python
+cat - > "${base}/bin/python" <<EOF
+#!/bin/sh
+
+export PATH=/Applications/Server.app/Contents/ServerRoot/Library/CalendarServer/bin:\${PATH};
+export PYTHONPATH=/Applications/Server.app/Contents/ServerRoot/Library/CalendarServer/lib/python2.7/site-packages;
+
+exec /usr/bin/python "\${@}";
+EOF
+
+chmod a+x "${base}/bin/python";
+ln -s "${base}/bin/python" "${base}/bin/python2";
+ln -s "${base}/bin/python" "${base}/bin/python2.7";
Property changes on: CalendarServer/trunk/support/undo-virtualenv
___________________________________________________________________
Added: svn:executable
+ *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150720/45057938/attachment.html>
More information about the calendarserver-changes
mailing list