Upgrade cherrypy to 3.2.2 and upgrade python-utils.

All workstations outside the chroot and in the lab have cherrpy 3.2.2
already but we're behind in the chroot.

This CL also updates the python-utils eclass with the newest version
from portage-stable which is needed for cherrypy.

BUG=chromium:364138
TEST=Built cherrypy for all boards -- various devserver tests +
trybots.

Change-Id: Iee364887281362e349c587a78d0914054cf6cb93
Reviewed-on: https://chromium-review.googlesource.com/195241
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/dev-python/cherrypy/Manifest b/dev-python/cherrypy/Manifest
index bd2e615..b26313e 100644
--- a/dev-python/cherrypy/Manifest
+++ b/dev-python/cherrypy/Manifest
@@ -1 +1,6 @@
 DIST CherryPy-3.1.2.tar.gz 319196 RMD160 43a34bc7454da21b597c60124ff0fc61b8dc3e31 SHA1 a94aedfd0e675858dbcc32dd250c23d285ee9b88 SHA256 0dfd65507b047d54c09849e7a4b8bdd3616fa8776a5dbff7697cbf6ea1559bf6
+DIST CherryPy-2.3.0.tar.gz 241999 SHA256 a41e1b31ab723f50223b303991bb4e1a420a05deb2f4ab923a2ceadece4854cf SHA512 71359ff92354abc7c2156d0f66e361c16b145180e04bb14c9bb2ebae474de6a3c8a3b266363dd6df370c21b559112cbe122fcdf08d68f03f755000bb8ca4eca8 WHIRLPOOL a74b3fff30c776fb51f0dcec97e7f4e676a60a2791901ebf037abaf0e3cc59598b985e467dbabf712af013da8ca77c1925e6b53d65e523f7d535e8ecdcd6213a
+DIST CherryPy-3.2.0.tar.gz 921937 SHA256 0a70d163ee33b892df064ab70d097d0fc125c74fc0c6da418b2964bb1d6d18fe SHA512 3cdf8b65b819d1c3af08c68e12e8c972ba1c313432cb0c822993cb7f14dd8544a73e778a3fcc956667da1c51d224b4561f354a03eeba371d54cdea5369f5a27d WHIRLPOOL bb4c9858e45e0d44fc56446c1820dca0c0bf87b8ce133f6d158fe48b74afd3fb594ee8bd98dfca36cc6719efb6e896cf9f616433459acb379a12d0e32e0eb146
+DIST CherryPy-3.2.1.tar.gz 568070 SHA256 e1d1f51dd51ebf11efb157c36a4b8df4f5d5cb62af073b3ca50a9284ce83128d SHA512 8c8e5672bebfdcada7ffed17f2f160154db00d2c42b78b53277292c443495dfd2f8c07d2cbb1496c5cd39219b338e93e9efc8989ebcf04fcedc8f40beab97a8a WHIRLPOOL 22daf41e03854edbd53ceb711d002d0cb67f2c3df5319f347dc16d01d57058a7fe6b77abb3184fe77fbbb00777ab9947dc08d5dd06e585b71dc20b441833c6de
+DIST CherryPy-3.2.2.tar.gz 414099 SHA256 dc5a88562795c2ee462dac5b37aba1cf4f34f3e27281ec11049227039308b691 SHA512 89cebf63d48df5bec880bcbc13b3e2ae6da76f59c06803177cc8d6905e2d4444de7bb9a63189e3d6a3fd82e2a2464f419cfa74c60b2765e9ef89866847d55b7e WHIRLPOOL b9407b60d6138e00f1ead9367f973a34fd591ab858a836251a70c8df693f2d62cb06d4497b19e147fbd963bccf3ba9cafbf57dbacceb8241653d55400bfd2a7a
+DIST CherryPy-3.2.5.tar.gz 423774 SHA256 1a0ce16d06d9d3b587af6122b7b19c9a9ce521d51640d21a155626c9c76aa7e7 SHA512 562a8dbacf35dc64ba015ab01cdf076eb6c58a21df67fc9cb3936ff37f3d6dad6271595ba431920533f3cc6c6c10896d9a36e818fada70d87ae041d7f00d97d8 WHIRLPOOL 65aa21bbe77c720f999bc07d57dfe191a9eb96f8740c941b4bc0e3279fb863e2685bf8b0a388a7bf745993964c16117ed367eff371dc0e3dc4dee3bf13fc95cd
diff --git a/dev-python/cherrypy/cherrypy-3.1.2.ebuild b/dev-python/cherrypy/cherrypy-3.1.2.ebuild
deleted file mode 100644
index 5785742..0000000
--- a/dev-python/cherrypy/cherrypy-3.1.2.ebuild
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 1999-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-python/cherrypy/cherrypy-3.1.2.ebuild,v 1.8 2010/11/14 21:06:25 arfrever Exp $
-
-EAPI="3"
-PYTHON_DEPEND="2"
-SUPPORT_PYTHON_ABIS="1"
-RESTRICT_PYTHON_ABIS="3.*"
-
-inherit distutils
-
-MY_P="CherryPy-${PV}"
-
-DESCRIPTION="CherryPy is a pythonic, object-oriented HTTP framework"
-HOMEPAGE="http://www.cherrypy.org/ http://pypi.python.org/pypi/CherryPy"
-SRC_URI="http://download.cherrypy.org/${PN}/${PV}/${MY_P}.tar.gz"
-
-LICENSE="BSD"
-SLOT="0"
-KEYWORDS="*"
-IUSE="doc"
-
-DEPEND=""
-RDEPEND=""
-
-S="${WORKDIR}/${MY_P}"
-
-src_prepare() {
-	sed -i \
-		-e 's/"cherrypy.tutorial",//' \
-		-e "/('cherrypy\/tutorial',/, /),/d" \
-		setup.py || die "sed failed"
-}
-
-src_test() {
-	testing() {
-		PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" cherrypy/test/test.py --dumb
-	}
-	python_execute_function testing
-}
-
-src_install() {
-	distutils_src_install
-
-	if use doc; then
-		insinto /usr/share/doc/${PF}
-		doins -r cherrypy/tutorial
-	fi
-}
diff --git a/dev-python/cherrypy/cherrypy-3.2.2-r1.ebuild b/dev-python/cherrypy/cherrypy-3.2.2-r1.ebuild
new file mode 100644
index 0000000..bd904da
--- /dev/null
+++ b/dev-python/cherrypy/cherrypy-3.2.2-r1.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/cherrypy/cherrypy-3.2.2-r1.ebuild,v 1.10 2014/03/31 20:48:31 mgorny Exp $
+
+EAPI=5
+PYTHON_COMPAT=( python{2_6,2_7,3_2} pypy pypy2_0 )
+
+inherit distutils-r1
+
+MY_P="CherryPy-${PV}"
+
+DESCRIPTION="CherryPy is a pythonic, object-oriented HTTP framework"
+HOMEPAGE="http://www.cherrypy.org/ http://pypi.python.org/pypi/CherryPy"
+SRC_URI="http://download.cherrypy.org/${PN}/${PV}/${MY_P}.tar.gz"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="*"
+IUSE="test"
+
+DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
+	test? ( dev-python/nose[${PYTHON_USEDEP}] )"
+RDEPEND=""
+S="${WORKDIR}/${MY_P}"
+# Both req'd for test phase
+DISTUTILS_IN_SOURCE_BUILD=1
+DISTUTILS_NO_PARALLEL_BUILD=1
+
+python_prepare_all() {
+	sed -e 's:test_file_stream:_&:' -i cherrypy/test/test_static.py || die
+	distutils-r1_python_prepare_all
+}
+
+python_test() {
+	# https://bitbucket.org/cherrypy/cherrypy/issue/1308/testsuite-failures-x-5-test_file_stream
+	if python_is_python3; then
+		sed -e 's:test_HTTP11_pipelining:_&:' -i cherrypy/test/test_conn.py || die
+	elif [[ "${EPYTHON}" == "pypy-c2.0" || "${EPYTHON}" == "pypy-c" ]]; then
+		einfo "done"
+		sed -e 's:testEscapedOutput:_&:' \
+			-e 's:testNormalReturn:_&:' \
+			-e 's:testTracebacks:_&:' \
+			-e 's:testNormalYield:_&:' \
+			-i cherrypy/test/test_logging.py || die
+	fi
+	# This really doesn't sit well with multiprocessing
+	nosetests < /dev/tty || die "Testing failed with ${EPYTHON}"
+}
diff --git a/dev-python/cherrypy/files/cherrypy-3.2.5-issue1234.patch b/dev-python/cherrypy/files/cherrypy-3.2.5-issue1234.patch
new file mode 100644
index 0000000..fd76c5e
--- /dev/null
+++ b/dev-python/cherrypy/files/cherrypy-3.2.5-issue1234.patch
@@ -0,0 +1,10 @@
+https://bitbucket.org/cherrypy/cherrypy/issue/1234
+
+--- cherrypy/test/test_tools.py
++++ cherrypy/test/test_tools.py
+@@ -407,4 +407,4 @@
+         sa = cherrypy.lib.cptools.SessionAuth()
+         res = sa.login_screen(None, username=unicodestr('nobody'),
+             password=unicodestr('anypass'))
+-        self.assertIsInstance(res, bytestr)
++        self.assertTrue(isinstance(res, bytestr))
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 1c4994a..0445ce8 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.45 2013/10/30 19:14:02 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.53 2014/04/08 16:05:30 mgorny Exp $
 
 # @ECLASS: python-utils-r1
 # @MAINTAINER:
