setup.py 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import codecs
  4. import sys
  5. import os
  6. import platform
  7. try:
  8. from setuptools import setup, find_packages, Command
  9. except ImportError:
  10. from ez_setup import use_setuptools
  11. use_setuptools()
  12. from setuptools import setup, find_packages, Command
  13. import celery as distmeta
  14. class RunTests(Command):
  15. description = "Run the django test suite from the testproj dir."
  16. user_options = []
  17. def initialize_options(self):
  18. pass
  19. def finalize_options(self):
  20. pass
  21. def run(self):
  22. self.run_tests()
  23. def run_tests(self):
  24. this_dir = os.getcwd()
  25. testproj_dir = os.path.join(this_dir, "testproj")
  26. os.chdir(testproj_dir)
  27. sys.path.append(testproj_dir)
  28. from django.core.management import execute_manager
  29. os.environ["DJANGO_SETTINGS_MODULE"] = os.environ.get(
  30. "DJANGO_SETTINGS_MODULE", "settings")
  31. settings_file = os.environ["DJANGO_SETTINGS_MODULE"]
  32. settings_mod = __import__(settings_file, {}, {}, [''])
  33. execute_manager(settings_mod, argv=[
  34. __file__, "test"])
  35. os.chdir(this_dir)
  36. class QuickRunTests(RunTests):
  37. quicktest_envs = dict(SKIP_RLIMITS=1)
  38. def run(self):
  39. for env_name, env_value in self.quicktest_envs.items():
  40. os.environ[env_name] = str(env_value)
  41. self.run_tests()
  42. install_requires = []
  43. try:
  44. import django
  45. except ImportError:
  46. install_requires.append("django")
  47. try:
  48. import importlib
  49. except ImportError:
  50. install_requires.append("importlib")
  51. install_requires.extend([
  52. "python-dateutil",
  53. "anyjson",
  54. "carrot>=0.10.0",
  55. "django-picklefield",
  56. "billiard>=0.2.1"])
  57. # python-daemon doesn't run on windows, so check current platform
  58. if platform.system() == "Windows":
  59. print("""
  60. ***WARNING***
  61. I see you are using windows. You will not be able to run celery
  62. in daemon mode with the --detach parameter.""")
  63. else:
  64. install_requires.append("python-daemon>=1.4.8")
  65. py_version_info = sys.version_info
  66. py_major_version = py_version_info[0]
  67. py_minor_version = py_version_info[1]
  68. if (py_major_version == 2 and py_minor_version <=5):
  69. install_requires.append("multiprocessing==2.6.2.1")
  70. if (py_major_version == 2 and py_minor_version <= 4):
  71. install_requires.append("uuid")
  72. if os.path.exists("README.rst"):
  73. long_description = codecs.open("README.rst", "r", "utf-8").read()
  74. else:
  75. long_description = "See http://pypi.python.org/pypi/celery"
  76. setup(
  77. name='celery',
  78. version=distmeta.__version__,
  79. description=distmeta.__doc__,
  80. author=distmeta.__author__,
  81. author_email=distmeta.__contact__,
  82. url=distmeta.__homepage__,
  83. platforms=["any"],
  84. license="BSD",
  85. packages=find_packages(exclude=['ez_setup']),
  86. scripts=["bin/celeryd", "bin/celeryinit", "bin/celerybeat"],
  87. zip_safe=False,
  88. install_requires=install_requires,
  89. extra_requires={
  90. "Tyrant": ["pytyrant"],
  91. },
  92. cmdclass = {"test": RunTests, "quicktest": QuickRunTests},
  93. classifiers=[
  94. "Development Status :: 5 - Production/Stable",
  95. "Framework :: Django",
  96. "Operating System :: OS Independent",
  97. "Programming Language :: Python",
  98. "Environment :: No Input/Output (Daemon)",
  99. "Intended Audience :: Developers",
  100. "License :: OSI Approved :: BSD License",
  101. "Operating System :: POSIX",
  102. "Topic :: Communications",
  103. "Topic :: System :: Distributed Computing",
  104. "Topic :: Software Development :: Libraries :: Python Modules",
  105. ],
  106. long_description=long_description,
  107. )