Hello community, here is the log from the commit of package python-kombu for openSUSE:Factory checked in at 2019-03-28 22:50:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-kombu (Old) and /work/SRC/openSUSE:Factory/.python-kombu.new.25356 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-kombu" Thu Mar 28 22:50:01 2019 rev:57 rq:689365 version:4.4.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-kombu/python-kombu.changes 2019-03-13 16:42:27.834636119 +0100 +++ /work/SRC/openSUSE:Factory/.python-kombu.new.25356/python-kombu.changes 2019-03-28 22:50:05.639038546 +0100 @@ -1,0 +2,15 @@ +Thu Mar 28 11:30:54 UTC 2019 - [email protected] + +- version update to 4.4.0 + * Restore bz2 import checks in compression module. + * Fix regression that occurred in 4.3.0 + when parsing Redis Sentinel master URI containing password. + * Handle the case when only one Redis Sentinel node is provided. + * Support SSL URL parameters correctly for `rediss://`` URIs. + * Revert `celery/kombu#954 <https://github.com/celery/kombu/pull/954>`_. + Instead bump the required redis-py dependency to 3.2.0 + to include this fix `andymccurdy/redis-py@4e1e748 + * Added support for broadcasting using a regular expression pattern + or a glob pattern to multiple Pidboxes. + +------------------------------------------------------------------- Old: ---- kombu-4.3.0.tar.gz New: ---- kombu-4.4.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-kombu.spec ++++++ --- /var/tmp/diff_new_pack.1IYHUl/_old 2019-03-28 22:50:07.223038195 +0100 +++ /var/tmp/diff_new_pack.1IYHUl/_new 2019-03-28 22:50:07.223038195 +0100 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-kombu -Version: 4.3.0 +Version: 4.4.0 Release: 0 Summary: AMQP Messaging Framework for Python License: BSD-3-Clause @@ -40,6 +40,7 @@ BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-amqp >= 2.4.0 +Requires: python-setuptools Obsoletes: python-carrot BuildArch: noarch %if 0%{?suse_version} ++++++ kombu-4.3.0.tar.gz -> kombu-4.4.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/Changelog new/kombu-4.4.0/Changelog --- old/kombu-4.3.0/Changelog 2019-02-06 17:10:13.000000000 +0100 +++ new/kombu-4.4.0/Changelog 2019-03-03 20:00:59.000000000 +0100 @@ -4,6 +4,44 @@ Change history ================ +.. _version 4.4.0: + +4.4.0 +===== +:release-date: 2019-03-3 9:00 P.M UTC+2:00 +:release-by: Omer Katz + +- Restore bz2 import checks in compression module. + + The checks were removed in `celery/kombu#938 <https://github.com/celery/kombu/pull/938>`_ due to assumption that it only affected Jython. + However, bz2 support can be missing in Pythons built without bz2 support. + + Contributed by **Patrick Woods** + +- Fix regression that occurred in 4.3.0 + when parsing Redis Sentinel master URI containing password. + + Contributed by **Peter Lithammer** + +- Handle the case when only one Redis Sentinel node is provided. + + Contributed by **Peter Lithammer** + +- Support SSL URL parameters correctly for `rediss://`` URIs. + + Contributed by **Paul Bailey** + +- Revert `celery/kombu#954 <https://github.com/celery/kombu/pull/954>`_. + Instead bump the required redis-py dependency to 3.2.0 + to include this fix `andymccurdy/redis-py@4e1e748 <https://github.com/andymccurdy/redis-py/commit/4e1e74809235edc19e03edb79c97c80a3e4e9eca>`_. + + Contributed by **Peter Lithammer** + +- Added support for broadcasting using a regular expression pattern + or a glob pattern to multiple Pidboxes. + + Contributed by **Jason Held** + .. _version-4.3.0: 4.3.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/PKG-INFO new/kombu-4.4.0/PKG-INFO --- old/kombu-4.3.0/PKG-INFO 2019-02-06 17:14:30.000000000 +0100 +++ new/kombu-4.4.0/PKG-INFO 2019-03-03 20:03:19.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: kombu -Version: 4.3.0 +Version: 4.4.0 Summary: Messaging library for Python. Home-page: https://kombu.readthedocs.io Author: Ask Solem @@ -12,7 +12,7 @@ |build-status| |coverage| |license| |wheel| |pyversion| |pyimp| - :Version: 4.3.0 + :Version: 4.4.0 :Documentation: https://kombu.readthedocs.io/ :Download: https://pypi.org/project/kombu/ :Source: https://github.com/celery/kombu/ @@ -388,17 +388,17 @@ Classifier: Topic :: System :: Networking Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* -Provides-Extra: redis -Provides-Extra: yaml -Provides-Extra: azureservicebus -Provides-Extra: azurestoragequeues Provides-Extra: qpid -Provides-Extra: consul -Provides-Extra: slmq -Provides-Extra: pyro -Provides-Extra: mongodb +Provides-Extra: azurestoragequeues Provides-Extra: sqlalchemy +Provides-Extra: azureservicebus +Provides-Extra: librabbitmq +Provides-Extra: mongodb +Provides-Extra: consul Provides-Extra: zookeeper +Provides-Extra: redis +Provides-Extra: pyro +Provides-Extra: yaml +Provides-Extra: slmq Provides-Extra: sqs Provides-Extra: msgpack -Provides-Extra: librabbitmq diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/README.rst new/kombu-4.4.0/README.rst --- old/kombu-4.3.0/README.rst 2019-02-06 17:13:10.000000000 +0100 +++ new/kombu-4.4.0/README.rst 2019-03-03 20:01:28.000000000 +0100 @@ -4,7 +4,7 @@ |build-status| |coverage| |license| |wheel| |pyversion| |pyimp| -:Version: 4.3.0 +:Version: 4.4.0 :Documentation: https://kombu.readthedocs.io/ :Download: https://pypi.org/project/kombu/ :Source: https://github.com/celery/kombu/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/docs/includes/introduction.txt new/kombu-4.4.0/docs/includes/introduction.txt --- old/kombu-4.3.0/docs/includes/introduction.txt 2019-02-06 17:13:10.000000000 +0100 +++ new/kombu-4.4.0/docs/includes/introduction.txt 2019-03-03 20:01:28.000000000 +0100 @@ -1,4 +1,4 @@ -:Version: 4.3.0 +:Version: 4.4.0 :Web: https://kombu.readthedocs.io/ :Download: https://pypi.org/project/kombu/ :Source: https://github.com/celery/kombu/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/docs/reference/index.rst new/kombu-4.4.0/docs/reference/index.rst --- old/kombu-4.3.0/docs/reference/index.rst 2019-01-08 10:50:50.000000000 +0100 +++ new/kombu-4.4.0/docs/reference/index.rst 2019-03-03 19:33:36.000000000 +0100 @@ -10,6 +10,7 @@ kombu kombu.common + kombu.matcher kombu.mixins kombu.simple kombu.clocks diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/docs/reference/kombu.matcher.rst new/kombu-4.4.0/docs/reference/kombu.matcher.rst --- old/kombu-4.3.0/docs/reference/kombu.matcher.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/kombu-4.4.0/docs/reference/kombu.matcher.rst 2019-03-03 19:33:36.000000000 +0100 @@ -0,0 +1,11 @@ +============================================== + Pattern matching registry - ``kombu.matcher`` +============================================== + +.. contents:: + :local: +.. currentmodule:: kombu.matcher + +.. automodule:: kombu.matcher + :members: + :undoc-members: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/extra/requirements/extras/redis.txt new/kombu-4.4.0/extra/requirements/extras/redis.txt --- old/kombu-4.3.0/extra/requirements/extras/redis.txt 2018-12-06 15:18:51.000000000 +0100 +++ new/kombu-4.4.0/extra/requirements/extras/redis.txt 2019-02-25 12:28:52.000000000 +0100 @@ -1 +1 @@ -redis>=2.10.5 +redis>=3.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu/__init__.py new/kombu-4.4.0/kombu/__init__.py --- old/kombu-4.3.0/kombu/__init__.py 2019-02-06 17:13:10.000000000 +0100 +++ new/kombu-4.4.0/kombu/__init__.py 2019-03-03 20:01:28.000000000 +0100 @@ -10,7 +10,7 @@ from collections import namedtuple # noqa -__version__ = '4.3.0' +__version__ = '4.4.0' __author__ = 'Ask Solem' __contact__ = '[email protected]' __homepage__ = 'https://kombu.readthedocs.io' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu/compression.py new/kombu-4.4.0/kombu/compression.py --- old/kombu-4.3.0/kombu/compression.py 2019-01-14 10:52:30.000000000 +0100 +++ new/kombu-4.4.0/kombu/compression.py 2019-02-25 12:28:52.000000000 +0100 @@ -3,7 +3,6 @@ from kombu.utils.encoding import ensure_bytes -import bz2 import zlib try: @@ -82,9 +81,14 @@ zlib.decompress, 'application/x-gzip', aliases=['gzip', 'zlib']) -register(bz2.compress, - bz2.decompress, - 'application/x-bz2', aliases=['bzip2', 'bzip']) +try: + import bz2 +except ImportError: + pass # No bz2 support +else: + register(bz2.compress, + bz2.decompress, + 'application/x-bz2', aliases=['bzip2', 'bzip']) try: import brotli diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu/matcher.py new/kombu-4.4.0/kombu/matcher.py --- old/kombu-4.3.0/kombu/matcher.py 1970-01-01 01:00:00.000000000 +0100 +++ new/kombu-4.4.0/kombu/matcher.py 2019-03-03 19:33:36.000000000 +0100 @@ -0,0 +1,140 @@ +"""Pattern matching registry.""" +from __future__ import absolute_import, unicode_literals + +from re import match as rematch +from fnmatch import fnmatch + +from .utils.compat import entrypoints +from .utils.encoding import bytes_to_str + + +class MatcherNotInstalled(Exception): + """Matcher not installed/found.""" + + pass + + +class MatcherRegistry(object): + """Pattern matching function registry.""" + + MatcherNotInstalled = MatcherNotInstalled + matcher_pattern_first = ["pcre", ] + + def __init__(self): + self._matchers = {} + self._default_matcher = None + + def register(self, name, matcher): + """Add matcher by name to the registry.""" + self._matchers[name] = matcher + + def unregister(self, name): + """Remove matcher by name from the registry.""" + try: + self._matchers.pop(name) + except KeyError: + raise self.MatcherNotInstalled( + 'No matcher installed for {}'.format(name) + ) + + def _set_default_matcher(self, name): + """Set the default matching method. + + :param name: The name of the registered matching method. + For example, `glob` (default), `pcre`, or any custom + methods registered using :meth:`register`. + + :raises MatcherNotInstalled: If the matching method requested + is not available. + """ + try: + self._default_matcher = self._matchers[name] + except KeyError: + raise self.MatcherNotInstalled( + 'No matcher installed for {}'.format(name) + ) + + def match(self, data, pattern, matcher=None, matcher_kwargs=None): + """Call the matcher.""" + if matcher and not self._matchers.get(matcher): + raise self.MatcherNotInstalled( + 'No matcher installed for {}'.format(matcher) + ) + match_func = self._matchers[matcher or 'glob'] + if matcher in self.matcher_pattern_first: + first_arg = bytes_to_str(pattern) + second_arg = bytes_to_str(data) + else: + first_arg = bytes_to_str(data) + second_arg = bytes_to_str(pattern) + return match_func(first_arg, second_arg, **matcher_kwargs or {}) + + +#: Global registry of matchers. +registry = MatcherRegistry() + + +""" +.. function:: match(data, pattern, matcher=default_matcher, + matcher_kwargs=None): + + Match `data` by `pattern` using `matcher`. + + :param data: The data that should be matched. Must be string. + :param pattern: The pattern that should be applied. Must be string. + :keyword matcher: An optional string representing the mathcing + method (for example, `glob` or `pcre`). + + If :const:`None` (default), then `glob` will be used. + + :keyword matcher_kwargs: Additional keyword arguments that will be passed + to the specified `matcher`. + :returns: :const:`True` if `data` matches pattern, + :const:`False` otherwise. + + :raises MatcherNotInstalled: If the matching method requested is not + available. +""" +match = registry.match + + +""" +.. function:: register(name, matcher): + Register a new matching method. + + :param name: A convience name for the mathing method. + :param matcher: A method that will be passed data and pattern. +""" +register = registry.register + + +""" +.. function:: unregister(name): + Unregister registered matching method. + + :param name: Registered matching method name. +""" +unregister = registry.unregister + + +def register_glob(): + """Register glob into default registry.""" + registry.register('glob', fnmatch) + + +def register_pcre(): + """Register pcre into default registry.""" + registry.register('pcre', rematch) + + +# Register the base matching methods. +register_glob() +register_pcre() + +# Default matching method is 'glob' +registry._set_default_matcher('glob') + + +# Load entrypoints from installed extensions +for ep, args in entrypoints('kombu.matchers'): + register(ep.name, *args) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu/pidbox.py new/kombu-4.4.0/kombu/pidbox.py --- old/kombu-4.3.0/kombu/pidbox.py 2019-01-08 10:50:50.000000000 +0100 +++ new/kombu-4.4.0/kombu/pidbox.py 2019-03-03 19:33:36.000000000 +0100 @@ -15,11 +15,14 @@ from .clocks import LamportClock from .common import maybe_declare, oid_from from .exceptions import InconsistencyError -from .five import range +from .five import range, string_t from .log import get_logger from .utils.functional import maybe_evaluate, reprcall from .utils.objects import cached_property from .utils.uuid import uuid +from .matcher import match + +REPLY_QUEUE_EXPIRES = 10 W_PIDBOX_IN_USE = """\ A node named {node.hostname} is already using this process mailbox! @@ -123,9 +126,21 @@ def handle_message(self, body, message=None): destination = body.get('destination') + pattern = body.get('pattern') + matcher = body.get('matcher') if message: self.adjust_clock(message.headers.get('clock') or 0) - if not destination or self.hostname in destination: + hostname = self.hostname + run_dispatch = False + if destination: + if hostname in destination: + run_dispatch = True + elif pattern and matcher: + if match(hostname, pattern, matcher): + run_dispatch = True + else: + run_dispatch = True + if run_dispatch: return self.dispatch(**body) dispatch_from_message = handle_message @@ -270,10 +285,12 @@ def _publish(self, type, arguments, destination=None, reply_ticket=None, channel=None, timeout=None, - serializer=None, producer=None): + serializer=None, producer=None, pattern=None, matcher=None): message = {'method': type, 'arguments': arguments, - 'destination': destination} + 'destination': destination, + 'pattern': pattern, + 'matcher': matcher} chan = channel or self.connection.default_channel exchange = self.exchange if reply_ticket: @@ -292,12 +309,19 @@ def _broadcast(self, command, arguments=None, destination=None, reply=False, timeout=1, limit=None, - callback=None, channel=None, serializer=None): + callback=None, channel=None, serializer=None, + pattern=None, matcher=None): if destination is not None and \ not isinstance(destination, (list, tuple)): raise ValueError( 'destination must be a list/tuple not {0}'.format( type(destination))) + if (pattern is not None and not isinstance(pattern, string_t) and + matcher is not None and not isinstance(matcher, string_t)): + raise ValueError( + 'pattern and matcher must be ' + 'strings not {}, {}'.format(type(pattern), type(matcher)) + ) arguments = arguments or {} reply_ticket = reply and uuid() or None @@ -312,7 +336,9 @@ reply_ticket=reply_ticket, channel=chan, timeout=timeout, - serializer=serializer) + serializer=serializer, + pattern=pattern, + matcher=matcher) if reply_ticket: return self._collect(reply_ticket, limit=limit, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu/transport/redis.py new/kombu-4.4.0/kombu/transport/redis.py --- old/kombu-4.3.0/kombu/transport/redis.py 2019-01-08 10:50:50.000000000 +0100 +++ new/kombu-4.4.0/kombu/transport/redis.py 2019-02-25 12:28:52.000000000 +0100 @@ -931,22 +931,8 @@ if asynchronous: class Connection(connection_cls): def disconnect(self): - # NOTE: see celery issue #3898 - # redis-py Connection shutdown()s the socket - # which causes all copies of file descriptor - # to become unusable, however close() only - # affect process-local copies of fds. - # So we just override Connection's disconnect method. - self._parser.on_disconnect() + super(Connection, self).disconnect() channel._on_connection_disconnect(self) - if self._sock is None: - return - try: - # self._sock.shutdown(socket.SHUT_RDWR) - self._sock.close() - except socket.error: - pass - self._sock = None connection_cls = Connection connparams['connection_class'] = connection_cls @@ -964,9 +950,9 @@ return redis.ConnectionPool(**params) def _get_client(self): - if redis.VERSION < (2, 10, 5): + if redis.VERSION < (3, 2, 0): raise VersionMismatch( - 'Redis transport requires redis-py versions 2.10.5 or later. ' + 'Redis transport requires redis-py versions 3.2.0 or later. ' 'You have {0.__version__}'.format(redis)) return redis.StrictRedis @@ -1100,12 +1086,19 @@ additional_params.pop('host', None) additional_params.pop('port', None) - connection_list = [] + + sentinels = [] for url in self.connection.client.alt: - if url and 'sentinel://' in url: - connection_list.append(url.split('/')[2].split(':')) + url = _parse_url(url) + if url.scheme == 'sentinel': + sentinels.append((url.hostname, url.port)) + + # Fallback for when only one sentinel is provided. + if not sentinels: + sentinels.append((connparams['host'], connparams['port'])) + sentinel_inst = sentinel.Sentinel( - connection_list, + sentinels, min_other_sentinels=getattr(self, 'min_other_sentinels', 0), sentinel_kwargs=getattr(self, 'sentinel_kwargs', None), **additional_params) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu/utils/url.py new/kombu-4.4.0/kombu/utils/url.py --- old/kombu-4.3.0/kombu/utils/url.py 2019-02-06 12:34:42.000000000 +0100 +++ new/kombu-4.4.0/kombu/utils/url.py 2019-02-25 12:28:52.000000000 +0100 @@ -15,12 +15,19 @@ except ImportError: from urllib import quote, unquote # noqa from urlparse import urlparse, parse_qsl # noqa +try: + import ssl + ssl_available = True +except ImportError: # pragma: no cover + ssl_available = False from kombu.five import bytes_if_py2, string_t from .compat import NamedTuple +from ..log import get_logger safequote = partial(quote, safe=bytes_if_py2('')) +logger = get_logger(__name__) urlparts = NamedTuple('urlparts', [ @@ -38,6 +45,22 @@ # type: (str) -> Dict """Parse URL into mapping of components.""" scheme, host, port, user, password, path, query = _parse_url(url) + if query: + keys = [key for key in query.keys() if key.startswith('ssl_')] + for key in keys: + if key == 'ssl_cert_reqs': + if ssl_available: + query[key] = getattr(ssl, query[key]) + else: + query[key] = None + logger.warn('Defaulting to insecure SSL behaviour.') + + if 'ssl' not in query: + query['ssl'] = {} + + query['ssl'][key] = query[key] + del query[key] + return dict(transport=scheme, hostname=host, port=port, userid=user, password=password, virtual_host=path, **query) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu.egg-info/PKG-INFO new/kombu-4.4.0/kombu.egg-info/PKG-INFO --- old/kombu-4.3.0/kombu.egg-info/PKG-INFO 2019-02-06 17:14:29.000000000 +0100 +++ new/kombu-4.4.0/kombu.egg-info/PKG-INFO 2019-03-03 20:03:19.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: kombu -Version: 4.3.0 +Version: 4.4.0 Summary: Messaging library for Python. Home-page: https://kombu.readthedocs.io Author: Ask Solem @@ -12,7 +12,7 @@ |build-status| |coverage| |license| |wheel| |pyversion| |pyimp| - :Version: 4.3.0 + :Version: 4.4.0 :Documentation: https://kombu.readthedocs.io/ :Download: https://pypi.org/project/kombu/ :Source: https://github.com/celery/kombu/ @@ -388,17 +388,17 @@ Classifier: Topic :: System :: Networking Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* -Provides-Extra: redis -Provides-Extra: yaml -Provides-Extra: azureservicebus -Provides-Extra: azurestoragequeues Provides-Extra: qpid -Provides-Extra: consul -Provides-Extra: slmq -Provides-Extra: pyro -Provides-Extra: mongodb +Provides-Extra: azurestoragequeues Provides-Extra: sqlalchemy +Provides-Extra: azureservicebus +Provides-Extra: librabbitmq +Provides-Extra: mongodb +Provides-Extra: consul Provides-Extra: zookeeper +Provides-Extra: redis +Provides-Extra: pyro +Provides-Extra: yaml +Provides-Extra: slmq Provides-Extra: sqs Provides-Extra: msgpack -Provides-Extra: librabbitmq diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu.egg-info/SOURCES.txt new/kombu-4.4.0/kombu.egg-info/SOURCES.txt --- old/kombu-4.3.0/kombu.egg-info/SOURCES.txt 2019-02-06 17:14:29.000000000 +0100 +++ new/kombu-4.4.0/kombu.egg-info/SOURCES.txt 2019-03-03 20:03:19.000000000 +0100 @@ -49,6 +49,7 @@ docs/reference/kombu.exceptions.rst docs/reference/kombu.five.rst docs/reference/kombu.log.rst +docs/reference/kombu.matcher.rst docs/reference/kombu.message.rst docs/reference/kombu.mixins.rst docs/reference/kombu.pidbox.rst @@ -162,6 +163,7 @@ kombu/exceptions.py kombu/five.py kombu/log.py +kombu/matcher.py kombu/message.py kombu/messaging.py kombu/mixins.py @@ -286,6 +288,7 @@ t/unit/test_entity.py t/unit/test_exceptions.py t/unit/test_log.py +t/unit/test_matcher.py t/unit/test_message.py t/unit/test_messaging.py t/unit/test_mixins.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/kombu.egg-info/requires.txt new/kombu-4.4.0/kombu.egg-info/requires.txt --- old/kombu-4.3.0/kombu.egg-info/requires.txt 2019-02-06 17:14:29.000000000 +0100 +++ new/kombu-4.4.0/kombu.egg-info/requires.txt 2019-03-03 20:03:19.000000000 +0100 @@ -26,7 +26,7 @@ qpid-tools>=0.26 [redis] -redis>=2.10.5 +redis>=3.2.0 [slmq] softlayer_messaging>=1.0.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/requirements/extras/redis.txt new/kombu-4.4.0/requirements/extras/redis.txt --- old/kombu-4.3.0/requirements/extras/redis.txt 2018-12-06 15:18:51.000000000 +0100 +++ new/kombu-4.4.0/requirements/extras/redis.txt 2019-02-25 12:28:52.000000000 +0100 @@ -1 +1 @@ -redis>=2.10.5 +redis>=3.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/t/unit/test_compression.py new/kombu-4.4.0/t/unit/test_compression.py --- old/kombu-4.3.0/t/unit/test_compression.py 2019-01-14 10:52:30.000000000 +0100 +++ new/kombu-4.4.0/t/unit/test_compression.py 2019-02-25 12:28:52.000000000 +0100 @@ -2,6 +2,10 @@ import pytest +import sys + +from case import mock, skip + from kombu import compression @@ -10,6 +14,7 @@ def test_encoders__gzip(self): assert 'application/x-gzip' in compression.encoders() + @skip.unless_module('bz2') def test_encoders__bz2(self): assert 'application/x-bz2' in compression.encoders() @@ -79,3 +84,13 @@ assert text != c d = compression.decompress(c, ctype) assert d == text + + @mock.mask_modules('bz2') + def test_no_bz2(self): + c = sys.modules.pop('kombu.compression') + try: + import kombu.compression + assert not hasattr(kombu.compression, 'bz2') + finally: + if c is not None: + sys.modules['kombu.compression'] = c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/t/unit/test_matcher.py new/kombu-4.4.0/t/unit/test_matcher.py --- old/kombu-4.3.0/t/unit/test_matcher.py 1970-01-01 01:00:00.000000000 +0100 +++ new/kombu-4.4.0/t/unit/test_matcher.py 2019-03-03 19:33:36.000000000 +0100 @@ -0,0 +1,32 @@ +from __future__ import absolute_import, unicode_literals + +from kombu.matcher import ( + match, register, registry, unregister, fnmatch, rematch, + MatcherNotInstalled +) + +import pytest + + +class test_Matcher(object): + + def test_register_match_unregister_matcher(self): + register("test_matcher", rematch) + registry.matcher_pattern_first.append("test_matcher") + assert registry._matchers["test_matcher"] == rematch + assert match("data", r"d.*", "test_matcher") is not None + assert registry._default_matcher == fnmatch + registry._set_default_matcher("test_matcher") + assert registry._default_matcher == rematch + unregister("test_matcher") + assert "test_matcher" not in registry._matchers + registry._set_default_matcher("glob") + assert registry._default_matcher == fnmatch + + def test_unregister_matcher_not_registered(self): + with pytest.raises(MatcherNotInstalled): + unregister('notinstalled') + + def test_match_using_unregistered_matcher(self): + with pytest.raises(MatcherNotInstalled): + match("data", r"d.*", "notinstalled") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/t/unit/test_pidbox.py new/kombu-4.4.0/t/unit/test_pidbox.py --- old/kombu-4.3.0/t/unit/test_pidbox.py 2018-12-06 15:18:51.000000000 +0100 +++ new/kombu-4.4.0/t/unit/test_pidbox.py 2019-03-03 19:33:36.000000000 +0100 @@ -43,6 +43,11 @@ def _handler(self, state): return self.stats['var'] + def test_broadcast_matcher_pattern_string_type(self): + mailbox = pidbox.Mailbox("test_matcher_str")(self.connection) + with pytest.raises(ValueError): + mailbox._broadcast("ping", pattern=1, matcher=2) + def test_publish_reply_ignores_InconsistencyError(self): mailbox = pidbox.Mailbox('test_reply__collect')(self.connection) with patch('kombu.pidbox.Producer') as Producer: @@ -233,6 +238,19 @@ body['destination'] = ['some_other_node'] assert node.handle_message(body, None) is None + # message for me should be processed. + body['destination'] = ['test_dispatch_from_message'] + assert node.handle_message(body, None) is not None + + # message not for me should not be processed. + body.pop("destination") + body['matcher'] = 'glob' + body["pattern"] = "something*" + assert node.handle_message(body, None) is None + + body["pattern"] = "test*" + assert node.handle_message(body, None) is not None + def test_handle_message_adjusts_clock(self): node = self.bound.Node('test_adjusts_clock') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/t/unit/transport/test_redis.py new/kombu-4.4.0/t/unit/transport/test_redis.py --- old/kombu-4.3.0/t/unit/transport/test_redis.py 2019-01-08 10:50:50.000000000 +0100 +++ new/kombu-4.4.0/t/unit/transport/test_redis.py 2019-02-25 12:28:52.000000000 +0100 @@ -1344,7 +1344,10 @@ def test_getting_master_from_sentinel(self): with patch('redis.sentinel.Sentinel') as patched: connection = Connection( - 'sentinel://localhost:65534/;sentinel://localhost:65535/;sentinel://localhost:65536/;', # noqa: E501 + 'sentinel://localhost:65532/;' + 'sentinel://user@localhost:65533/;' + 'sentinel://:password@localhost:65534/;' + 'sentinel://user:password@localhost:65535/;', transport_options={ 'master_name': 'not_important', }, @@ -1353,13 +1356,36 @@ connection.channel() patched.assert_called_once_with( [ - [u'localhost', u'65534'], - [u'localhost', u'65535'], - [u'localhost', u'65536'] + (u'localhost', 65532), + (u'localhost', 65533), + (u'localhost', 65534), + (u'localhost', 65535), ], connection_class=mock.ANY, db=0, max_connections=10, min_other_sentinels=0, password=None, sentinel_kwargs=None, socket_connect_timeout=None, socket_keepalive=None, + socket_keepalive_options=None, socket_timeout=None) + + master_for = patched.return_value.master_for + master_for.assert_called() + master_for.assert_called_with('not_important', ANY) + master_for().connection_pool.get_connection.assert_called() + + def test_getting_master_from_sentinel_single_node(self): + with patch('redis.sentinel.Sentinel') as patched: + connection = Connection( + 'sentinel://localhost:65532/', + transport_options={ + 'master_name': 'not_important', + }, + ) + + connection.channel() + patched.assert_called_once_with( + [(u'localhost', 65532)], + connection_class=mock.ANY, db=0, max_connections=10, + min_other_sentinels=0, password=None, sentinel_kwargs=None, + socket_connect_timeout=None, socket_keepalive=None, socket_keepalive_options=None, socket_timeout=None) master_for = patched.return_value.master_for diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kombu-4.3.0/t/unit/utils/test_url.py new/kombu-4.4.0/t/unit/utils/test_url.py --- old/kombu-4.3.0/t/unit/utils/test_url.py 2018-12-06 15:18:51.000000000 +0100 +++ new/kombu-4.4.0/t/unit/utils/test_url.py 2019-02-25 12:28:52.000000000 +0100 @@ -1,7 +1,16 @@ from __future__ import absolute_import, unicode_literals +try: + from urllib.parse import urlencode + +except ImportError: + from urllib import urlencode + +import ssl + import pytest +import kombu.utils.url from kombu.utils.url import as_url, parse_url, maybe_sanitize_url @@ -37,3 +46,26 @@ assert maybe_sanitize_url(url) == expected assert (maybe_sanitize_url('http://u:[email protected]//foo') == 'http://u:**@e.com//foo') + + +def test_ssl_parameters(): + url = 'rediss://user:password@host:6379/0?' + querystring = urlencode({ + 'ssl_cert_reqs': 'CERT_REQUIRED', + 'ssl_ca_certs': '/var/ssl/myca.pem', + 'ssl_certfile': '/var/ssl/server-cert.pem', + 'ssl_keyfile': '/var/ssl/priv/worker-key.pem', + }) + kwargs = parse_url(url + querystring) + assert kwargs['transport'] == 'rediss' + assert kwargs['ssl']['ssl_cert_reqs'] == ssl.CERT_REQUIRED + assert kwargs['ssl']['ssl_ca_certs'] == '/var/ssl/myca.pem' + assert kwargs['ssl']['ssl_certfile'] == '/var/ssl/server-cert.pem' + assert kwargs['ssl']['ssl_keyfile'] == '/var/ssl/priv/worker-key.pem' + + kombu.utils.url.ssl_available = False + + kwargs = parse_url(url + querystring) + assert kwargs['ssl']['ssl_cert_reqs'] is None + + kombu.utils.url.ssl_available = True