@@ -10,7 +10,7 @@
 # Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
 # @BLURB: Utility functions for packages with Python parts.
 # @DESCRIPTION:
-# An utility eclass providing functions to query Python implementations,
+# A utility eclass providing functions to query Python implementations,
 # install Python modules and scripts.
 #
 # This eclass does not set any metadata variables nor export any phase
@@ -41,8 +41,8 @@
 # All supported Python implementations, most preferred last.
 _PYTHON_ALL_IMPLS=(
 	jython2_5 jython2_7
-	pypy2_0
-	python3_2 python3_3
+	pypy
+	python3_2 python3_3 python3_4
 	python2_6 python2_7
 )
 
@@ -66,12 +66,17 @@
 	# keep in sync with _PYTHON_ALL_IMPLS!
 	# (not using that list because inline patterns shall be faster)
 	case "${impl}" in
-		python2_[67]|python3_[23]|pypy2_0|jython2_[57])
+		python2_[67]|python3_[234]|jython2_[57])
 			return 0
 			;;
-		pypy1_[89]|python2_5|python3_1)
+		pypy1_[89]|pypy2_0|python2_5|python3_1)
 			return 1
 			;;
+		pypy)
+			if [[ ${EAPI:-0} == [01234] ]]; then
+				die "PyPy is supported in EAPI 5 and newer only."
+			fi
+			;;
 		*)
 			die "Invalid implementation in PYTHON_COMPAT: ${impl}"
 	esac
