Update hacking for Python3

The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Remove hacking and friends from lower-constraints, they are not needed
for installation.

Change-Id: I99b8b24f714858f6b289e5e7b5976e519bb81c11
This commit is contained in:
Andreas Jaeger 2020-04-02 15:22:04 +02:00
parent bf64eb26da
commit 279ea4766e
10 changed files with 16 additions and 16 deletions

View File

@ -926,7 +926,7 @@ def get_s3_location(s3_host):
's3-sa-east-1.amazonaws.com': 'sa-east-1' 's3-sa-east-1.amazonaws.com': 'sa-east-1'
} }
# strip off scheme and port if present # strip off scheme and port if present
key = re.sub('^(https?://)?(?P<host>[^:]+[^/])(:[0-9]+)?/?$', key = re.sub(r'^(https?://)?(?P<host>[^:]+[^/])(:[0-9]+)?/?$',
'\g<host>', r'\g<host>',
s3_host) s3_host)
return locations.get(key, '') return locations.get(key, '')

View File

@ -768,6 +768,7 @@ def Store(conf, backend=None):
return MultiTenantStore(conf, backend=backend) return MultiTenantStore(conf, backend=backend)
return SingleTenantStore(conf, backend=backend) return SingleTenantStore(conf, backend=backend)
Store.OPTIONS = _SWIFT_OPTS + sutils.swift_opts + buffered.BUFFERING_OPTS Store.OPTIONS = _SWIFT_OPTS + sutils.swift_opts + buffered.BUFFERING_OPTS
@ -1122,7 +1123,7 @@ class BaseStore(driver.Store):
try: try:
connection.delete_object(obj_container, connection.delete_object(obj_container,
segment['name']) segment['name'])
except swiftclient.ClientException as e: except swiftclient.ClientException:
msg = _('Unable to delete segment %(segment_name)s') msg = _('Unable to delete segment %(segment_name)s')
msg = msg % {'segment_name': segment['name']} msg = msg % {'segment_name': segment['name']}
LOG.exception(msg) LOG.exception(msg)

View File

@ -223,6 +223,6 @@ class SwiftParams(object):
reference['auth_version'] = av reference['auth_version'] = av
account_params[ref] = reference account_params[ref] = reference
except (ValueError, SyntaxError, configparser.NoOptionError) as e: except (ValueError, SyntaxError, configparser.NoOptionError):
LOG.exception(_LE("Invalid format of swift store config cfg")) LOG.exception(_LE("Invalid format of swift store config cfg"))
return account_params return account_params

View File

@ -51,7 +51,7 @@ class GlanceStoreException(Exception):
if kwargs: if kwargs:
message = message % kwargs message = message % kwargs
except Exception: except Exception:
pass pass
self.msg = message self.msg = message
super(GlanceStoreException, self).__init__(message) super(GlanceStoreException, self).__init__(message)

View File

@ -47,9 +47,9 @@ from glance_store.tests.unit import test_store_capabilities
CONF = cfg.CONF CONF = cfg.CONF
FAKE_UUID = lambda: str(uuid.uuid4()) FAKE_UUID = lambda: str(uuid.uuid4()) # noqa: E731
FAKE_UUID2 = lambda: str(uuid.uuid4()) FAKE_UUID2 = lambda: str(uuid.uuid4()) # noqa: E731
FAKE_UUID3 = lambda: str(uuid.uuid4()) FAKE_UUID3 = lambda: str(uuid.uuid4()) # noqa: E731
Store = swift.Store Store = swift.Store

View File

@ -46,8 +46,8 @@ from glance_store.tests.unit import test_store_capabilities
CONF = cfg.CONF CONF = cfg.CONF
FAKE_UUID = lambda: str(uuid.uuid4()) FAKE_UUID = lambda: str(uuid.uuid4()) # noqa: E731
FAKE_UUID2 = lambda: str(uuid.uuid4()) FAKE_UUID2 = lambda: str(uuid.uuid4()) # noqa: E731
Store = swift.Store Store = swift.Store
FIVE_KB = 5 * units.Ki FIVE_KB = 5 * units.Ki

View File

@ -17,12 +17,10 @@ eventlet==0.18.2
extras==1.0.0 extras==1.0.0
fasteners==0.14.1 fasteners==0.14.1
fixtures==3.0.0 fixtures==3.0.0
flake8==2.5.5
future==0.16.0 future==0.16.0
gitdb2==2.0.3 gitdb2==2.0.3
GitPython==2.1.8 GitPython==2.1.8
greenlet==0.4.13 greenlet==0.4.13
hacking==0.12.0
httplib2==0.9.1 httplib2==0.9.1
idna==2.6 idna==2.6
imagesize==1.0.0 imagesize==1.0.0
@ -55,9 +53,7 @@ os-testr==1.0.0
packaging==17.1 packaging==17.1
Parsley==1.3 Parsley==1.3
pbr==3.1.1 pbr==3.1.1
pep8==1.5.7
prettytable==0.7.2 prettytable==0.7.2
pyflakes==0.8.1
Pygments==2.2.0 Pygments==2.2.0
pyparsing==2.2.0 pyparsing==2.2.0
pyperclip==1.6.0 pyperclip==1.6.0

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
# Metrics and style # Metrics and style
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 hacking>=3.0,<3.1.0 # Apache-2.0
# Documentation style # Documentation style
doc8>=0.6.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0

View File

@ -69,5 +69,6 @@ def main(argv):
'setup.py', 'develop']) 'setup.py', 'develop'])
print_help() print_help()
if __name__ == '__main__': if __name__ == '__main__':
main(sys.argv) main(sys.argv)

View File

@ -59,7 +59,9 @@ ignore-path = .venv,.git,.tox,*glance_store/locale*,*lib/python*,glance_store.eg
# H301 one import per line # H301 one import per line
# H404 multi line docstring should start with a summary # H404 multi line docstring should start with a summary
# H405 multi line docstring summary not separated with an empty line # H405 multi line docstring summary not separated with an empty line
ignore = H301,H404,H405 # W503 line break before binary operator
# W504 line break after binary operator
ignore = H301,H404,H405,W503,W504
exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*lib/python*,*egg,build exclude = .venv,.git,.tox,dist,doc,etc,*glance_store/locale*,*lib/python*,*egg,build
[testenv:lower-constraints] [testenv:lower-constraints]