setup.py 5.3 KB

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