Hello community, here is the log from the commit of package python-Coherence for openSUSE:Factory checked in at 2012-12-19 11:52:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-Coherence (Old) and /work/SRC/openSUSE:Factory/.python-Coherence.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-Coherence", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/python-Coherence/python-Coherence.changes 2011-12-15 16:07:34.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.python-Coherence.new/python-Coherence.changes 2012-12-19 11:52:50.000000000 +0100 @@ -1,0 +2,7 @@ +Sun Jul 1 14:48:45 UTC 2012 - [email protected] + +- Add coherence-getPage.patch: Fix execution with Twisted >= 11.0 +- Add python-Axiom, python-Epsilon and python-tagpy Requires + (bnc#741999). + +------------------------------------------------------------------- New: ---- coherence-getPage.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-Coherence.spec ++++++ --- /var/tmp/diff_new_pack.AZBD77/_old 2012-12-19 11:52:50.000000000 +0100 +++ /var/tmp/diff_new_pack.AZBD77/_new 2012-12-19 11:52:50.000000000 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-Coherence # -# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -11,10 +11,11 @@ # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# + # Please submit bugfixes or comments via http://bugs.opensuse.org/ # + Name: python-Coherence Version: 0.6.6.2 Release: 0 @@ -23,18 +24,22 @@ License: MIT Group: Development/Languages/Python Source: http://coherence.beebits.net/download/Coherence-0.6.6.2.tar.gz +Patch0: coherence-getPage.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildRequires: python-devel BuildRequires: fdupes +BuildRequires: python-devel # We drop the internal version in coherence tree BuildRequires: python-Louie -BuildRequires: python-distribute BuildRequires: python-Twisted +BuildRequires: python-distribute # Requires pkg_resources Requires: python-distribute # As we drop the internal version, we need to require our own package. +Requires: python-Axiom +Requires: python-Epsilon Requires: python-Louie Requires: python-Twisted +Requires: python-tagpy Recommends: python-gstreamer-0_10 # Youtube MediaServer Recommends: python-gdata @@ -65,6 +70,7 @@ %prep %setup -q -n Coherence-%{version} +%patch0 -p1 # We have python-louie available. Let's not carry the same package more than once find coherence -type f -exec sed -i 's/coherence.extern.louie as louie/louie/' {} \; rm coherence/extern/louie.py ++++++ coherence-getPage.patch ++++++ Index: Coherence-0.6.6.2/coherence/upnp/core/test/test_utils.py =================================================================== --- Coherence-0.6.6.2.orig/coherence/upnp/core/test/test_utils.py +++ Coherence-0.6.6.2/coherence/upnp/core/test/test_utils.py @@ -9,9 +9,14 @@ Test cases for L{upnp.core.utils} """ +import os from twisted.trial import unittest +from twisted.python.filepath import FilePath +from twisted.internet import reactor +from twisted.web import static, server +from twisted.protocols import policies -from coherence.upnp.core.utils import * +from coherence.upnp.core import utils # This data is joined using CRLF pairs. testChunkedData = ['200', @@ -121,9 +126,49 @@ class TestUpnpUtils(unittest.TestCase): based on a test and data provided by Lawrence """ testData = '\r\n'.join(testChunkedData) - newData = de_chunk_payload(testData) + newData = utils.de_chunk_payload(testData) # see whether we can parse the result self.assertEqual(newData, '\r\n'.join( testChunkedDataResult)) +class TestClient(unittest.TestCase): + + def _listen(self, site): + return reactor.listenTCP(0, site, interface="127.0.0.1") + + def setUp(self): + name = self.mktemp() + os.mkdir(name) + FilePath(name).child("file").setContent("0123456789") + r = static.File(name) + self.site = server.Site(r, timeout=None) + self.wrapper = policies.WrappingFactory(self.site) + self.port = self._listen(self.wrapper) + self.portno = self.port.getHost().port + + def tearDown(self): + return self.port.stopListening() + + def getURL(self, path): + return "http://127.0.0.1:%d/%s" % (self.portno, path) + + def assertResponse(self, original, content, headers): + self.assertIsInstance(original, tuple) + self.assertEqual(original[0], content) + originalHeaders = original[1] + for header in headers: + self.assertIn(header, originalHeaders) + self.assertEqual(originalHeaders[header], headers[header]) + + def test_getPage(self): + content = '0123456789' + headers = {'accept-ranges': ['bytes'], + 'content-length': ['10'], + 'content-type': ['text/html']} + d = utils.getPage(self.getURL("file")) + d.addCallback(self.assertResponse, content, headers) + return d + + + # $Id:$ Index: Coherence-0.6.6.2/coherence/upnp/core/utils.py =================================================================== --- Coherence-0.6.6.2.orig/coherence/upnp/core/utils.py +++ Coherence-0.6.6.2/coherence/upnp/core/utils.py @@ -517,48 +517,14 @@ class HeaderAwareHTTPClientFactory(clien protocol = myHTTPPageGetter noisy = False - def __init__(self, url, method='GET', postdata=None, headers=None, - agent="Twisted PageGetter", timeout=0, cookies=None, - followRedirect=True, redirectLimit=20): - self.followRedirect = followRedirect - self.redirectLimit = redirectLimit - self._redirectCount = 0 - self.timeout = timeout - self.agent = agent - - if cookies is None: - cookies = {} - self.cookies = cookies - if headers is not None: - self.headers = InsensitiveDict(headers) - else: - self.headers = InsensitiveDict() - if postdata is not None: - self.headers.setdefault('Content-Length', len(postdata)) - # just in case a broken http/1.1 decides to keep connection alive - self.headers.setdefault("connection", "close") - self.postdata = postdata - self.method = method - - self.setURL(url) - - self.waiting = 1 - self.deferred = defer.Deferred() - self.response_headers = None - def buildProtocol(self, addr): - p = protocol.ClientFactory.buildProtocol(self, addr) + p = client.HTTPClientFactory.buildProtocol(self, addr) p.method = self.method p.followRedirect = self.followRedirect - if self.timeout: - timeoutCall = reactor.callLater(self.timeout, p.timeout) - self.deferred.addBoth(self._cancelTimeout, timeoutCall) return p def page(self, page): - if self.waiting: - self.waiting = 0 - self.deferred.callback((page, self.response_headers)) + client.HTTPClientFactory.page(self, (page, self.response_headers)) class HeaderAwareHTTPDownloader(client.HTTPDownloader): @@ -577,24 +543,22 @@ class HeaderAwareHTTPDownloader(client.H self.requestedPartial = 0 + def getPage(url, contextFactory=None, *args, **kwargs): - """Download a web page as a string. + """ + Download a web page as a string. Download a page. Return a deferred, which will callback with a page (as a string) or errback with a description of the error. See HTTPClientFactory to see what extra args can be passed. """ - scheme, host, port, path = client._parse(url) - factory = HeaderAwareHTTPClientFactory(url, *args, **kwargs) - if scheme == 'https': - from twisted.internet import ssl - if contextFactory is None: - contextFactory = ssl.ClientContextFactory() - reactor.connectSSL(host, port, factory, contextFactory) - else: - reactor.connectTCP(host, port, factory) - return factory.deferred + kwargs['agent'] = "Coherence PageGetter" + return client._makeGetterFactory( + url, + HeaderAwareHTTPClientFactory, + contextFactory=contextFactory, + *args, **kwargs).deferred def downloadPage(url, file, contextFactory=None, *args, **kwargs): -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