@@ -230,15 +235,10 @@
 			impl=${1/_/.}
 			shift
 			;;
-		pypy-c*)
+		pypy)
 			impl=${1}
 			shift
 			;;
-		pypy*)
-			local v=${1#pypy}
-			impl=pypy-c${v/_/.}
-			shift
-			;;
 		*)
 			impl=${EPYTHON}
 			[[ ${impl} ]] || die "python_export: no impl nor EPYTHON"
@@ -259,15 +259,12 @@
 			PYTHON_SITEDIR)
 				local dir
 				case "${impl}" in
-					python*)
+					python*|pypy)
 						dir=/usr/$(get_libdir)/${impl}
 						;;
 					jython*)
 						dir=/usr/share/${impl/n/n-}/Lib
 						;;
-					pypy*)
-						dir=/usr/$(get_libdir)/${impl/-c/}
-						;;
 				esac
 
 				export PYTHON_SITEDIR=${EPREFIX}${dir}/site-packages
@@ -279,8 +276,8 @@
 					python*)
 						dir=/usr/include/${impl}
 						;;
-					pypy*)
-						dir=/usr/$(get_libdir)/${impl/-c/}/include
+					pypy)
+						dir=/usr/$(get_libdir)/${impl}/include
 						;;
 					*)
 						die "${impl} lacks header files"
@@ -357,8 +354,10 @@
 						PYTHON_PKG_DEP='>=dev-lang/python-3.2.5-r2:3.2';;
 					python3.3)
 						PYTHON_PKG_DEP='>=dev-lang/python-3.3.2-r2:3.3';;
-					pypy-c2.0)
-						PYTHON_PKG_DEP='>=virtual/pypy-2.0.2:2.0';;
+					python*)
+						PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
+					pypy)
+						PYTHON_PKG_DEP='virtual/pypy:0=';;
 					jython2.5)
 						PYTHON_PKG_DEP='>=dev-java/jython-2.5.3-r2:2.5';;
 					jython2.7)
