diff --git a/kombu/transport/__init__.py b/kombu/transport/__init__.py index 85988218..4c1003f1 100644 --- a/kombu/transport/__init__.py +++ b/kombu/transport/__init__.py @@ -12,7 +12,14 @@ from __future__ import absolute_import import sys -DEFAULT_TRANSPORT = "kombu.transport.amqplib.Transport" +DEFAULT_TRANSPORT = "amqp" + +try: + import librabbitmq # noqa +except ImportError: + AMQP_TRANSPORT = "kombu.transport.amqplib.Transport" +else: + AMQP_TRANSPORT = "kombu.transport.librabbitmq.Transport" def _ghettoq(name, new, alias=None): @@ -36,7 +43,7 @@ def _ghettoq(name, new, alias=None): TRANSPORT_ALIASES = { - "amqp": "kombu.transport.amqplib.Transport", + "amqp": AMQP_TRANSPORT, "amqplib": "kombu.transport.amqplib.Transport", "librabbitmq": "kombu.transport.librabbitmq.Transport", "pika": "kombu.transport.pika2.Transport", diff --git a/requirements/default.txt b/requirements/default.txt index 9d7aebdb..891b9ed2 100644 --- a/requirements/default.txt +++ b/requirements/default.txt @@ -1,2 +1,2 @@ anyjson>=0.3.1 -amqplib>=1.0 +librabbitmq>=0.9.3 diff --git a/setup.py b/setup.py index 1dbe27eb..7308f844 100644 --- a/setup.py +++ b/setup.py @@ -100,6 +100,17 @@ if os.path.exists("README.rst"): else: long_description = "See http://pypi.python.org/pypi/kombu" +install_requires = ["anyjson>=0.3.1"] + +is_jython = sys.platform.startswith("java") +is_pypy = hasattr(sys, "pypy_version_info") +is_py3k = sys.version_info[0] == 3 +is_win = platform.system() == "Windows" +if is_jython or is_pypy or is_py3k or is_win: + install_requires.append("amqplib>=1.0.1") +else: + install_requires.append("librabbitmq>=0.9.3") + setup( name='kombu', version=meta["VERSION"], @@ -112,10 +123,7 @@ setup( data_files=data_files, zip_safe=False, test_suite="nose.collector", - install_requires=[ - 'anyjson>=0.3.1', - 'amqplib>=1.0', - ], + install_requires=install_requires, tests_require=tests_require, classifiers=[ "Development Status :: 5 - Production/Stable",