[CalendarServer-changes] [12439] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 12 11:24:04 PDT 2014
Revision: 12439
http://trac.calendarserver.org//changeset/12439
Author: wsanchez at apple.com
Date: 2014-01-23 17:46:22 -0800 (Thu, 23 Jan 2014)
Log Message:
-----------
New build tools.
Modified Paths:
--------------
CalendarServer/trunk/.gitignore
CalendarServer/trunk/bin/trial
CalendarServer/trunk/bin/twistd
CalendarServer/trunk/setup.py
Added Paths:
-----------
CalendarServer/trunk/bin/_build.sh
CalendarServer/trunk/bin/_py.sh
CalendarServer/trunk/bin/develop
CalendarServer/trunk/bin/pyflakes
CalendarServer/trunk/bin/python
CalendarServer/trunk/bin/update_copyrights
CalendarServer/trunk/requirements/
CalendarServer/trunk/requirements/base.txt
CalendarServer/trunk/requirements/develop.txt
CalendarServer/trunk/requirements/opt_LDAP.txt
CalendarServer/trunk/requirements/opt_Oracle.txt
Removed Paths:
-------------
CalendarServer/trunk/pydoctor
CalendarServer/trunk/pyflakes
CalendarServer/trunk/python
CalendarServer/trunk/support/update_copyrights
CalendarServer/trunk/support/version.py
CalendarServer/trunk/test
CalendarServer/trunk/testserver
Modified: CalendarServer/trunk/.gitignore
===================================================================
--- CalendarServer/trunk/.gitignore 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/.gitignore 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,3 +1,4 @@
+*.egg-info
*.pyc
*.so
dropin.cache
@@ -2,5 +3,6 @@
+/.develop/
/build/
/data/
/calendarserver/version.py
-/conf/caldavd-dev.plist
\ No newline at end of file
+/conf/caldavd-dev.plist
Added: CalendarServer/trunk/bin/_build.sh
===================================================================
--- CalendarServer/trunk/bin/_build.sh (rev 0)
+++ CalendarServer/trunk/bin/_build.sh 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1,586 @@
+# -*- 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.
+##
+
+. "${wd}/bin/_py.sh";
+
+
+echo_header () {
+ echo "$@";
+ echo "";
+}
+
+
+using_system () {
+ local name="$1"; shift;
+ echo_header "Using system version of ${name}.";
+}
+
+
+# Provide a default value: if the variable named by the first argument is
+# empty, set it to the default in the second argument.
+conditional_set () {
+ local var="$1"; shift;
+ local default="$1"; shift;
+ if [ -z "$(eval echo "\${${var}:-}")" ]; then
+ eval "${var}=\${default:-}";
+ fi;
+}
+
+
+# Checks for presence of a C header, optionally with a version comparison.
+# With only a header file name, try to include it, returning nonzero if absent.
+# With 3 params, also attempt a version check, returning nonzero if too old.
+# Param 2 is a minimum acceptable version number
+# Param 3 is a #define from the source that holds the installed version number
+# Examples:
+# Assert that ldap.h is present
+# find_header "ldap.h"
+# Assert that ldap.h is present with a version >= 20344
+# find_header "ldap.h" 20344 "LDAP_VENDOR_VERSION"
+find_header () {
+ local sys_header="$1"; shift;
+ if [ $# -ge 1 ]; then
+ local min_version="$1"; shift;
+ local version_macro="$1"; shift;
+ fi;
+
+ # No min_version given:
+ # Check for presence of a header. We use the "-c" cc option because we don't
+ # need to emit a file; cc exits nonzero if it can't find the header
+ if [ -z "${min_version:-}" ]; then
+ echo "#include <${sys_header}>" | cc -x c -c - -o /dev/null 2> /dev/null;
+ return "$?";
+ fi;
+
+ # Check for presence of a header of specified version
+ local found_version="$(printf "#include <${sys_header}>\n${version_macro}\n" | cc -x c -E - | tail -1)";
+
+ if [ "${found_version}" == "${version_macro}" ]; then
+ # Macro was not replaced
+ return 1;
+ fi;
+
+ if cmp_version "${min_version}" "${found_version}"; then
+ return 0;
+ else
+ return 1;
+ fi;
+};
+
+
+# Initialize all the global state required to use this library.
+init_build () {
+ init_py;
+
+ do_get="true";
+ do_setup="true";
+ force_setup="false";
+
+ dev_home="${wd}/.develop";
+ dev_root="${dev_home}/root";
+ dev_libdir="${dev_root}/lib/python";
+ dev_bindir="${dev_root}/bin";
+ dep_packages="${dev_home}/pkg";
+ dep_sources="${dev_home}/src";
+
+ mkdir -p "${dep_sources}";
+
+ # Set up virtual environment
+
+ "${bootstrap_python}" -m virtualenv "${dev_root}";
+
+ python="${dev_bindir}/python";
+
+ # These variables are defaults for things which might be configured by
+ # environment; only set them if they're un-set.
+
+ conditional_set wd "$(pwd)";
+
+ # Find some hashing commands
+ # sha1() = sha1 hash, if available
+ # md5() = md5 hash, if available
+ # hash() = default hash function
+ # $hash = name of the type of hash used by hash()
+
+ hash="";
+
+ if type -ft openssl > /dev/null; then
+ if [ -z "${hash}" ]; then hash="md5"; fi;
+ md5 () { "$(type -p openssl)" dgst -md5 "$@"; }
+ elif type -ft md5 > /dev/null; then
+ if [ -z "${hash}" ]; then hash="md5"; fi;
+ md5 () { "$(type -p md5)" "$@"; }
+ elif type -ft md5sum > /dev/null; then
+ if [ -z "${hash}" ]; then hash="md5"; fi;
+ md5 () { "$(type -p md5sum)" "$@"; }
+ fi;
+
+ if type -ft sha1sum > /dev/null; then
+ if [ -z "${hash}" ]; then hash="sha1sum"; fi;
+ sha1 () { "$(type -p sha1sum)" "$@"; }
+ fi;
+ if type -ft shasum > /dev/null; then
+ if [ -z "${hash}" ]; then hash="sha1"; fi;
+ sha1 () { "$(type -p shasum)" "$@"; }
+ fi;
+
+ if [ "${hash}" == "sha1" ]; then
+ hash () { sha1 "$@"; }
+ elif [ "${hash}" == "md5" ]; then
+ hash () { md5 "$@"; }
+ elif type -t cksum > /dev/null; then
+ hash="hash";
+ hash () { cksum "$@" | cut -f 1 -d " "; }
+ elif type -t sum > /dev/null; then
+ hash="hash";
+ hash () { sum "$@" | cut -f 1 -d " "; }
+ else
+ hash () { echo "INTERNAL ERROR: No hash function."; exit 1; }
+ fi;
+}
+
+
+# If do_get is turned on, get an archive file containing a dependency via HTTP.
+www_get () {
+ if ! "${do_get}"; then return 0; fi;
+
+ local md5="";
+ local sha1="";
+
+ OPTIND=1;
+ while getopts "m:s:" option; do
+ case "${option}" in
+ 'm') md5="${OPTARG}"; ;;
+ 's') sha1="${OPTARG}"; ;;
+ esac;
+ done;
+ shift $((${OPTIND} - 1));
+
+ local name="$1"; shift;
+ local path="$1"; shift;
+ local url="$1"; shift;
+
+ if "${force_setup}" || [ ! -d "${path}" ]; then
+ local ext="$(echo "${url}" | sed 's|^.*\.\([^.]*\)$|\1|')";
+
+ untar () { tar -xvf -; }
+ unzipstream () { tmp="$(mktemp -t ccsXXXXX)"; cat > "${tmp}"; unzip "${tmp}"; rm "${tmp}"; }
+ case "${ext}" in
+ gz|tgz) decompress="gzip -d -c"; unpack="untar"; ;;
+ bz2) decompress="bzip2 -d -c"; unpack="untar"; ;;
+ tar) decompress="untar"; unpack="untar"; ;;
+ zip) decompress="cat"; unpack="unzipstream"; ;;
+ *)
+ echo "Error in www_get of URL ${url}: Unknown extension ${ext}";
+ exit 1;
+ ;;
+ esac;
+
+ echo "";
+
+ if [ -n "${dep_packages}" ] && [ -n "${hash}" ]; then
+ mkdir -p "${dep_packages}";
+
+ local cache_basename="$(echo ${name} | tr '[ ]' '_')-$(echo "${url}" | hash)-$(basename "${url}")";
+ local cache_file="${dep_packages}/${cache_basename}";
+
+ check_hash () {
+ local file="$1"; shift;
+
+ local sum="$(md5 "${file}" | perl -pe 's|^.*([0-9a-f]{32}).*$|\1|')";
+ if [ -n "${md5}" ]; then
+ echo "Checking MD5 sum for ${name}...";
+ if [ "${md5}" != "${sum}" ]; then
+ echo "ERROR: MD5 sum for downloaded file is wrong: ${sum} != ${md5}";
+ return 1;
+ fi;
+ else
+ echo "MD5 sum for ${name} is ${sum}";
+ fi;
+
+ local sum="$(sha1 "${file}" | perl -pe 's|^.*([0-9a-f]{40}).*$|\1|')";
+ if [ -n "${sha1}" ]; then
+ echo "Checking SHA1 sum for ${name}...";
+ if [ "${sha1}" != "${sum}" ]; then
+ echo "ERROR: SHA1 sum for downloaded file is wrong: ${sum} != ${sha1}";
+ return 1;
+ fi;
+ else
+ echo "SHA1 sum for ${name} is ${sum}";
+ fi;
+ }
+
+ if [ ! -f "${cache_file}" ]; then
+ echo "No cache file: ${cache_file}";
+
+ echo "Downloading ${name}...";
+
+ local pkg_host="static.calendarserver.org";
+ local pkg_path="/pkg";
+
+ #
+ # Try getting a copy from calendarserver.org.
+ #
+ local tmp="$(mktemp "/tmp/${cache_basename}.XXXXXX")";
+ curl -L "http://${pkg_host}${pkg_path}/${cache_basename}" -o "${tmp}" || true;
+ echo "";
+ if [ ! -s "${tmp}" ] || grep '<title>404 Not Found</title>' "${tmp}" > /dev/null; then
+ rm -f "${tmp}";
+ echo "${name} is not available from calendarserver.org; trying upstream source.";
+ elif ! check_hash "${tmp}"; then
+ rm -f "${tmp}";
+ echo "${name} from calendarserver.org is invalid; trying upstream source.";
+ fi;
+
+ #
+ # That didn't work. Try getting a copy from the upstream source.
+ #
+ if [ ! -f "${tmp}" ]; then
+ curl -L "${url}" -o "${tmp}";
+ echo "";
+
+ if [ ! -s "${tmp}" ] || grep '<title>404 Not Found</title>' "${tmp}" > /dev/null; then
+ rm -f "${tmp}";
+ echo "${name} is not available from upstream source: ${url}";
+ exit 1;
+ elif ! check_hash "${tmp}"; then
+ rm -f "${tmp}";
+ echo "${name} from upstream source is invalid: ${url}";
+ exit 1;
+ fi;
+
+ if egrep "^${pkg_host}" "${HOME}/.ssh/known_hosts" > /dev/null 2>&1; then
+ echo "Copying cache file up to ${pkg_host}.";
+ if ! scp "${tmp}" "${pkg_host}:/var/www/static${pkg_path}/${cache_basename}"; then
+ echo "Failed to copy cache file up to ${pkg_host}.";
+ fi;
+ echo ""
+ fi;
+ fi;
+
+ #
+ # OK, we should be good
+ #
+ mv "${tmp}" "${cache_file}";
+ else
+ #
+ # We have the file cached, just verify hash
+ #
+ if ! check_hash "${cache_file}"; then
+ exit 1;
+ fi;
+ fi;
+
+ echo "Unpacking ${name} from cache...";
+ get () { cat "${cache_file}"; }
+ else
+ echo "Downloading ${name}...";
+ get () { curl -L "${url}"; }
+ fi;
+
+ rm -rf "${path}";
+ cd "$(dirname "${path}")";
+ get | ${decompress} | ${unpack};
+ cd /;
+ fi;
+}
+
+
+# If do_get is turned on, check a name out from SVN.
+svn_get () {
+ if ! "${do_get}"; then
+ return 0;
+ fi;
+
+ local name="$1"; shift;
+ local path="$1"; shift;
+ local uri="$1"; shift;
+ local revision="$1"; shift;
+
+ if [ -d "${path}" ]; then
+ local wc_uri="$(svn info --xml "${path}" 2> /dev/null | sed -n 's|^.*<url>\(.*\)</url>.*$|\1|p')";
+
+ if "${force_setup}"; then
+ # Verify that we have a working copy checked out from the correct URI
+ if [ "${wc_uri}" != "${uri}" ]; then
+ echo "Current working copy (${path}) is from the wrong URI: ${wc_uri} != ${uri}";
+ rm -rf "${path}";
+ svn_get "${name}" "${path}" "${uri}" "${revision}";
+ return $?;
+ fi;
+
+ echo "Reverting ${name}...";
+ svn revert -R "${path}";
+
+ echo "Updating ${name}...";
+ svn update -r "${revision}" "${path}";
+ else
+ # Verify that we have a working copy checked out from the correct URI
+ if [ "${wc_uri}" != "${uri}" ]; then
+ echo "Current working copy (${path}) is from the wrong URI: ${wc_uri} != ${uri}";
+ echo "Performing repository switch for ${name}...";
+ svn switch -r "${revision}" "${uri}" "${path}";
+ else
+ local svnversion="$(svnversion "${path}")";
+ if [ "${svnversion%%[M:]*}" != "${revision}" ]; then
+ echo "Updating ${name}...";
+ svn update -r "${revision}" "${path}";
+ fi;
+ fi;
+ fi;
+ else
+ checkout () {
+ echo "Checking out ${name}...";
+ svn checkout -r "${revision}" "${uri}@${revision}" "${path}";
+ }
+
+ if [ "${revision}" != "HEAD" ] && \
+ [ -n "${dep_packages}" ] && \
+ [ -n "${hash}" ] \
+ ; then
+ local cacheid="${name}-$(echo "${uri}" | hash)";
+ local cache_file="${dep_packages}/${cacheid}@r${revision}.tgz";
+
+ mkdir -p "${dep_packages}";
+
+ if [ -f "${cache_file}" ]; then
+ echo "Unpacking ${name} from cache...";
+ mkdir -p "${path}";
+ tar -C "${path}" -xvzf "${cache_file}";
+ else
+ checkout;
+ echo "Caching ${name}...";
+ tar -C "${path}" -cvzf "${cache_file}" .;
+ fi;
+ else
+ checkout;
+ fi;
+ fi;
+}
+
+
+# Run 'make' with the given command line, prepending a -j option appropriate to
+# the number of CPUs on the current machine, if that can be determined.
+jmake () {
+ case "$(uname -s)" in
+ Darwin|Linux)
+ ncpu="$(getconf _NPROCESSORS_ONLN)";
+ ;;
+ FreeBSD)
+ ncpu="$(sysctl hw.ncpu)";
+ ncpu="${ncpu##hw.ncpu: }";
+ ;;
+ esac;
+
+ if [ -n "${ncpu:-}" ] && [[ "${ncpu}" =~ ^[0-9]+$ ]]; then
+ make -j "${ncpu}" "$@";
+ else
+ make "$@";
+ fi;
+}
+
+# Declare a dependency on a C project built with autotools.
+c_dependency () {
+ local f_hash="";
+
+ OPTIND=1;
+ while getopts "m:s:" option; do
+ case "${option}" in
+ 'm') f_hash="-m ${OPTARG}"; ;;
+ 's') f_hash="-s ${OPTARG}"; ;;
+ esac;
+ done;
+ shift $((${OPTIND} - 1));
+
+ local name="$1"; shift;
+ local path="$1"; shift;
+ local uri="$1"; shift;
+
+ # Extra arguments are processed below, as arguments to './configure'.
+
+ srcdir="${dep_sources}/${path}";
+ # local dstroot="${srcdir}/_root";
+ local dstroot="${dev_root}";
+
+ www_get ${f_hash} "${name}" "${srcdir}" "${uri}";
+
+ export PATH="${dstroot}/bin:${PATH}";
+ export C_INCLUDE_PATH="${dstroot}/include:${C_INCLUDE_PATH:-}";
+ export LD_LIBRARY_PATH="${dstroot}/lib:${dstroot}/lib64:${LD_LIBRARY_PATH:-}";
+ export CPPFLAGS="-I${dstroot}/include ${CPPFLAGS:-} ";
+ export LDFLAGS="-L${dstroot}/lib -L${dstroot}/lib64 ${LDFLAGS:-} ";
+ export DYLD_LIBRARY_PATH="${dstroot}/lib:${dstroot}/lib64:${DYLD_LIBRARY_PATH:-}";
+ export PKG_CONFIG_PATH="${dstroot}/lib/pkgconfig:${PKG_CONFIG_PATH:-}";
+
+ if "${do_setup}"; then
+ if "${force_setup}" || [ ! -d "${dstroot}" ]; then
+ echo "Building ${name}...";
+ cd "${srcdir}";
+ ./configure --prefix="${dstroot}" "$@";
+ jmake;
+ jmake install;
+ else
+ echo "Using built ${name}.";
+ echo "";
+ fi;
+ fi;
+}
+
+
+ruler () {
+ echo "____________________________________________________________";
+ echo "";
+
+ if [ $# -gt 0 ]; then
+ echo "$@";
+ fi;
+}
+
+
+
+#
+# Build C dependencies
+#
+c_dependencies () {
+
+ ruler;
+ if find_header ldap.h 20428 LDAP_VENDOR_VERSION; then
+ using_system "OpenLDAP";
+ else
+ local v="2.4.38";
+ local n="openldap";
+ local p="${n}-${v}";
+ c_dependency -m "39831848c731bcaef235a04e0d14412f" \
+ "OpenLDAP" "${p}" \
+ "http://www.openldap.org/software/download/OpenLDAP/${n}-release/${p}.tgz" \
+ --disable-bdb --disable-hdb;
+ fi;
+
+ ruler;
+ if find_header sasl/sasl.h && ! find_header sasl.h; then
+ mkdir -p "${dev_root}/include";
+ echo "#include <sasl/sasl.h>" > "${dev_root}/include/sasl.h"
+ using_system "SASL";
+ elif find_header sasl.h; then
+ using_system "SASL";
+ else
+ local v="2.1.26";
+ local n="cyrus-sasl";
+ local p="${n}-${v}";
+ c_dependency -m "a7f4e5e559a0e37b3ffc438c9456e425" \
+ "Cyrus SASL" "${p}" \
+ "ftp://ftp.cyrusimap.org/cyrus-sasl/${p}.tar.gz" \
+ --disable-macos-framework;
+ fi;
+
+ ruler;
+ if find_header ffi/ffi.h; then
+ using_system "libffi";
+ else
+ c_dependency -m "45f3b6dbc9ee7c7dfbbbc5feba571529" \
+ "libffi" "libffi-3.0.13" \
+ "ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz"
+ fi;
+
+ ruler;
+ if type -P memcached > /dev/null; then
+ using_system "memcached";
+ else
+ local le="libevent-2.0.21-stable";
+ local mc="memcached-1.4.16";
+ c_dependency -m "b2405cc9ebf264aa47ff615d9de527a2" \
+ "libevent" "${le}" \
+ "http://github.com/downloads/libevent/libevent/${le}.tar.gz";
+ c_dependency -m "1c5781fecb52d70b615c6d0c9c140c9c" \
+ "memcached" "${mc}" \
+ "http://www.memcached.org/files/${mc}.tar.gz";
+ fi;
+
+ ruler;
+ if type -P postgres > /dev/null; then
+ using_system "Postgres";
+ else
+ local v="9.3.1";
+ local n="postgresql";
+ local p="${n}-${v}";
+
+ if type -P dtrace > /dev/null; then
+ local enable_dtrace="--enable-dtrace";
+ else
+ local enable_dtrace="";
+ fi;
+
+ c_dependency -m "c003d871f712d4d3895956b028a96e74" \
+ "PostgreSQL" "${p}" \
+ "http://ftp.postgresql.org/pub/source/v${v}/${p}.tar.bz2" \
+ --with-python ${enable_dtrace};
+ fi;
+
+}
+
+
+#
+# Build Python dependencies
+#
+py_dependencies () {
+ # export PYTHONPATH="${dev_libdir}:${PYTHONPATH:-}"
+
+ # 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:-}";
+
+ # cd "${wd}";
+
+ 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" \
+ --log "${dev_home}/pip.log" \
+ ; 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 "";
+}
+
+
+
+#
+# Set up for development
+#
+develop () {
+ init_build;
+ c_dependencies;
+ py_dependencies;
+}
Added: CalendarServer/trunk/bin/_py.sh
===================================================================
--- CalendarServer/trunk/bin/_py.sh (rev 0)
+++ CalendarServer/trunk/bin/_py.sh 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1,157 @@
+# -*- 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.
+##
+
+# Echo the major.minor version of the given Python interpreter.
+
+py_version () {
+ local python="$1"; shift;
+ echo "$("${python}" -c "from distutils.sysconfig import get_python_version; print get_python_version()")";
+}
+
+#
+# Test if a particular python interpreter is available, given the full path to
+# that interpreter.
+#
+try_python () {
+ local python="$1"; shift;
+
+ if [ -z "${python}" ]; then
+ return 1;
+ fi;
+
+ if ! type "${python}" > /dev/null 2>&1; then
+ return 1;
+ fi;
+
+ local py_version="$(py_version "${python}")";
+ if [ "${py_version/./}" -lt "25" ]; then
+ return 1;
+ fi;
+ return 0;
+}
+
+
+#
+# Detect which version of Python to use, then print out which one was detected.
+#
+# 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.
+#
+detect_python_version () {
+ local v;
+ local p;
+ for v in "2.7" "2.6" ""
+ do
+ for p in \
+ "${PYTHON:=}" \
+ "python${v}" \
+ "/usr/local/bin/python${v}" \
+ "/usr/local/python/bin/python${v}" \
+ "/usr/local/python${v}/bin/python${v}" \
+ "/opt/bin/python${v}" \
+ "/opt/python/bin/python${v}" \
+ "/opt/python${v}/bin/python${v}" \
+ "/Library/Frameworks/Python.framework/Versions/${v}/bin/python" \
+ "/opt/local/bin/python${v}" \
+ "/sw/bin/python${v}" \
+ ;
+ do
+ if p="$(type -p "${p}")"; then
+ if try_python "${p}"; then
+ echo "${p}";
+ return 0;
+ fi;
+ fi;
+ done;
+ done;
+ return 1;
+}
+
+
+#
+# Compare version numbers
+#
+cmp_version () {
+ local v="$1"; shift;
+ local mv="$1"; shift;
+
+ local vh;
+ local mvh;
+ local result;
+
+ while true; do
+ vh="${v%%.*}"; # Get highest-order segment
+ mvh="${mv%%.*}";
+
+ if [ "${vh}" -gt "${mvh}" ]; then
+ result=1;
+ break;
+ fi;
+
+ if [ "${vh}" -lt "${mvh}" ]; then
+ result=0;
+ break;
+ fi;
+
+ if [ "${v}" == "${v#*.}" ]; then
+ # No dots left, so we're ok
+ result=0;
+ break;
+ fi;
+
+ if [ "${mv}" == "${mv#*.}" ]; then
+ # No dots left, so we're not gonna match
+ result=1;
+ break;
+ fi;
+
+ v="${v#*.}";
+ mv="${mv#*.}";
+ done;
+
+ return ${result};
+}
+
+
+#
+# Detect which python to use, and store it in the 'python' variable, as well as
+# setting up variables related to version and build configuration.
+#
+init_py () {
+ # First, detect the appropriate version of Python to use, based on our version
+ # requirements and the environment. Note that all invocations of python in
+ # our build scripts should therefore be '"${python}"', not 'python'; this is
+ # important on systems with older system pythons (2.4 or earlier) with an
+ # alternate install of Python, or alternate python installation mechanisms
+ # like virtualenv.
+ bootstrap_python="$(detect_python_version)";
+
+ # Set the $PYTHON environment variable to an absolute path pointing at the
+ # appropriate python executable, a standard-ish mechanism used by certain
+ # non-distutils things that need to find the "right" python. For instance,
+ # the part of the PostgreSQL build process which builds pl_python. Note that
+ # detect_python_version, above, already honors $PYTHON, so if this is already
+ # set it won't be stomped on, it will just be re-set to the same value.
+ export PYTHON="$(type -p ${bootstrap_python})";
+
+ if [ -z "${bootstrap_python:-}" ]; then
+ echo "No suitable python found. Python 2.6 or 2.7 is required.";
+ exit 1;
+ fi;
+}
Added: CalendarServer/trunk/bin/develop
===================================================================
--- CalendarServer/trunk/bin/develop (rev 0)
+++ CalendarServer/trunk/bin/develop 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+##
+# 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;
+
+if [ -z "${wd:-}" ]; then
+ wd="$(cd "$(dirname "$0")/.." && pwd)";
+fi;
+
+export CALENDARSERVER_DEVELOP="true";
+
+. "${wd}/bin/_build.sh";
+
+develop;
Property changes on: CalendarServer/trunk/bin/develop
___________________________________________________________________
Added: svn:executable
+ *
Added: CalendarServer/trunk/bin/pyflakes
===================================================================
--- CalendarServer/trunk/bin/pyflakes (rev 0)
+++ CalendarServer/trunk/bin/pyflakes 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+##
+# 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 -L)";
+
+export CALENDARSERVER_DEVELOP="true";
+
+. "${wd}/bin/_build.sh";
+
+init_build > /dev/null;
+
+if [ $# -eq 0 ]; then
+ set - calendarserver contrib twisted twistedcaldav txdav txweb2;
+fi;
+
+"${python}" -m pip install pyflakes --upgrade >> "${dev_home}/setup.log";
+
+echo "Checking modules:" "$@";
+exec "${python}" -m pyflakes "$@";
Property changes on: CalendarServer/trunk/bin/pyflakes
___________________________________________________________________
Added: svn:executable
+ *
Added: CalendarServer/trunk/bin/python
===================================================================
--- CalendarServer/trunk/bin/python (rev 0)
+++ CalendarServer/trunk/bin/python 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+##
+# 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)";
+
+export CALENDARSERVER_DEVELOP="true";
+
+. "${wd}/bin/_build.sh";
+
+init_build > /dev/null;
+c_dependencies >> "${dev_home}/setup.log";
+py_dependencies >> "${dev_home}/setup.log";
+
+exec "${python}" "$@";
Property changes on: CalendarServer/trunk/bin/python
___________________________________________________________________
Added: svn:executable
+ *
Modified: CalendarServer/trunk/bin/trial
===================================================================
--- CalendarServer/trunk/bin/trial 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/bin/trial 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,13 +1,13 @@
-#!/usr/bin/env python
+#!/bin/sh
##
-# Copyright (c) 2006-2014 Apple Inc. All rights reserved.
+# 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
+# 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,
@@ -16,24 +16,17 @@
# limitations under the License.
##
-from __future__ import print_function
+set -e
+set -u
-import sys
-import os
+wd="$(cd "$(dirname "$0")/.." && pwd)";
-#PYTHONPATH
+export CALENDARSERVER_DEVELOP="true";
-if __name__ == "__main__":
- if "PYTHONPATH" in globals():
- sys.path.insert(0, PYTHONPATH)
- else:
- try:
- import _calendarserver_preamble
- except ImportError:
- sys.exc_clear()
+. "${wd}/bin/_build.sh";
- for name, value in os.environ.items():
- print("{0}={1}".format(name, value))
+init_build > /dev/null;
+c_dependencies >> "${dev_home}/setup.log";
+py_dependencies >> "${dev_home}/setup.log";
- from twisted.scripts.trial import run
- run()
+exec "${dev_bindir}/trial" "$@";
Modified: CalendarServer/trunk/bin/twistd
===================================================================
--- CalendarServer/trunk/bin/twistd 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/bin/twistd 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,13 +1,13 @@
-#!/usr/bin/env python
+#!/bin/sh
##
-# Copyright (c) 2006-2014 Apple Inc. All rights reserved.
+# 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
+# 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,
@@ -16,18 +16,17 @@
# limitations under the License.
##
-import sys
+set -e
+set -u
-#PYTHONPATH
+wd="$(cd "$(dirname "$0")/.." && pwd)";
-if __name__ == "__main__":
- if "PYTHONPATH" in globals():
- sys.path.insert(0, PYTHONPATH)
- else:
- try:
- import _calendarserver_preamble
- except ImportError:
- sys.exc_clear()
+export CALENDARSERVER_DEVELOP="true";
- from twisted.scripts.twistd import run
- run()
+. "${wd}/bin/_build.sh";
+
+init_build > /dev/null;
+c_dependencies >> "${dev_home}/setup.log";
+py_dependencies >> "${dev_home}/setup.log";
+
+exec "${dev_bindir}/twistd" "$@";
Added: CalendarServer/trunk/bin/update_copyrights
===================================================================
--- CalendarServer/trunk/bin/update_copyrights (rev 0)
+++ CalendarServer/trunk/bin/update_copyrights 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1,66 @@
+#!/bin/sh
+# -*- sh-basic-offset: 2 -*-
+
+##
+# Copyright (c) 2013 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;
+
+find_files () {
+ where="$1"; shift;
+
+ find "${where}" \
+ ! \( \
+ -type d \
+ \( \
+ -name .svn -o \
+ -name build -o \
+ -name data -o \
+ -name '_trial_temp*' \
+ \) \
+ -prune \
+ \) \
+ -type f \
+ ! -name '.#*' \
+ ! -name '#*#' \
+ ! -name '*~' \
+ ! -name '*.pyc' \
+ ! -name '*.log' \
+ ! -name update_copyrights \
+ -print0;
+}
+
+wd="$(cd "$(dirname "$0")/.." && pwd)";
+
+this_year="$(date "+%Y")";
+last_year=$((${this_year} - 1));
+
+tmp="$(mktemp -t "$$")";
+find_files "${wd}" > "${tmp}";
+
+ff () { cat "${tmp}"; }
+
+echo "Updating copyrights from ${last_year} to ${this_year}...";
+
+ff | xargs -0 perl -i -pe 's|(Copyright \(c\) .*-)'"${last_year}"'( Apple)|${1}'"${this_year}"'${2}|';
+ff | xargs -0 perl -i -pe 's|(Copyright \(c\) )'"${last_year}"'( Apple)|${1}'"${last_year}-${this_year}"'${2}|';
+
+ff | xargs -0 grep -e 'Copyright (c) .* Apple' \
+ | grep -v -e 'Copyright (c) .*'"${this_year}"' Apple' \
+ ;
+
+rm "${tmp}";
Property changes on: CalendarServer/trunk/bin/update_copyrights
___________________________________________________________________
Added: svn:executable
+ *
Deleted: CalendarServer/trunk/pydoctor
===================================================================
--- CalendarServer/trunk/pydoctor 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/pydoctor 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-##
-# 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 -P)";
-
-. "${wd}/support/build.sh";
-
-do_setup="false";
- do_get="false";
-
-dependencies;
-
-pydoctor "$@";
Deleted: CalendarServer/trunk/pyflakes
===================================================================
--- CalendarServer/trunk/pyflakes 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/pyflakes 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-set -e
-set -u
-
-wd="$(cd "$(dirname "$0")" && pwd)";
-
-if type -P pyflakes > /dev/null; then
- pyflakes="pyflakes";
-else
- flakes="$(cd "${wd}/../pyflakes-0.6.1" && pwd)";
- export PYTHONPATH="${flakes}:${PYTHONPATH:-}";
- pyflakes="${flakes}/bin/pyflakes";
-fi;
-
-if [ $# -eq 0 ]; then
- set - calendarserver twisted twistedcaldav txdav contrib;
-fi;
-
-tmp="$(mktemp "/tmp/pyflakes.XXXXX")";
-
-cd "${wd}" && "${pyflakes}" "$@" | sed \
- -e "/xmlext.py:[0-9][0-9]*: /d" \
- | tee "${tmp}";
-
-if [ -s "${tmp}" ]; then error="true"; else error="false"; fi;
-
-rm -f "${tmp}";
-
-if "${error}"; then exit 1; fi;
Deleted: CalendarServer/trunk/python
===================================================================
--- CalendarServer/trunk/python 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/python 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-
-wd="$(cd "$(dirname "$0")" && pwd)";
-
-. "${wd}/support/shell.sh"
-
-exec "${python}" "$@";
-
Added: CalendarServer/trunk/requirements/base.txt
===================================================================
--- CalendarServer/trunk/requirements/base.txt (rev 0)
+++ CalendarServer/trunk/requirements/base.txt 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1,26 @@
+zope.interface==4.0.5
+twisted==13.2.0
+-e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk#egg=twextpy [DAL]
+
+# Twisted <3's SSL
+pyOpenSSL==0.12
+pycrypto==2.6.1
+pyasn1==0.1.7
+
+-e svn+http://svn.calendarserver.org/repository/calendarserver/PyKerberos/trunk#egg=kerberos
+
+# Data store
+xattr==0.6.4
+PyGreSQL==4.1.1
+sqlparse==0.1.2
+
+# Calendar
+python-dateutil==1.5
+pytz==2013.8
+-e svn+http://svn.calendarserver.org/repository/calendarserver/PyCalendar/trunk#egg=pycalendar
+
+# Process info
+psutil==1.2.0
+setproctitle==1.1.8
+
+# pycparser==2.10
Property changes on: CalendarServer/trunk/requirements/base.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: CalendarServer/trunk/requirements/develop.txt
===================================================================
--- CalendarServer/trunk/requirements/develop.txt (rev 0)
+++ CalendarServer/trunk/requirements/develop.txt 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1 @@
+docutils>=0.11
Property changes on: CalendarServer/trunk/requirements/develop.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: CalendarServer/trunk/requirements/opt_LDAP.txt
===================================================================
--- CalendarServer/trunk/requirements/opt_LDAP.txt (rev 0)
+++ CalendarServer/trunk/requirements/opt_LDAP.txt 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1 @@
+-e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk#egg=twextpy [LDAP]
Property changes on: CalendarServer/trunk/requirements/opt_LDAP.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: CalendarServer/trunk/requirements/opt_Oracle.txt
===================================================================
--- CalendarServer/trunk/requirements/opt_Oracle.txt (rev 0)
+++ CalendarServer/trunk/requirements/opt_Oracle.txt 2014-01-24 01:46:22 UTC (rev 12439)
@@ -0,0 +1 @@
+-e svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk#egg=twextpy [Oracle]
Property changes on: CalendarServer/trunk/requirements/opt_Oracle.txt
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: CalendarServer/trunk/setup.py
===================================================================
--- CalendarServer/trunk/setup.py 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/setup.py 2014-01-24 01:46:22 UTC (rev 12439)
@@ -18,101 +18,189 @@
from __future__ import print_function
-import sys
-import os
+import errno
+from os import listdir, environ as environment
+from os.path import dirname, basename, abspath, join as joinpath, normpath
+from itertools import chain
+import subprocess
+from setuptools import setup, find_packages as setuptools_find_packages
+from pip.req import parse_requirements
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), "support"))
-from version import version
+#
+# Utilities
+#
-
def find_packages():
modules = [
"twisted.plugins",
]
- excludes = [
- ".svn",
- "_trial_temp",
- "build",
- ]
+ return modules + setuptools_find_packages()
- for root, dirs, files in os.walk("."):
- if root == ".":
- excludes.append("data")
- for exclude in excludes:
- if exclude in dirs:
- dirs.remove(exclude)
+def version():
+ """
+ Compute the version number.
+ """
- if "__init__.py" in files:
- modules.append(".".join(root.split(os.path.sep)[1:]))
+ base_version = "6.0"
- return modules
+ branches = tuple(
+ branch.format(
+ project="twext",
+ version=base_version,
+ )
+ for branch in (
+ "tags/release/{project}-{version}",
+ "branches/release/{project}-{version}-dev",
+ "trunk",
+ )
+ )
+ source_root = dirname(abspath(__file__))
+ for branch in branches:
+ cmd = ["svnversion", "-n", source_root, branch]
+
+ try:
+ svn_revision = subprocess.check_output(cmd)
+
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ full_version = base_version + "-unknown"
+ break
+ raise
+
+ if "S" in svn_revision:
+ continue
+
+ full_version = base_version
+
+ if branch == "trunk":
+ full_version += "b.trunk"
+ elif branch.endswith("-dev"):
+ full_version += "c.dev"
+
+ if svn_revision in ("exported", "Unversioned directory"):
+ full_version += "-unknown"
+ else:
+ full_version += "-r{revision}".format(revision=svn_revision)
+
+ break
+ else:
+ full_version += "a.unknown"
+ full_version += "-r{revision}".format(revision=svn_revision)
+
+ return full_version
+
+
+
#
# Options
#
-description = "Calendar and Contacts Server",
-long_description = """
-Calendar and Contacts Server, implementing the CalDAV and CardDAV protocols.
-"""
+description = "Calendar and Contacts Server"
-classifiers = None
+long_description = file(joinpath(dirname(__file__), "README.rst")).read()
+classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Framework :: Twisted",
+ "Intended Audience :: Information Technology",
+ "License :: OSI Approved :: Apache Software License",
+ "Operating System :: OS Independent",
+ "Programming Language :: Python :: 2.7",
+ "Programming Language :: Python :: 2 :: Only",
+ "Topic :: Communications",
+ "Topic :: Internet :: WWW/HTTP :: HTTP Servers",
+ "Topic :: Office/Business :: Groupware",
+ "Topic :: Office/Business :: Scheduling",
+]
+
+
#
-# Write version file
+# Dependencies
#
-version_number, version_info = version()
+requirements_dir = joinpath(dirname(__file__), "requirements")
-version_string = (
- "{number} ({info})"
- .format(number=version_number, info=version_info)
+
+def read_requirements(reqs_filename):
+ return [
+ str(r.req) for r in
+ parse_requirements(joinpath(requirements_dir, reqs_filename))
+ ]
+
+
+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")
)
-version_file = file(os.path.join("calendarserver", "version.py"), "w")
-version_file.write('version = "{version}"\n'.format(version=version_string))
-version_file.close()
+# Requirements for development and testing
+develop_requirements = read_requirements("develop.txt")
+if environment.get("CALENDARSERVER_DEVELOP", "false") == "true":
+ install_requirements.extend(develop_requirements)
+ install_requirements.extend(chain(*extras_requirements.values()))
+
+
+
#
# Set up Extension modules that need to be built
#
-from distutils.core import Extension
-
extensions = []
-if sys.platform == "darwin":
- extensions.append(
- Extension(
- "calendarserver.platform.darwin._sacl",
- extra_link_args=["-framework", "Security"],
- sources=["calendarserver/platform/darwin/_sacl.c"]
- )
- )
+# if sys.platform == "darwin":
+# extensions.append(
+# Extension(
+# "calendarserver.platform.darwin._sacl",
+# extra_link_args=["-framework", "Security"],
+# sources=["calendarserver/platform/darwin/_sacl.c"]
+# )
+# )
+
#
# Run setup
#
def doSetup():
- from distutils.core import setup
+ # Write version file
+ version_string = version()
+ version_filename = joinpath(
+ dirname(__file__), "calendarserver", "version.py"
+ )
+ version_file = file(version_filename, "w")
+ try:
+ version_file.write(
+ 'version = "{0}"\n\n'.format(version_string)
+ )
+ finally:
+ version_file.close()
+
+
+
dist = setup(
- name="Calendar and Contacts Server",
+ name="CalendarServer",
version=version_string,
description=description,
long_description=long_description,
url="http://www.calendarserver.org/",
classifiers=classifiers,
author="Apple Inc.",
- author_email=None,
+ author_email="calendarserver-dev at lists.macosforge.org",
license="Apache License, Version 2.0",
platforms=["all"],
packages=find_packages(),
@@ -161,29 +249,32 @@
"bin/calendarserver_upgrade",
# "bin/calendarserver_verify_data",
],
- data_files=[("caldavd", ["conf/caldavd.plist"]), ],
+ data_files=[
+ ("caldavd", ["conf/caldavd.plist"]),
+ ],
ext_modules=extensions,
py_modules=[],
+ setup_requires=setup_requirements,
+ install_requires=install_requirements,
+ extras_require=extras_requirements,
)
if "install" in dist.commands:
install_obj = dist.command_obj["install"]
if install_obj.root is None:
return
- install_scripts = os.path.normpath(install_obj.install_scripts)
- install_lib = os.path.normpath(install_obj.install_lib)
- root = os.path.normpath(install_obj.root)
- base = os.path.normpath(install_obj.install_base)
+ install_scripts = normpath(install_obj.install_scripts)
+ install_lib = normpath(install_obj.install_lib)
+ root = normpath(install_obj.root)
+ base = normpath(install_obj.install_base)
if root:
install_lib = install_lib[len(root):]
for script in dist.scripts:
- scriptPath = os.path.join(
- install_scripts, os.path.basename(script)
- )
+ scriptPath = joinpath(install_scripts, basename(script))
- print("rewriting {0}".format(scriptPath))
+ print("Rewriting {0}".format(scriptPath))
script = []
@@ -207,7 +298,7 @@
elif line == "#PATH":
script.append(
'PATH="{add}:$PATH"'
- .format(add=os.path.join(base, "usr", "bin"))
+ .format(add=joinpath(base, "usr", "bin"))
)
else:
script.append(line)
@@ -221,7 +312,7 @@
elif line == "#PATH":
script.append(
'PATH="{path}"'
- .format(path=os.path.join(base, "usr", "bin"))
+ .format(path=joinpath(base, "usr", "bin"))
)
else:
script.append(line)
Deleted: CalendarServer/trunk/support/update_copyrights
===================================================================
--- CalendarServer/trunk/support/update_copyrights 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/support/update_copyrights 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,66 +0,0 @@
-#!/bin/sh
-# -*- sh-basic-offset: 2 -*-
-
-##
-# Copyright (c) 2013 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;
-
-find_files () {
- where="$1"; shift;
-
- find "${where}" \
- ! \( \
- -type d \
- \( \
- -name .svn -o \
- -name build -o \
- -name data -o \
- -name '_trial_temp*' \
- \) \
- -prune \
- \) \
- -type f \
- ! -name '.#*' \
- ! -name '#*#' \
- ! -name '*~' \
- ! -name '*.pyc' \
- ! -name '*.log' \
- ! -name update_copyrights \
- -print0;
-}
-
-wd="$(cd "$(dirname "$0")/.." && pwd)";
-
-this_year="$(date "+%Y")";
-last_year=$((${this_year} - 1));
-
-tmp="$(mktemp -t "$$")";
-find_files "${wd}" > "${tmp}";
-
-ff () { cat "${tmp}"; }
-
-echo "Updating copyrights from ${last_year} to ${this_year}...";
-
-ff | xargs -0 perl -i -pe 's|(Copyright \(c\) .*-)'"${last_year}"'( Apple)|${1}'"${this_year}"'${2}|';
-ff | xargs -0 perl -i -pe 's|(Copyright \(c\) )'"${last_year}"'( Apple)|${1}'"${last_year}-${this_year}"'${2}|';
-
-ff | xargs -0 grep -e 'Copyright (c) .* Apple' \
- | grep -v -e 'Copyright (c) .*'"${this_year}"' Apple' \
- ;
-
-rm "${tmp}";
Deleted: CalendarServer/trunk/support/version.py
===================================================================
--- CalendarServer/trunk/support/version.py 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/support/version.py 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-
-##
-# Copyright (c) 2006-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.
-##
-from __future__ import print_function
-
-import os
-from os.path import dirname
-import subprocess
-
-def version():
- #
- # Compute the version number.
- #
-
- base_version = "6.0"
-
- branches = tuple(
- branch.format(version=base_version)
- for branch in (
- "tags/release/CalendarServer-{version}",
- "branches/release/CalendarServer-{version}-dev",
- "trunk",
- )
- )
-
- source_root = dirname(dirname(__file__))
-
- for branch in branches:
- svn_revision = subprocess.check_output(["svnversion", "-n", source_root, branch])
-
- if "S" in svn_revision:
- continue
-
- if branch == "trunk":
- base_version += "-trunk"
- elif branch.endswith("-dev"):
- base_version += "-dev"
-
- if svn_revision in ("exported", "Unversioned directory"):
- if os.environ.get("RC_XBS", None) == "YES":
- xbs_version = os.environ.get("RC_ProjectSourceVersion", "?")
- comment = "Apple Calendar Server {version}".format(version=xbs_version)
- else:
- comment = "unknown"
- else:
- comment = "r{revision}".format(revision=svn_revision)
-
- break
- else:
- base_version += "-unknown"
- comment = "r{revision}".format(revision=svn_revision)
-
- return (base_version, comment)
-
-if __name__ == "__main__":
- base_version, comment = version()
- print("{version} ({comment})".format(version=base_version, comment=comment))
Deleted: CalendarServer/trunk/test
===================================================================
--- CalendarServer/trunk/test 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/test 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,151 +0,0 @@
-#!/usr/bin/env bash
-
-##
-# 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 -L)";
-
-##
-# Options
-##
-
-do_setup="false";
-do_get="false";
-
-random="--random=$(date "+%s")";
-no_colour="";
-until_fail="";
-coverage="";
-m_twisted="";
-numjobs="";
-reactor="";
-
-if [ "$(uname -s)" == "Darwin" ]; then
- reactor="--reactor=kqueue";
-fi;
-
-usage ()
-{
- program="$(basename "$0")";
-
- if [ "${1--}" != "-" ]; then echo "$@"; echo; fi;
-
- echo "Usage: ${program} [options]";
- echo "Options:";
- echo " -h Print this help and exit";
- echo " -n Do not use color";
- echo " -o Do not run tests in random order.";
- echo " -r<num> Use specified seed to determine order.";
- echo " -u Run until the tests fail.";
- echo " -c Generate coverage reports.";
-
- if [ "${1-}" == "-" ]; then return 0; fi;
- exit 64;
-}
-
-while getopts "nhoucr:j:" option; do
- case "${option}" in
- '?') usage; ;;
- 'h') usage -; exit 0; ;;
- 'o') random=""; ;;
- 'r') random="--random=$OPTARG"; ;;
- 'n') no_colour="--reporter=bwverbose"; ;;
- 'u') until_fail="--until-failure"; ;;
- 'c') coverage="--coverage"; ;;
- 't') m_twisted="twisted"; ;;
- 'j') numjobs="-j $OPTARG"; ;;
- esac;
-done;
-shift $((${OPTIND} - 1));
-
-export PYTHONPATH="${wd}:${PYTHONPATH:-}";
-
-if [ $# -gt 0 ]; then
- test_modules="$@";
- flaky=true;
-else
- test_modules="calendarserver twistedcaldav txdav contrib ${m_twisted}";
- flaky=true;
-fi;
-
-
-##
-# Clean up
-##
-
-find "${wd}" -name \*.pyc -print0 | xargs -0 rm;
-
-
-##
-# Unit tests
-##
-
-mkdir -p "${wd}/data";
-cd "${wd}" && "${wd}/bin/trial" --temp-directory="${wd}/data/trial" --rterrors ${reactor} ${random} ${until_fail} ${no_colour} ${coverage} ${numjobs} ${test_modules};
-
-
-##
-# Code linting
-##
-
-if ${flaky}; then
- echo "";
- echo "Running pyflakes...";
- tmp="$(mktemp "/tmp/calendarserver_test_flakes.XXXXX")";
- cd "${wd}" && ./pyflakes ${test_modules} | tee "${tmp}" 2>&1;
- if [ -s "${tmp}" ]; then
- echo "**** Pyflakes says you have some code to clean up. ****";
- exit 1;
- fi;
- rm -f "${tmp}";
-fi;
-
-search_py ()
-{
- find . \
- ! '(' -type d '(' -path '*/.*' -or -name data ')' -prune ')' \
- -type f -name '*.py' \
- -print0 \
- | xargs -0 -n 100 grep "$@";
-}
-
-#tmp="$(mktemp "/tmp/calendarserver_test_flakish.XXXXX")";
-#echo "";
-#echo "Checking for legacy print statements..."
-#search_py 'print *[^(]' | sed 's|#.*||' | grep 'print *[^(]' > "${tmp}" || true;
-#if [ -s "${tmp}" ]; then
-# echo "**** Use of legacy print statement found. ****";
-# cat "${tmp}";
-# exit 1;
-#fi;
-#rm -f "${tmp}";
-
-
-##
-# Empty files
-##
-
-tmp="$(mktemp "/tmp/calendarserver_test_emtpy.XXXXX")";
-find "${wd}" '!' '(' -type d '(' -path '*/.*' -or -name data ')' -prune ')' -type f -size 0 > "${tmp}";
-if [ -s "${tmp}" ]; then
- echo "**** Empty files: ****";
- cat "${tmp}";
- exit 1;
-fi;
-rm -f "${tmp}";
Deleted: CalendarServer/trunk/testserver
===================================================================
--- CalendarServer/trunk/testserver 2014-01-24 01:43:49 UTC (rev 12438)
+++ CalendarServer/trunk/testserver 2014-01-24 01:46:22 UTC (rev 12439)
@@ -1,81 +0,0 @@
-#!/usr/bin/env bash
-
-##
-# 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.
-##
-
-wd="$(cd "$(dirname "$0")" && pwd)";
-cdt="${wd}/../CalDAVTester";
-
-##
-# Command line handling
-##
-
-verbose="";
-serverinfo="${cdt}/scripts/server/serverinfo.xml";
-printres="";
-subdir="";
-random="--random";
-seed="";
-ssl="";
-
-usage ()
-{
- program="$(basename "$0")";
- echo "Usage: ${program} [-v] [-s serverinfo]";
- echo "Options:";
- echo " -d Set the script subdirectory";
- echo " -h Print this help and exit";
- echo " -o Execute tests in order";
- echo " -r Print request and response";
- echo " -s Set the serverinfo.xml";
- echo " -t Set the CalDAVTester directory";
- echo " -x Random seed to use.";
- echo " -v Verbose.";
- echo " -z Use SSL.";
-
- if [ "${1-}" == "-" ]; then return 0; fi;
- exit 64;
-}
-
-while getopts 'hvrozt:s:d:x:' option; do
- case "$option" in
- '?') usage; ;;
- 'h') usage -; exit 0; ;;
- 't') cdt="${OPTARG}"; serverinfo="${OPTARG}/scripts/server/serverinfo.xml"; ;;
- 'd') subdir="--subdir=${OPTARG}"; ;;
- 's') serverinfo="${OPTARG}"; ;;
- 'r') printres="--always-print-request --always-print-response"; ;;
- 'v') verbose="v"; ;;
- 'o') random=""; ;;
- 'x') seed="--random-seed ${OPTARG}"; ;;
- 'z') ssl="--ssl"; ;;
- esac;
-done;
-
-shift $((${OPTIND} - 1));
-
-if [ $# == 0 ]; then
- set - "--all";
-fi;
-
-##
-# Do The Right Thing
-##
-
-source "${wd}/support/shell.sh";
-
-cd "${cdt}" && "${python}" testcaldav.py ${random} ${seed} ${ssl} --print-details-onfail ${printres} -s "${serverinfo}" ${subdir} "$@";
-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/391753a4/attachment.html>
More information about the calendarserver-changes
mailing list