setup.py 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import sys
  5. import codecs
  6. import platform
  7. if sys.version_info < (2, 5):
  8. raise Exception("Celery requires Python 2.5 or higher.")
  9. try:
  10. from setuptools import setup, find_packages
  11. from setuptools.command.test import test
  12. except ImportError:
  13. raise
  14. from ez_setup import use_setuptools
  15. use_setuptools()
  16. from setuptools import setup, find_packages # noqa
  17. from setuptools.command.test import test # noqa
  18. NAME = "celery"
  19. entrypoints = {}
  20. extra = {}
  21. # -*- Classifiers -*-
  22. classes = """
  23. Development Status :: 5 - Production/Stable
  24. License :: OSI Approved :: BSD License
  25. Topic :: System :: Distributed Computing
  26. Topic :: Software Development :: Object Brokering
  27. Intended Audience :: Developers
  28. Intended Audience :: Information Technology
  29. Intended Audience :: Science/Research
  30. Environment :: No Input/Output (Daemon)
  31. Environment :: Console
  32. Programming Language :: Python
  33. Programming Language :: Python :: 2
  34. Programming Language :: Python :: 2.5
  35. Programming Language :: Python :: 2.6
  36. Programming Language :: Python :: 2.7
  37. Programming Language :: Python :: 3
  38. Programming Language :: Python :: 3.2
  39. Programming Language :: Python :: Implementation :: CPython
  40. Programming Language :: Python :: Implementation :: PyPy
  41. Programming Language :: Python :: Implementation :: Jython
  42. Operating System :: OS Independent
  43. Operating System :: POSIX
  44. Operating System :: Microsoft :: Windows
  45. Operating System :: MacOS :: MacOS X
  46. """
  47. classifiers = [s.strip() for s in classes.split('\n') if s]
  48. # -*- Python 3 -*-
  49. is_py3k = sys.version_info >= (3, 0)
  50. if is_py3k:
  51. extra.update(use_2to3=True)
  52. # -*- Distribution Meta -*-
  53. import re
  54. re_meta = re.compile(r'__(\w+?)__\s*=\s*(.*)')
  55. re_vers = re.compile(r'VERSION\s*=\s*\((.*?)\)')
  56. re_doc = re.compile(r'^"""(.+?)"""')
  57. rq = lambda s: s.strip("\"'")
  58. def add_default(m):
  59. attr_name, attr_value = m.groups()
  60. return ((attr_name, rq(attr_value)), )
  61. def add_version(m):
  62. v = list(map(rq, m.groups()[0].split(", ")))
  63. return (("VERSION", ".".join(v[0:3]) + "".join(v[3:])), )
  64. def add_doc(m):
  65. return (("doc", m.groups()[0]), )
  66. pats = {re_meta: add_default,
  67. re_vers: add_version,
  68. re_doc: add_doc}
  69. here = os.path.abspath(os.path.dirname(__file__))
  70. meta_fh = open(os.path.join(here, "celery/__init__.py"))
  71. try:
  72. meta = {}
  73. for line in meta_fh:
  74. if line.strip() == '# -eof meta-':
  75. break
  76. for pattern, handler in pats.items():
  77. m = pattern.match(line.strip())
  78. if m:
  79. meta.update(handler(m))
  80. finally:
  81. meta_fh.close()
  82. # -*- Custom Commands -*-
  83. class quicktest(test):
  84. extra_env = dict(SKIP_RLIMITS=1, QUICKTEST=1)
  85. def run(self, *args, **kwargs):
  86. for env_name, env_value in self.extra_env.items():
  87. os.environ[env_name] = str(env_value)
  88. test.run(self, *args, **kwargs)
  89. # -*- Installation Dependencies -*-
  90. install_requires = []
  91. try:
  92. import importlib # noqa
  93. except ImportError:
  94. install_requires.append("importlib")
  95. install_requires.extend([
  96. "billiard>=2.7.3.2",
  97. "anyjson>=0.3.1",
  98. "kombu>=2.1.5,<3.0",
  99. ])
  100. if is_py3k:
  101. install_requires.append("python-dateutil>=2.0")
  102. else:
  103. install_requires.append("python-dateutil>=1.5,<2.0")
  104. py_version = sys.version_info
  105. is_jython = sys.platform.startswith("java")
  106. is_pypy = hasattr(sys, "pypy_version_info")
  107. if sys.version_info < (2, 7):
  108. install_requires.append("ordereddict") # Replacement for the ordered dict
  109. if is_jython:
  110. install_requires.append("threadpool")
  111. install_requires.append("simplejson")
  112. # -*- Tests Requires -*-
  113. tests_require = ["nose", "nose-cover3", "sqlalchemy", "mock", "cl"]
  114. if sys.version_info < (2, 7):
  115. tests_require.append("unittest2")
  116. elif sys.version_info <= (2, 5):
  117. tests_require.append("simplejson")
  118. # -*- Long Description -*-
  119. if os.path.exists("README.rst"):
  120. long_description = codecs.open("README.rst", "r", "utf-8").read()
  121. else:
  122. long_description = "See http://pypi.python.org/pypi/celery"
  123. # -*- Entry Points -*- #
  124. console_scripts = entrypoints["console_scripts"] = [
  125. 'celery = celery.bin.celery:main',
  126. 'celeryd = celery.bin.celeryd:main',
  127. 'celerybeat = celery.bin.celerybeat:main',
  128. 'camqadm = celery.bin.camqadm:main',
  129. 'celeryev = celery.bin.celeryev:main',
  130. 'celeryctl = celery.bin.celeryctl:main',
  131. 'celeryd-multi = celery.bin.celeryd_multi:main',
  132. ]
  133. # bundles: Only relevant for Celery developers.
  134. entrypoints["bundle.bundles"] = ["celery = celery.contrib.bundles:bundles"]
  135. # -*- %%% -*-
  136. setup(
  137. name=NAME,
  138. version=meta["VERSION"],
  139. description=meta["doc"],
  140. author=meta["author"],
  141. author_email=meta["contact"],
  142. url=meta["homepage"],
  143. platforms=["any"],
  144. license="BSD",
  145. packages=find_packages(exclude=['ez_setup', 'tests', 'tests.*']),
  146. zip_safe=False,
  147. install_requires=install_requires,
  148. tests_require=tests_require,
  149. test_suite="nose.collector",
  150. cmdclass={"quicktest": quicktest},
  151. classifiers=classifiers,
  152. entry_points=entrypoints,
  153. long_description=long_description,
  154. **extra)