Fix docs-building on old stable branches

Not sure why, but the docs build is running under py35 (even though we
ask in multiple places for it to run under py27).

Mostly just need to fix some imports for xprofile.

Related-Change: Ie8d28218b974a1b6b7b7b691f786ff1d6bdded05

There's also something stupid about "unexpected indent" from an upstream
cpython docstring.

Related-Change: I2a354e2624c763a68fcea7a6404e9c2fde30d631

Pick up another commit, as well, as s3api uses a funky removed-in-py3 mixin:

==========

Py3: Use collections.MutableMapping rather than UserDict.DictMixin

Taken from https://docs.python.org/2/library/userdict.html#UserDict.DictMixin:

"Starting with Python version 2.6, it is recommended to use
collections.MutableMapping instead of DictMixin."

Related-Change: Idb67010de835dc2dbcbf87c40def934568a0dcf5
(cherry picked from commit c3cbe69da8)

==========

Change-Id: I56f10d8e25e57da59f3da57fe797f615433d70a7
This commit is contained in:
Tim Burke 2022-04-19 13:36:44 -07:00
parent b4551a424b
commit 76dd373a3d
5 changed files with 23 additions and 11 deletions

View File

@ -162,6 +162,14 @@ class BufferedHTTPConnection(HTTPConnection):
return ret
def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0):
'''Send a request to the server.
:param method: specifies an HTTP request method, e.g. 'GET'.
:param url: specifies the object being requested, e.g. '/index.html'.
:param skip_host: if True does not add automatically a 'Host:' header
:param skip_accept_encoding: if True does not add automatically an
'Accept-Encoding:' header
'''
self._method = method
self._path = url
return HTTPConnection.putrequest(self, method, url, skip_host,

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from urllib import quote
from six.moves.urllib.parse import quote
from swift.common.utils import public
from swift.common.middleware.s3api.controllers.base import Controller

View File

@ -14,7 +14,7 @@
# limitations under the License.
import re
from UserDict import DictMixin
from collections import MutableMapping
from functools import partial
from swift.common import swob
@ -219,7 +219,7 @@ class ErrorResponse(S3ResponseBase, swob.HTTPException):
tag = re.sub('\W', '', snake_to_camel(key))
elem = SubElement(parent, tag)
if isinstance(value, (dict, DictMixin)):
if isinstance(value, (dict, MutableMapping)):
self._dict_to_etree(elem, value)
else:
try:

View File

@ -21,9 +21,10 @@ import string
import tempfile
from swift import gettext_ as _
from exceptions import PLOTLIBNotInstalled, ODFLIBNotInstalled,\
NotFoundException, MethodNotAllowed, DataLoadFailure, ProfileException
from profile_model import Stats2
from swift.common.middleware.x_profile.exceptions import PLOTLIBNotInstalled,\
ODFLIBNotInstalled, NotFoundException, MethodNotAllowed, DataLoadFailure,\
ProfileException
from swift.common.middleware.x_profile.profile_model import Stats2
PLOTLIB_INSTALLED = True
try:

View File

@ -86,10 +86,10 @@ from six.moves import urllib
from swift import gettext_ as _
from swift.common.utils import get_logger, config_true_value
from swift.common.swob import Request
from x_profile.exceptions import NotFoundException, MethodNotAllowed,\
ProfileException
from x_profile.html_viewer import HTMLViewer
from x_profile.profile_model import ProfileLog
from swift.common.middleware.x_profile.exceptions import NotFoundException, \
MethodNotAllowed, ProfileException
from swift.common.middleware.x_profile.html_viewer import HTMLViewer
from swift.common.middleware.x_profile.profile_model import ProfileLog
DEFAULT_PROFILE_PREFIX = '/tmp/log/swift/profile/default.profile'
@ -107,7 +107,10 @@ PROFILE_EXEC_LAZY = """
app_iter_ = self.app(environ, start_response)
"""
thread = patcher.original('thread') # non-monkeypatched module needed
if six.PY3:
thread = patcher.original('_thread') # non-monkeypatched module needed
else:
thread = patcher.original('thread') # non-monkeypatched module needed
# This monkey patch code fix the problem of eventlet profile tool