<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12433] twext/trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/12433">12433</a></dd>
<dt>Author</dt> <dd>wsanchez@apple.com</dd>
<dt>Date</dt> <dd>2014-01-23 15:30:31 -0800 (Thu, 23 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Use pip in favor of setuptools.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#twexttrunkbin_buildsh">twext/trunk/bin/_build.sh</a></li>
<li><a href="#twexttrunkbin_pysh">twext/trunk/bin/_py.sh</a></li>
<li><a href="#twexttrunkbindevelop">twext/trunk/bin/develop</a></li>
<li><a href="#twexttrunkbininstall_pip">twext/trunk/bin/install_pip</a></li>
<li><a href="#twexttrunkbinpyflakes">twext/trunk/bin/pyflakes</a></li>
<li><a href="#twexttrunkbinpython">twext/trunk/bin/python</a></li>
<li><a href="#twexttrunksetuppy">twext/trunk/setup.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="twexttrunkbin_buildsh"></a>
<div class="modfile"><h4>Modified: twext/trunk/bin/_build.sh (12432 => 12433)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/bin/_build.sh        2014-01-23 20:09:51 UTC (rev 12432)
+++ twext/trunk/bin/_build.sh        2014-01-23 23:30:31 UTC (rev 12433)
</span><span class="lines">@@ -435,11 +435,23 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><ins>+ruler () {
+ echo "____________________________________________________________";
+ echo "";
+
+ if [ $# -gt 0 ]; then
+ echo "$@";
+ fi;
+}
+
+
+
</ins><span class="cx"> #
</span><span class="cx"> # Build C dependencies
</span><span class="cx"> #
</span><span class="cx"> c_dependencies () {
</span><span class="cx">
</span><ins>+ ruler;
</ins><span class="cx"> if find_header ffi/ffi.h; then
</span><span class="cx"> using_system "libffi";
</span><span class="cx"> else
</span><span class="lines">@@ -448,6 +460,7 @@
</span><span class="cx"> "ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz"
</span><span class="cx"> fi;
</span><span class="cx">
</span><ins>+ ruler;
</ins><span class="cx"> if find_header ldap.h 20428 LDAP_VENDOR_VERSION; then
</span><span class="cx"> using_system "OpenLDAP";
</span><span class="cx"> else
</span><span class="lines">@@ -460,6 +473,7 @@
</span><span class="cx"> --disable-bdb --disable-hdb;
</span><span class="cx"> fi;
</span><span class="cx">
</span><ins>+ ruler;
</ins><span class="cx"> if find_header sasl/sasl.h && ! find_header sasl.h; then
</span><span class="cx"> mkdir -p "${dev_root}/include";
</span><span class="cx"> echo "#include <sasl/sasl.h>" > "${dev_root}/include/sasl.h"
</span><span class="lines">@@ -486,25 +500,54 @@
</span><span class="cx"> mkdir -p "${dev_root}";
</span><span class="cx"> mkdir -p "${dev_libdir}";
</span><span class="cx">
</span><del>- export PYTHONPATH="${dev_libdir}:${PYTHONPATH:-}"
</del><ins>+ # export PYTHONPATH="${dev_libdir}:${PYTHONPATH:-}"
</ins><span class="cx">
</span><del>- export PATH="${dev_root}/bin:${PATH}";
- export C_INCLUDE_PATH="${dev_root}/include:${C_INCLUDE_PATH:-}";
- export LD_LIBRARY_PATH="${dev_root}/lib:${dev_root}/lib64:${LD_LIBRARY_PATH:-}";
- export CPPFLAGS="-I${dev_root}/include ${CPPFLAGS:-} ";
- export LDFLAGS="-L${dev_root}/lib -L${dev_root}/lib64 ${LDFLAGS:-} ";
- export DYLD_LIBRARY_PATH="${dev_root}/lib:${dev_root}/lib64:${DYLD_LIBRARY_PATH:-}";
- export PKG_CONFIG_PATH="${dev_root}/lib/pkgconfig:${PKG_CONFIG_PATH:-}";
</del><ins>+ # export PATH="${dev_root}/bin:${PATH}";
+ # export C_INCLUDE_PATH="${dev_root}/include:${C_INCLUDE_PATH:-}";
+ # export LD_LIBRARY_PATH="${dev_root}/lib:${dev_root}/lib64:${LD_LIBRARY_PATH:-}";
+ # export CPPFLAGS="-I${dev_root}/include ${CPPFLAGS:-} ";
+ # export LDFLAGS="-L${dev_root}/lib -L${dev_root}/lib64 ${LDFLAGS:-} ";
+ # export DYLD_LIBRARY_PATH="${dev_root}/lib:${dev_root}/lib64:${DYLD_LIBRARY_PATH:-}";
+ # export PKG_CONFIG_PATH="${dev_root}/lib/pkgconfig:${PKG_CONFIG_PATH:-}";
</ins><span class="cx">
</span><span class="cx"> cd "${wd}";
</span><span class="cx">
</span><del>- if ! "${python}" ./setup.py develop \
- --install-dir "${dev_libdir}" \
- --script-dir "${dev_bindir}" \
- > "${dev_root}/setup.log" 2>&1; then
- err=$?;
- echo "Unable to set up for development:"
- cat "${dev_root}/setup.log";
- exit ${err};
- fi;
</del><ins>+
+ "${bootstrap_python}" -m virtualenv "${dev_root}";
+
+ python="${dev_bindir}/python";
+
+ for requirements in "${wd}/requirements/"*; do
+
+ ruler "Preparing Python requirements: ${requirements}";
+ echo "";
+
+ if ! "${python}" -m pip install \
+ --requirement "${requirements}" \
+ --download-cache "${dev_home}/pip_cache" \
+ ; then
+ err=$?;
+ echo "Unable to set up Python requirements: ${requirements}";
+ if [ "${requirements#${wd}/requirements/opt_}" != "${requirements}" ]; then
+ echo "Requirements ${requirements} are optional; continuing.";
+ else
+ echo "";
+ exit ${err};
+ fi;
+ fi;
+
+ done;
+
+ echo "";
</ins><span class="cx"> }
</span><ins>+
+
+
+#
+# Set up for development
+#
+develop () {
+ init_build;
+ c_dependencies;
+ py_dependencies;
+}
</ins></span></pre></div>
<a id="twexttrunkbin_pysh"></a>
<div class="modfile"><h4>Modified: twext/trunk/bin/_py.sh (12432 => 12433)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/bin/_py.sh        2014-01-23 20:09:51 UTC (rev 12432)
+++ twext/trunk/bin/_py.sh        2014-01-23 23:30:31 UTC (rev 12433)
</span><span class="lines">@@ -48,6 +48,11 @@
</span><span class="cx"> #
</span><span class="cx"> # Detect which version of Python to use, then print out which one was detected.
</span><span class="cx"> #
</span><ins>+# This will prefer the python interpreter in the PYTHON environment variable.
+# If that's not found, it will check for "python2.7", "python2.6" and "python",
+# looking for each in your PATH and, failing that, in a number of well-known
+# locations.
+#
</ins><span class="cx"> detect_python_version () {
</span><span class="cx"> local v;
</span><span class="cx"> local p;
</span><span class="lines">@@ -67,9 +72,11 @@
</span><span class="cx"> "/sw/bin/python${v}" \
</span><span class="cx"> ;
</span><span class="cx"> do
</span><del>- if try_python "${p}"; then
- echo "${p}";
- return 0;
</del><ins>+ if p="$(type -p "${p}")"; then
+ if try_python "${p}"; then
+ echo "${p}";
+ return 0;
+ fi;
</ins><span class="cx"> fi;
</span><span class="cx"> done;
</span><span class="cx"> done;
</span><span class="lines">@@ -84,6 +91,8 @@
</span><span class="cx"> local v="$1"; shift;
</span><span class="cx"> local mv="$1"; shift;
</span><span class="cx">
</span><ins>+ local vh;
+ local mvh;
</ins><span class="cx"> local result;
</span><span class="cx">
</span><span class="cx"> while true; do
</span><span class="lines">@@ -131,7 +140,7 @@
</span><span class="cx"> # important on systems with older system pythons (2.4 or earlier) with an
</span><span class="cx"> # alternate install of Python, or alternate python installation mechanisms
</span><span class="cx"> # like virtualenv.
</span><del>- python="$(detect_python_version)";
</del><ins>+ bootstrap_python="$(detect_python_version)";
</ins><span class="cx">
</span><span class="cx"> # Set the $PYTHON environment variable to an absolute path pointing at the
</span><span class="cx"> # appropriate python executable, a standard-ish mechanism used by certain
</span><span class="lines">@@ -139,10 +148,10 @@
</span><span class="cx"> # the part of the PostgreSQL build process which builds pl_python. Note that
</span><span class="cx"> # detect_python_version, above, already honors $PYTHON, so if this is already
</span><span class="cx"> # set it won't be stomped on, it will just be re-set to the same value.
</span><del>- export PYTHON="$(type -p ${python})";
</del><ins>+ export PYTHON="$(type -p ${bootstrap_python})";
</ins><span class="cx">
</span><del>- if [ -z "${python:-}" ]; then
- echo "No suitable python found. Python 2.6+ is required.";
</del><ins>+ if [ -z "${bootstrap_python:-}" ]; then
+ echo "No suitable python found. Python 2.6 or 2.7 is required.";
</ins><span class="cx"> exit 1;
</span><del>- fi
</del><ins>+ fi;
</ins><span class="cx"> }
</span></span></pre></div>
<a id="twexttrunkbindevelop"></a>
<div class="modfile"><h4>Modified: twext/trunk/bin/develop (12432 => 12433)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/bin/develop        2014-01-23 20:09:51 UTC (rev 12432)
+++ twext/trunk/bin/develop        2014-01-23 23:30:31 UTC (rev 12433)
</span><span class="lines">@@ -16,6 +16,9 @@
</span><span class="cx"> # limitations under the License.
</span><span class="cx"> ##
</span><span class="cx">
</span><ins>+set -e;
+set -u;
+
</ins><span class="cx"> if [ -z "${wd:-}" ]; then
</span><span class="cx"> wd="$(cd "$(dirname "$0")/.." && pwd)";
</span><span class="cx"> fi;
</span><span class="lines">@@ -24,6 +27,4 @@
</span><span class="cx">
</span><span class="cx"> . "${wd}/bin/_build.sh";
</span><span class="cx">
</span><del>-init_build;
-c_dependencies;
-py_dependencies;
</del><ins>+develop;
</ins></span></pre></div>
<a id="twexttrunkbininstall_pip"></a>
<div class="modfile"><h4>Modified: twext/trunk/bin/install_pip (12432 => 12433)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/bin/install_pip        2014-01-23 20:09:51 UTC (rev 12432)
+++ twext/trunk/bin/install_pip        2014-01-23 23:30:31 UTC (rev 12433)
</span><span class="lines">@@ -25,42 +25,35 @@
</span><span class="cx"> cd "${tmp}";
</span><span class="cx">
</span><span class="cx">
</span><del>-find_tool ()
-{
- local tool="$1"; shift;
- local version="$1"; shift;
- local cmd;
-
- for cmd in "${tool}-${py_version}" "${tool}${py_version}"; do
- if type -p "${cmd}" > /dev/null; then
- echo "${cmd}";
- return 0
- fi;
- done;
-
- return 1;
-}
-
-
</del><span class="cx"> for py_version in "2.7" "2.6"; do
</span><span class="cx">
</span><del>- if ! type -p "python${py_version}" > /dev/null; then
- echo "Python ${py_version} not found.";
- continue;
- fi;
</del><ins>+ python="python${py_version}";
</ins><span class="cx">
</span><del>- easy_install="$(find_tool "easy_install" "${py_version}")";
</del><ins>+ if ! "${python}" -V > /dev/null 2>&1; then
+ continue;
+ fi;
</ins><span class="cx">
</span><del>- sudo "${easy_install}" --upgrade setuptools;
</del><ins>+ echo "________________________________________";
+ echo "Installing tools for Python ${py_version}...";
</ins><span class="cx">
</span><del>- if ! pip="$(find_tool "pip" "${py_version}")"; then
- sudo "python${py_version}" "${wd}/bin/_get_pip";
- fi;
</del><ins>+ if ! "${python}" -m easy_install --help > /dev/null; then
+ echo "Setuptools is not installed; cannot continue.";
+ continue;
+ fi;
</ins><span class="cx">
</span><del>- pip="$(find_tool "pip" "${py_version}")";
</del><ins>+ echo "";
+ sudo "${python}" -m easy_install --upgrade setuptools;
</ins><span class="cx">
</span><del>- sudo "${pip}" install --upgrade pip;
</del><ins>+ if ! python -m pip -V > /dev/null; then
+ echo "";
+ sudo "${python}" "${wd}/bin/_get_pip";
+ fi;
</ins><span class="cx">
</span><ins>+ echo "";
+ sudo python -m pip install --upgrade pip;
+ echo "";
+ sudo python -m pip install --upgrade virtualenv;
+
</ins><span class="cx"> done;
</span><span class="cx">
</span><span class="cx"> rm -rf "${tmp}";
</span></span></pre></div>
<a id="twexttrunkbinpyflakes"></a>
<div class="modfile"><h4>Modified: twext/trunk/bin/pyflakes (12432 => 12433)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/bin/pyflakes        2014-01-23 20:09:51 UTC (rev 12432)
+++ twext/trunk/bin/pyflakes        2014-01-23 23:30:31 UTC (rev 12433)
</span><span class="lines">@@ -21,7 +21,11 @@
</span><span class="cx">
</span><span class="cx"> wd="$(cd "$(dirname "$0")/.." && pwd -L)";
</span><span class="cx">
</span><del>-. "${wd}/bin/develop";
</del><ins>+export TWEXT_DEVELOP="true";
</ins><span class="cx">
</span><ins>+. "${wd}/bin/_build.sh";
+
+develop;
+
</ins><span class="cx"> pip install pyflakes --no-use-wheel --upgrade --target="${dev_libdir}" > "${dev_root}/pip_pyflakes.log" || true;
</span><span class="cx"> exec "${python}" -m pyflakes "$@";
</span></span></pre></div>
<a id="twexttrunkbinpython"></a>
<div class="modfile"><h4>Modified: twext/trunk/bin/python (12432 => 12433)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/bin/python        2014-01-23 20:09:51 UTC (rev 12432)
+++ twext/trunk/bin/python        2014-01-23 23:30:31 UTC (rev 12433)
</span><span class="lines">@@ -21,6 +21,10 @@
</span><span class="cx">
</span><span class="cx"> wd="$(cd "$(dirname "$0")/.." && pwd)";
</span><span class="cx">
</span><del>-. "${wd}/bin/develop";
</del><ins>+export TWEXT_DEVELOP="true";
</ins><span class="cx">
</span><ins>+. "${wd}/bin/_build.sh";
+
+develop;
+
</ins><span class="cx"> exec "${python}" "$@";
</span></span></pre></div>
<a id="twexttrunksetuppy"></a>
<div class="modfile"><h4>Modified: twext/trunk/setup.py (12432 => 12433)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/setup.py        2014-01-23 20:09:51 UTC (rev 12432)
+++ twext/trunk/setup.py        2014-01-23 23:30:31 UTC (rev 12433)
</span><span class="lines">@@ -20,11 +20,12 @@
</span><span class="cx">
</span><span class="cx"> import sys
</span><span class="cx"> import errno
</span><del>-import os
</del><ins>+from os import listdir, environ as environment
</ins><span class="cx"> from os.path import dirname, abspath, join as joinpath
</span><ins>+from itertools import chain
</ins><span class="cx"> import subprocess
</span><del>-from itertools import chain
</del><span class="cx"> from setuptools import setup, find_packages as setuptools_find_packages
</span><ins>+from pip.req import parse_requirements
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> #
</span><span class="lines">@@ -119,37 +120,39 @@
</span><span class="cx"> # Dependencies
</span><span class="cx"> #
</span><span class="cx">
</span><del>-setup_requirements = [
-]
</del><ins>+requirements_dir = joinpath(dirname(__file__), "requirements")
</ins><span class="cx">
</span><del>-install_requirements = [
- "cffi==0.6",
- "twisted>=13.2.0",
-]
</del><span class="cx">
</span><del>-extras_requirements = {
- "LDAP": ["python-ldap>=2.4.13"],
- "DAL": ["sqlparse==0.1.2"],
-}
</del><ins>+def read_requirements(reqs_filename):
+ return [
+ str(r.req) for r in
+ parse_requirements(joinpath(requirements_dir, reqs_filename))
+ ]
</ins><span class="cx">
</span><ins>+
+setup_requirements = []
+
+install_requirements = read_requirements("base.txt")
+
+extras_requirements = dict(
+ (reqs_filename[4:-4], read_requirements(reqs_filename))
+ for reqs_filename in listdir(requirements_dir)
+ if reqs_filename.startswith("opt_") and reqs_filename.endswith(".txt")
+)
+
</ins><span class="cx"> # Requirements for development and testing
</span><del>-develop_requirements = [
- "docutils>=0.11",
- "mockldap>=0.1.4",
-]
</del><ins>+develop_requirements = read_requirements("develop.txt")
</ins><span class="cx">
</span><del>-if os.environ.get("TWEXT_DEVELOP", "false") == "true":
</del><ins>+if environment.get("TWEXT_DEVELOP", "false") == "true":
</ins><span class="cx"> install_requirements.extend(develop_requirements)
</span><del>-
- # FIXME: It would be better to figure out how to get `setup.py develop` to
- # fetch the extras_requirements...
</del><span class="cx"> install_requirements.extend(chain(*extras_requirements.values()))
</span><span class="cx">
</span><del>-# Add oracle after defining the development requirements, because it's
-# not exactly super portable and so it's potentially a major pain to
-# install.
</del><ins>+ # Remove cx_Oracle here because we don't automate it's installation.
+ install_requirements = [
+ r for r in install_requirements
+ if not r.startswith("cx-Oracle")
+ ]
</ins><span class="cx">
</span><del>-extras_requirements["Oracle"] = ["cx_Oracle==5.1.2"]
</del><span class="cx">
</span><span class="cx">
</span><span class="cx"> #
</span></span></pre>
</div>
</div>
</body>
</html>