Install librabbitmq if supported, and amqp points to lrmq if installed

This commit is contained in:
Ask Solem 2012-05-22 19:50:58 +01:00
parent 60d8ac1fbc
commit 4300eff0e9
3 changed files with 22 additions and 7 deletions

View File

@ -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",

View File

@ -1,2 +1,2 @@
anyjson>=0.3.1
amqplib>=1.0
librabbitmq>=0.9.3

View File

@ -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",