summaryrefslogtreecommitdiff
path: root/community/python2-cherrypy
diff options
context:
space:
mode:
authorroot <root@rshg047.dnsready.net>2011-05-01 22:33:26 +0000
committerroot <root@rshg047.dnsready.net>2011-05-01 22:33:26 +0000
commit40f0b1c7106cc1fed13f14e80f083ecd69c416f5 (patch)
treefaeb03af48db54c663f74f3f188b9c1c56ca6a0b /community/python2-cherrypy
parentc173ac862828a54925737fc1d90ede1dd09a312c (diff)
Sun May 1 22:33:26 UTC 2011
Diffstat (limited to 'community/python2-cherrypy')
-rw-r--r--community/python2-cherrypy/837.2049.patch554
-rw-r--r--community/python2-cherrypy/ChangeLog26
-rw-r--r--community/python2-cherrypy/PKGBUILD23
-rw-r--r--community/python2-cherrypy/license25
4 files changed, 628 insertions, 0 deletions
diff --git a/community/python2-cherrypy/837.2049.patch b/community/python2-cherrypy/837.2049.patch
new file mode 100644
index 000000000..20cc0dd36
--- /dev/null
+++ b/community/python2-cherrypy/837.2049.patch
@@ -0,0 +1,554 @@
+Index: cherrypy/test/test_tools.py
+===================================================================
+--- cherrypy/test/test_tools.py (revision 2049)
++++ cherrypy/test/test_tools.py (working copy)
+@@ -3,6 +3,7 @@
+ import gzip
+ import StringIO
+ import sys
++from httplib import IncompleteRead
+ import time
+ timeout = 0.2
+
+@@ -272,8 +273,12 @@
+ # Because this error is raised after the response body has
+ # started, and because it's chunked output, an error is raised by
+ # the HTTP client when it encounters incomplete output.
+- self.assertRaises(ValueError, self.getPage,
+- "/demo/errinstream?id=5")
++ if sys.version_info[:2] >= (2, 6):
++ self.assertRaises(IncompleteRead, self.getPage,
++ "/demo/errinstream?id=5")
++ else:
++ self.assertRaises(ValueError, self.getPage,
++ "/demo/errinstream?id=5")
+ # If this fails, then on_end_request isn't being called at all.
+ time.sleep(0.1)
+ self.getPage("/demo/ended/5")
+Index: cherrypy/test/webtest.py
+===================================================================
+--- cherrypy/test/webtest.py (revision 2049)
++++ cherrypy/test/webtest.py (working copy)
+@@ -491,7 +491,7 @@
+ # IN6ADDR_ANY, which should respond on localhost.
+ host = "::1"
+ conn = http_conn(host, port)
+-
++
+ conn._http_vsn_str = protocol
+ conn._http_vsn = int("".join([x for x in protocol if x.isdigit()]))
+
+Index: cherrypy/test/test_encoding.py
+===================================================================
+--- cherrypy/test/test_encoding.py (revision 2049)
++++ cherrypy/test/test_encoding.py (working copy)
+@@ -1,7 +1,9 @@
+ from cherrypy.test import test
+ test.prefer_parent_path()
+
++import sys
+ import gzip, StringIO
++from httplib import IncompleteRead
+ import cherrypy
+ europoundUnicode = u'\x80\xa3'
+ europoundUtf8 = u'\x80\xa3'.encode('utf-8')
+@@ -160,10 +162,13 @@
+ else:
+ # The wsgiserver will simply stop sending data, and the HTTP client
+ # will error due to an incomplete chunk-encoded stream.
+- self.assertRaises(ValueError, self.getPage, '/gzip/noshow_stream',
+- headers=[("Accept-Encoding", "gzip")])
++ if sys.version_info[:2] >= (2, 6):
++ self.assertRaises(IncompleteRead, self.getPage, '/gzip/noshow_stream',
++ headers=[("Accept-Encoding", "gzip")])
++ else:
++ self.assertRaises(ValueError, self.getPage, '/gzip/noshow_stream',
++ headers=[("Accept-Encoding", "gzip")])
+
+-
+ if __name__ == "__main__":
+ setup_server()
+ helper.testmain()
+Index: cherrypy/test/test_core.py
+===================================================================
+--- cherrypy/test/test_core.py (revision 2049)
++++ cherrypy/test/test_core.py (working copy)
+@@ -7,6 +7,7 @@
+ localDir = os.path.dirname(__file__)
+ import sys
+ import types
++from httplib import IncompleteRead
+
+ import cherrypy
+ from cherrypy import _cptools, tools
+@@ -760,8 +761,12 @@
+ else:
+ # Under HTTP/1.1, the chunked transfer-coding is used.
+ # The HTTP client will choke when the output is incomplete.
+- self.assertRaises(ValueError, self.getPage,
+- "/error/page_streamed")
++ if sys.version_info[:2] >= (2, 6):
++ self.assertRaises(IncompleteRead, self.getPage,
++ "/error/page_streamed")
++ else:
++ self.assertRaises(ValueError, self.getPage,
++ "/error/page_streamed")
+
+ # No traceback should be present
+ self.getPage("/error/cause_err_in_finalize")
+Index: cherrypy/wsgiserver/__init__.py
+===================================================================
+--- cherrypy/wsgiserver/__init__.py (revision 2049)
++++ cherrypy/wsgiserver/__init__.py (working copy)
+@@ -713,148 +713,325 @@
+ """Exception raised when the SSL implementation signals a fatal alert."""
+ pass
+
++if sys.version_info[:2] >= (2, 6) or sys.version_info[:3] >= (2, 5, 2):
++ class CP_fileobject(socket._fileobject):
++ """Faux file object attached to a socket object."""
+
+-class CP_fileobject(socket._fileobject):
+- """Faux file object attached to a socket object."""
+-
+- def sendall(self, data):
+- """Sendall for non-blocking sockets."""
+- while data:
+- try:
+- bytes_sent = self.send(data)
+- data = data[bytes_sent:]
+- except socket.error, e:
+- if e.args[0] not in socket_errors_nonblocking:
+- raise
+-
+- def send(self, data):
+- return self._sock.send(data)
+-
+- def flush(self):
+- if self._wbuf:
+- buffer = "".join(self._wbuf)
+- self._wbuf = []
+- self.sendall(buffer)
+-
+- def recv(self, size):
+- while True:
+- try:
+- return self._sock.recv(size)
+- except socket.error, e:
+- if e.args[0] not in socket_errors_nonblocking:
+- raise
+-
+- def read(self, size=-1):
+- if size < 0:
+- # Read until EOF
+- buffers = [self._rbuf]
+- self._rbuf = ""
+- if self._rbufsize <= 1:
+- recv_size = self.default_bufsize
++ def sendall(self, data):
++ """Sendall for non-blocking sockets."""
++ while data:
++ try:
++ bytes_sent = self.send(data)
++ data = data[bytes_sent:]
++ except socket.error, e:
++ if e.args[0] not in socket_errors_nonblocking:
++ raise
++
++ def send(self, data):
++ return self._sock.send(data)
++
++ def flush(self):
++ if self._wbuf:
++ buffer = "".join(self._wbuf)
++ self._wbuf = []
++ self.sendall(buffer)
++
++ def recv(self, size):
++ while True:
++ try:
++ return self._sock.recv(size)
++ except socket.error, e:
++ if e.args[0] not in socket_errors_nonblocking:
++ raise
++
++ def read(self, size=-1):
++ # Use max, disallow tiny reads in a loop as they are very inefficient.
++ # We never leave read() with any leftover data from a new recv() call
++ # in our internal buffer.
++ rbufsize = max(self._rbufsize, self.default_bufsize)
++ # Our use of StringIO rather than lists of string objects returned by
++ # recv() minimizes memory usage and fragmentation that occurs when
++ # rbufsize is large compared to the typical return value of recv().
++ buf = self._rbuf
++ buf.seek(0, 2) # seek end
++ if size < 0:
++ # Read until EOF
++ self._rbuf = StringIO.StringIO() # reset _rbuf. we consume it via buf.
++ while True:
++ data = self.recv(rbufsize)
++ if not data:
++ break
++ buf.write(data)
++ return buf.getvalue()
+ else:
+- recv_size = self._rbufsize
+-
++ # Read until size bytes or EOF seen, whichever comes first
++ buf_len = buf.tell()
++ if buf_len >= size:
++ # Already have size bytes in our buffer? Extract and return.
++ buf.seek(0)
++ rv = buf.read(size)
++ self._rbuf = StringIO.StringIO()
++ self._rbuf.write(buf.read())
++ return rv
++
++ self._rbuf = StringIO.StringIO() # reset _rbuf. we consume it via buf.
++ while True:
++ left = size - buf_len
++ # recv() will malloc the amount of memory given as its
++ # parameter even though it often returns much less data
++ # than that. The returned data string is short lived
++ # as we copy it into a StringIO and free it. This avoids
++ # fragmentation issues on many platforms.
++ data = self.recv(left)
++ if not data:
++ break
++ n = len(data)
++ if n == size and not buf_len:
++ # Shortcut. Avoid buffer data copies when:
++ # - We have no data in our buffer.
++ # AND
++ # - Our call to recv returned exactly the
++ # number of bytes we were asked to read.
++ return data
++ if n == left:
++ buf.write(data)
++ del data # explicit free
++ break
++ assert n <= left, "recv(%d) returned %d bytes" % (left, n)
++ buf.write(data)
++ buf_len += n
++ del data # explicit free
++ #assert buf_len == buf.tell()
++ return buf.getvalue()
++
++ def readline(self, size=-1):
++ buf = self._rbuf
++ buf.seek(0, 2) # seek end
++ if buf.tell() > 0:
++ # check if we already have it in our buffer
++ buf.seek(0)
++ bline = buf.readline(size)
++ if bline.endswith('\n') or len(bline) == size:
++ self._rbuf = StringIO.StringIO()
++ self._rbuf.write(buf.read())
++ return bline
++ del bline
++ if size < 0:
++ # Read until \n or EOF, whichever comes first
++ if self._rbufsize <= 1:
++ # Speed up unbuffered case
++ buf.seek(0)
++ buffers = [buf.read()]
++ self._rbuf = StringIO.StringIO() # reset _rbuf. we consume it via buf.
++ data = None
++ recv = self.recv
++ while data != "\n":
++ data = recv(1)
++ if not data:
++ break
++ buffers.append(data)
++ return "".join(buffers)
++
++ buf.seek(0, 2) # seek end
++ self._rbuf = StringIO.StringIO() # reset _rbuf. we consume it via buf.
++ while True:
++ data = self.recv(self._rbufsize)
++ if not data:
++ break
++ nl = data.find('\n')
++ if nl >= 0:
++ nl += 1
++ buf.write(data[:nl])
++ self._rbuf.write(data[nl:])
++ del data
++ break
++ buf.write(data)
++ return buf.getvalue()
++ else:
++ # Read until size bytes or \n or EOF seen, whichever comes first
++ buf.seek(0, 2) # seek end
++ buf_len = buf.tell()
++ if buf_len >= size:
++ buf.seek(0)
++ rv = buf.read(size)
++ self._rbuf = StringIO.StringIO()
++ self._rbuf.write(buf.read())
++ return rv
++ self._rbuf = StringIO.StringIO() # reset _rbuf. we consume it via buf.
++ while True:
++ data = self.recv(self._rbufsize)
++ if not data:
++ break
++ left = size - buf_len
++ # did we just receive a newline?
++ nl = data.find('\n', 0, left)
++ if nl >= 0:
++ nl += 1
++ # save the excess data to _rbuf
++ self._rbuf.write(data[nl:])
++ if buf_len:
++ buf.write(data[:nl])
++ break
++ else:
++ # Shortcut. Avoid data copy through buf when returning
++ # a substring of our first recv().
++ return data[:nl]
++ n = len(data)
++ if n == size and not buf_len:
++ # Shortcut. Avoid data copy through buf when
++ # returning exactly all of our first recv().
++ return data
++ if n >= left:
++ buf.write(data[:left])
++ self._rbuf.write(data[left:])
++ break
++ buf.write(data)
++ buf_len += n
++ #assert buf_len == buf.tell()
++ return buf.getvalue()
++
++else:
++ class CP_fileobject(socket._fileobject):
++ """Faux file object attached to a socket object."""
++
++ def sendall(self, data):
++ """Sendall for non-blocking sockets."""
++ while data:
++ try:
++ bytes_sent = self.send(data)
++ data = data[bytes_sent:]
++ except socket.error, e:
++ if e.args[0] not in socket_errors_nonblocking:
++ raise
++
++ def send(self, data):
++ return self._sock.send(data)
++
++ def flush(self):
++ if self._wbuf:
++ buffer = "".join(self._wbuf)
++ self._wbuf = []
++ self.sendall(buffer)
++
++ def recv(self, size):
+ while True:
+- data = self.recv(recv_size)
+- if not data:
+- break
+- buffers.append(data)
+- return "".join(buffers)
+- else:
+- # Read until size bytes or EOF seen, whichever comes first
+- data = self._rbuf
+- buf_len = len(data)
+- if buf_len >= size:
+- self._rbuf = data[size:]
+- return data[:size]
+- buffers = []
+- if data:
+- buffers.append(data)
+- self._rbuf = ""
+- while True:
+- left = size - buf_len
+- recv_size = max(self._rbufsize, left)
+- data = self.recv(recv_size)
+- if not data:
+- break
+- buffers.append(data)
+- n = len(data)
+- if n >= left:
+- self._rbuf = data[left:]
+- buffers[-1] = data[:left]
+- break
+- buf_len += n
+- return "".join(buffers)
++ try:
++ return self._sock.recv(size)
++ except socket.error, e:
++ if e.args[0] not in socket_errors_nonblocking:
++ raise
+
+- def readline(self, size=-1):
+- data = self._rbuf
+- if size < 0:
+- # Read until \n or EOF, whichever comes first
+- if self._rbufsize <= 1:
+- # Speed up unbuffered case
+- assert data == ""
++ def read(self, size=-1):
++ if size < 0:
++ # Read until EOF
++ buffers = [self._rbuf]
++ self._rbuf = ""
++ if self._rbufsize <= 1:
++ recv_size = self.default_bufsize
++ else:
++ recv_size = self._rbufsize
++
++ while True:
++ data = self.recv(recv_size)
++ if not data:
++ break
++ buffers.append(data)
++ return "".join(buffers)
++ else:
++ # Read until size bytes or EOF seen, whichever comes first
++ data = self._rbuf
++ buf_len = len(data)
++ if buf_len >= size:
++ self._rbuf = data[size:]
++ return data[:size]
+ buffers = []
+- while data != "\n":
+- data = self.recv(1)
++ if data:
++ buffers.append(data)
++ self._rbuf = ""
++ while True:
++ left = size - buf_len
++ recv_size = max(self._rbufsize, left)
++ data = self.recv(recv_size)
+ if not data:
+ break
+ buffers.append(data)
++ n = len(data)
++ if n >= left:
++ self._rbuf = data[left:]
++ buffers[-1] = data[:left]
++ break
++ buf_len += n
+ return "".join(buffers)
+- nl = data.find('\n')
+- if nl >= 0:
+- nl += 1
+- self._rbuf = data[nl:]
+- return data[:nl]
+- buffers = []
+- if data:
+- buffers.append(data)
+- self._rbuf = ""
+- while True:
+- data = self.recv(self._rbufsize)
+- if not data:
+- break
+- buffers.append(data)
++
++ def readline(self, size=-1):
++ data = self._rbuf
++ if size < 0:
++ # Read until \n or EOF, whichever comes first
++ if self._rbufsize <= 1:
++ # Speed up unbuffered case
++ assert data == ""
++ buffers = []
++ while data != "\n":
++ data = self.recv(1)
++ if not data:
++ break
++ buffers.append(data)
++ return "".join(buffers)
+ nl = data.find('\n')
+ if nl >= 0:
+ nl += 1
+ self._rbuf = data[nl:]
+- buffers[-1] = data[:nl]
+- break
+- return "".join(buffers)
+- else:
+- # Read until size bytes or \n or EOF seen, whichever comes first
+- nl = data.find('\n', 0, size)
+- if nl >= 0:
+- nl += 1
+- self._rbuf = data[nl:]
+- return data[:nl]
+- buf_len = len(data)
+- if buf_len >= size:
+- self._rbuf = data[size:]
+- return data[:size]
+- buffers = []
+- if data:
+- buffers.append(data)
+- self._rbuf = ""
+- while True:
+- data = self.recv(self._rbufsize)
+- if not data:
+- break
+- buffers.append(data)
+- left = size - buf_len
+- nl = data.find('\n', 0, left)
++ return data[:nl]
++ buffers = []
++ if data:
++ buffers.append(data)
++ self._rbuf = ""
++ while True:
++ data = self.recv(self._rbufsize)
++ if not data:
++ break
++ buffers.append(data)
++ nl = data.find('\n')
++ if nl >= 0:
++ nl += 1
++ self._rbuf = data[nl:]
++ buffers[-1] = data[:nl]
++ break
++ return "".join(buffers)
++ else:
++ # Read until size bytes or \n or EOF seen, whichever comes first
++ nl = data.find('\n', 0, size)
+ if nl >= 0:
+ nl += 1
+ self._rbuf = data[nl:]
+- buffers[-1] = data[:nl]
+- break
+- n = len(data)
+- if n >= left:
+- self._rbuf = data[left:]
+- buffers[-1] = data[:left]
+- break
+- buf_len += n
+- return "".join(buffers)
++ return data[:nl]
++ buf_len = len(data)
++ if buf_len >= size:
++ self._rbuf = data[size:]
++ return data[:size]
++ buffers = []
++ if data:
++ buffers.append(data)
++ self._rbuf = ""
++ while True:
++ data = self.recv(self._rbufsize)
++ if not data:
++ break
++ buffers.append(data)
++ left = size - buf_len
++ nl = data.find('\n', 0, left)
++ if nl >= 0:
++ nl += 1
++ self._rbuf = data[nl:]
++ buffers[-1] = data[:nl]
++ break
++ n = len(data)
++ if n >= left:
++ self._rbuf = data[left:]
++ buffers[-1] = data[:left]
++ break
++ buf_len += n
++ return "".join(buffers)
+
+
+ class SSL_fileobject(CP_fileobject):
diff --git a/community/python2-cherrypy/ChangeLog b/community/python2-cherrypy/ChangeLog
new file mode 100644
index 000000000..90276417c
--- /dev/null
+++ b/community/python2-cherrypy/ChangeLog
@@ -0,0 +1,26 @@
+
+2009-04-15 Douglas Soares de Andrade <douglas@archlinux.org>
+
+ * Updated for i686: 3.1.2
+
+2008-12-14 Douglas Soares de Andrade <douglas@archlinux.org>
+
+ * Updated for i686: 3.1.1
+
+2008-11-04 Douglas Soares de Andrade <douglas@archlinux.org>
+
+ * Updated for python 2.6
+ * Thanks to David Moore
+
+2008-07-09 Mateusz Herych <heniekk@gmail.com>
+
+ * Updating for x86_64: 3.1.0
+
+2008-07-09 Douglas Soares de Andrade <douglas@archlinux.org>
+
+ * Updating for i686: 3.1.0
+
+2008-02-28 Douglas Soares de Andrade <dsa@aur.archlinux.org>
+
+ * Updating in i686: 3.0.3
+
diff --git a/community/python2-cherrypy/PKGBUILD b/community/python2-cherrypy/PKGBUILD
new file mode 100644
index 000000000..b352f6296
--- /dev/null
+++ b/community/python2-cherrypy/PKGBUILD
@@ -0,0 +1,23 @@
+$Id: PKGBUILD 40928 2011-03-01 19:03:36Z angvp $
+# Maintainer: Angel Velasquez <angvp@archlinux.org>
+# Contributor: Douglas Soares de Andrade <dsa@aur.archlinux.org>
+# Contributor: Armando M. Baratti <amblistas@ajato.com.br>
+# Contributor: Florian Richter <Florian_Richter@gmx.de>
+pkgname=cherrypy
+pkgver=3.2.0
+pkgrel=1
+pkgdesc="A pythonic, object-oriented web development framework"
+arch=('i686' 'x86_64')
+url="http://www.cherrypy.org"
+license=('BSD')
+depends=('python2')
+source=(http://download.cherrypy.org/cherrypy/$pkgver/CherryPy-$pkgver.tar.gz
+ license)
+md5sums=('e5c1322bf5ce962c16283ab7a6dcca3f'
+ '22365dc6b0e6835b53da009aa36af017')
+
+build() {
+ cd $srcdir/CherryPy-$pkgver
+ python2 ./setup.py install --root=$pkgdir
+ install -D -m644 $srcdir/license $pkgdir/usr/share/licenses/$pkgname/license
+}
diff --git a/community/python2-cherrypy/license b/community/python2-cherrypy/license
new file mode 100644
index 000000000..32e9cf6bd
--- /dev/null
+++ b/community/python2-cherrypy/license
@@ -0,0 +1,25 @@
+Copyright (c) 2004, CherryPy Team (team@cherrypy.org)
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the CherryPy Team nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.