@@ -504,7 +503,7 @@
 
 	local impl
 	case "${1}" in
-		python*|jython*|pypy-c*)
+		python*|jython*|pypy*)
 			impl=${1}
 			shift
 			;;
@@ -681,49 +680,32 @@
 	python_scriptroot=${1}
 }
 
-# @FUNCTION: python_doscript
+# @FUNCTION: python_doexe
 # @USAGE: <files>...
 # @DESCRIPTION:
-# Install the given scripts into current python_scriptroot,
+# Install the given executables into current python_scriptroot,
 # for the current Python implementation (${EPYTHON}).
 #
-# All specified files must start with a 'python' shebang. The shebang
-# will be converted, the file will be renamed to be EPYTHON-suffixed
-# and a wrapper will be installed in place of the original name.
-#
-# Example:
-# @CODE
-# src_install() {
-#   python_foreach_impl python_doscript ${PN}
-# }
-# @CODE
-python_doscript() {
+# The executable will be wrapped properly for the Python implementation,
+# though no shebang mangling will be performed.
+python_doexe() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	local f
 	for f; do
-		python_newscript "${f}" "${f##*/}"
+		python_newexe "${f}" "${f##*/}"
 	done
 }
 
-# @FUNCTION: python_newscript
+# @FUNCTION: python_newexe
 # @USAGE: <path> <new-name>
-# @DESCRIPTION:
-# Install the given script into current python_scriptroot
-# for the current Python implementation (${EPYTHON}), and name it
-# <new-name>.
+# Install the given executable into current python_scriptroot,
+# for the current Python implementation (${EPYTHON}).
 #
-# The file must start with a 'python' shebang. The shebang will be
-# converted, the file will be renamed to be EPYTHON-suffixed
-# and a wrapper will be installed in place of the <new-name>.
-#
-# Example:
-# @CODE
-# src_install() {
-#   python_foreach_impl python_newscript foo.py foo
-# }
-# @CODE
-python_newscript() {
+# The executable will be wrapped properly for the Python implementation,
+# though no shebang mangling will be performed. It will be renamed
+# to <new-name>.
+python_newexe() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
@@ -750,11 +732,62 @@
 		exeinto "${d}"
 		newexe "${f}" "${newfn}" || die
 	)
-	_python_rewrite_shebang "${ED%/}/${d}/${newfn}"
 
 	# install the wrapper
 	_python_ln_rel "${ED%/}"$(_python_get_wrapper_path) \
 		"${ED%/}/${wrapd}/${barefn}" || die
+
+	# don't use this at home, just call python_doscript() instead
+	if [[ ${_PYTHON_REWRITE_SHEBANG} ]]; then
+		_python_rewrite_shebang "${ED%/}/${d}/${newfn}"
+	fi
+}
+
+# @FUNCTION: python_doscript
+# @USAGE: <files>...
+# @DESCRIPTION:
+# Install the given scripts into current python_scriptroot,
+# for the current Python implementation (${EPYTHON}).
+#
+# All specified files must start with a 'python' shebang. The shebang
+# will be converted, and the files will be wrapped properly
+# for the Python implementation.
+#
+# Example:
+# @CODE
+# src_install() {
+#   python_foreach_impl python_doscript ${PN}
+# }
+# @CODE
+python_doscript() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local _PYTHON_REWRITE_SHEBANG=1
+	python_doexe "${@}"
+}
+
+# @FUNCTION: python_newscript
+# @USAGE: <path> <new-name>
+# @DESCRIPTION:
+# Install the given script into current python_scriptroot
+# for the current Python implementation (${EPYTHON}), and name it
+# <new-name>.
+#
+# The file must start with a 'python' shebang. The shebang will be
+# converted, and the file will be wrapped properly for the Python
+# implementation. It will be renamed to <new-name>.
+#
+# Example:
+# @CODE
+# src_install() {
+#   python_foreach_impl python_newscript foo.py foo
+# }
+# @CODE
+python_newscript() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	local _PYTHON_REWRITE_SHEBANG=1
+	python_newexe "${@}"
 }
 
 # @ECLASS-VARIABLE: python_moduleroot