From 666c87ee95cdbeefa37792df63fb504858c6e7e5 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Fri, 16 Oct 2015 17:50:51 +0100 Subject: [PATCH] Unconditionally use HTTPConnectionPool, and depend on a Twisted that provides it. Signed-off-by: Daira Hopwood --- src/allmydata/_auto_deps.py | 7 ++++++- src/allmydata/storage/backends/cloud/cloud_common.py | 12 ++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/allmydata/_auto_deps.py b/src/allmydata/_auto_deps.py index 9e8e4e2a..8479e320 100644 --- a/src/allmydata/_auto_deps.py +++ b/src/allmydata/_auto_deps.py @@ -156,7 +156,12 @@ if sys.platform == "win32": if _use_old_Twisted_and_Nevow: install_requires += [ - "Twisted >= 11.1.0, <= 12.1.0", + # * The cloud backend depends on Twisted 12.1.0 for HTTPConnectionPool. + # * IPv6 support will also depend on Twisted 12.1.0. + # * We don't want Twisted >= 12.2.0 to avoid a dependency of its endpoints + # code on pywin32. + # + "Twisted == 12.1.0", "Nevow >= 0.9.33, <= 0.10", ] setup_requires += [req for req in install_requires if req.startswith('Twisted') diff --git a/src/allmydata/storage/backends/cloud/cloud_common.py b/src/allmydata/storage/backends/cloud/cloud_common.py index 6cacbaf6..258caf7a 100644 --- a/src/allmydata/storage/backends/cloud/cloud_common.py +++ b/src/allmydata/storage/backends/cloud/cloud_common.py @@ -6,12 +6,7 @@ import urllib from twisted.internet import defer, reactor, task from twisted.python.failure import Failure from twisted.web.error import Error -from twisted.web.client import FileBodyProducer, ResponseDone, Agent -try: - from twisted.web.client import HTTPConnectionPool -except ImportError: - # Old version of Twisted - HTTPConnectionPool = None +from twisted.web.client import FileBodyProducer, ResponseDone, Agent, HTTPConnectionPool from twisted.web.http_headers import Headers from twisted.internet.protocol import Protocol @@ -708,10 +703,7 @@ class CommonContainerMixin(HTTPClientMixin, ContainerRetryMixin): def __init__(self, container_name, override_reactor=None): self._container_name = container_name self._reactor = override_reactor or reactor - if HTTPConnectionPool: - self._agent = Agent(self._reactor, pool=HTTPConnectionPool(self._reactor)) - else: - self._agent = Agent(self._reactor) + self._agent = Agent(self._reactor, pool=HTTPConnectionPool(self._reactor)) self.ServiceError = CloudServiceError def __repr__(self): -- 2.45.2