Index: debian/changelog
===================================================================
--- debian/changelog	(revision 25021)
+++ debian/changelog	(working copy)
@@ -1,9 +1,13 @@
 cherrypy3 (3.2.2-3) UNRELEASED; urgency=low
 
+  [ Jakub Wilk ]
   * Use canonical URIs for Vcs-* fields.
   * Drop obsolete Conflicts with python2.3-cherrypy and python2.4-cherrypy.
   * Fix a typo in README.Debian.
 
+  [ Dmitrijs Ledkovs ]
+  * Add python3 package (Closes: #714403)
+
  -- Jakub Wilk <jwilk@debian.org>  Wed, 12 Jun 2013 13:11:12 +0200
 
 cherrypy3 (3.2.2-2) unstable; urgency=low
Index: debian/control
===================================================================
--- debian/control	(revision 25021)
+++ debian/control	(working copy)
@@ -34,3 +34,25 @@
  .
  This version is backwards incompatible with the 2.2 version in some
  ways. See http://www.cherrypy.org/wiki/UpgradeTo30.
+
+Package: python3-cherrypy3
+Architecture: all
+Depends: ${python3:Depends}, ${misc:Depends}
+Description: Python web development framework - version 3
+ CherryPy is a pythonic, object-oriented web development framework. It
+ provides the foundation over which complex web-based applications can
+ be written, with little or no knowledge of the underlying
+ protocols. CherryPy allows developers to build web applications in
+ much the same way they would build any other object-oriented Python
+ program. This usually results in smaller source code developed in
+ less time.
+ .
+ CherryPy is up-to-date with the latest developments on using Python
+ for web development: it features a bundled WSGI server, and is able
+ to integrate with other dispatching mechanisms, such as
+ Routes. CherryPy can be run as a standalone application, since it
+ provides its own HTTP server; setting it up behind another HTTP
+ server, such as Apache, or even with mod_python are also options.
+ .
+ This version is backwards incompatible with the 2.2 version in some
+ ways. See http://www.cherrypy.org/wiki/UpgradeTo30.
Index: debian/patches/02_compat.diff
===================================================================
--- debian/patches/02_compat.diff	(revision 0)
+++ debian/patches/02_compat.diff	(working copy)
@@ -0,0 +1,50 @@
+# HG changeset patch
+# User Jason R. Coombs <jaraco@jaraco.com>
+# Date 1349660887 14400
+# Branch cherrypy-3.2.x
+# Node ID 01b6adcb3849b2ff4fa31e3298b494f6b136369e
+# Parent  9820107d4ffb8058fd507888f90e28c695f6b4c0
+Timer class was renamed from _Timer to Timer in Python 3.3. This change adds a compatibility shim to detect this change and reference the base class accordingly. Fixes #1163.
+
+diff --git a/cherrypy/_cpcompat.py b/cherrypy/_cpcompat.py
+--- a/cherrypy/_cpcompat.py
++++ b/cherrypy/_cpcompat.py
+@@ -18,6 +18,7 @@
+ import os
+ import re
+ import sys
++import threading
+ 
+ if sys.version_info >= (3, 0):
+     py3k = True
+@@ -325,3 +326,9 @@
+     # Python 2
+     def next(i):
+         return i.next()
++
++if sys.version_info >= (3,3):
++    Timer = threading.Timer
++else:
++    # Python 3.2 and earlier
++    Timer = threading._Timer
+diff --git a/cherrypy/process/plugins.py b/cherrypy/process/plugins.py
+--- a/cherrypy/process/plugins.py
++++ b/cherrypy/process/plugins.py
+@@ -7,7 +7,7 @@
+ import time
+ import threading
+ 
+-from cherrypy._cpcompat import basestring, get_daemon, get_thread_ident, ntob, set
++from cherrypy._cpcompat import basestring, get_daemon, get_thread_ident, ntob, set, Timer
+ 
+ # _module__file__base is used by Autoreload to make
+ # absolute any filenames retrieved from sys.modules which are not
+@@ -421,7 +421,7 @@
+             pass
+ 
+ 
+-class PerpetualTimer(threading._Timer):
++class PerpetualTimer(Timer):
+     """A responsive subclass of threading._Timer whose run() method repeats.
+ 
+     Use this timer only when you really need a very interruptible timer;
Index: debian/patches/series
===================================================================
--- debian/patches/series	(revision 25021)
+++ debian/patches/series	(working copy)
@@ -1,2 +1,3 @@
 00_supress_profiler_warning.diff
 01_cherryd_location_fix.diff
+02_compat.diff
Index: debian/rules
===================================================================
--- debian/rules	(revision 25021)
+++ debian/rules	(working copy)
@@ -15,21 +15,17 @@
 	PYTHONPATH=. help2man -n cherryd -s 1 -o debian/cherryd.1 --version-string=$(UPSTREAM_VERSION)  ./cherrypy/cherryd
 	env PYTHONPATH=`pwd` epydoc --name CherryPy3 --url http://www.cherrypy.org/ -o api cherrypy
 	dh build --with=python2
+	python3 setup.py build
 
 
 install: build
-	dh install --with=python2 --before dh_python2
+	dh install --with=python2,python3 --before dh_python2
+	python3 setup.py install --root=$(CURDIR)/debian/python3-cherrypy3 --install-layout=deb
 
-	# the 'daemonization' helper should be made available properly
-	mv debian/python-cherrypy3/usr/lib/$(PY_DEFAULT)/*/cherrypy/cherryd \
-		debian/python-cherrypy3/usr/sbin/
-	chmod a+x debian/python-cherrypy3/usr/sbin/cherryd
-	rm -f debian/python-cherrypy3/usr/lib/*/*/cherrypy/cherryd
-
 	# no additional licensing files wanted =)
 	find debian/python-cherrypy3/ -name LICENSE.txt -exec rm {} \;
 
-	dh install --remaining --with=python2
+	dh install --remaining --with=python2,python3
 
 
 binary-indep: build install
