setup.py 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # GNU MediaGoblin -- federated, autonomous media hosting
  2. # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS.
  3. #
  4. # This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. from __future__ import print_function
  17. from setuptools import setup, find_packages
  18. from io import open
  19. import os
  20. import re
  21. import sys
  22. PY2 = sys.version_info[0] == 2 # six is not installed yet
  23. READMEFILE = "README"
  24. VERSIONFILE = os.path.join("mediagoblin", "_version.py")
  25. VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]"
  26. def get_version():
  27. with open(VERSIONFILE, "rt") as fobj:
  28. verstrline = fobj.read()
  29. mo = re.search(VSRE, verstrline, re.M)
  30. if mo:
  31. return mo.group(1)
  32. else:
  33. raise RuntimeError("Unable to find version string in %s." %
  34. VERSIONFILE)
  35. pyversion_install_requires = []
  36. if PY2:
  37. pyversion_install_requires.append('sqlalchemy-migrate>=0.9.6')
  38. pyversion_install_requires.append('mock==1.0.1') # mock is in the stdlib for 3.3+
  39. # PyPI version (1.4.2) does not have proper Python 3 support
  40. pyversion_install_requires.append('ExifRead')
  41. install_requires = [
  42. 'waitress',
  43. 'alembic>=0.7.5',
  44. 'python-dateutil',
  45. 'wtforms',
  46. 'py-bcrypt',
  47. 'pytest>=2.3.1',
  48. 'pytest-xdist',
  49. 'werkzeug>=0.7',
  50. 'celery>=3.0',
  51. 'kombu',
  52. 'jinja2',
  53. 'Babel>=1.3',
  54. 'WebTest>=2.0.18',
  55. 'ConfigObj',
  56. 'Markdown',
  57. 'sqlalchemy',
  58. 'itsdangerous',
  59. 'pytz',
  60. 'sphinx',
  61. 'six',
  62. 'oauthlib',
  63. 'unidecode',
  64. 'jsonschema',
  65. 'PasteDeploy',
  66. 'PasteScript',
  67. 'requests>=2.6.0',
  68. 'pyld',
  69. # This is optional:
  70. # 'translitcodec',
  71. # For now we're expecting that users will install this from
  72. # their package managers.
  73. # 'lxml',
  74. # 'Pillow',
  75. ] + pyversion_install_requires
  76. dependency_links = []
  77. if not PY2:
  78. # PyPI version (1.4.2) does not have proper Python 3 support
  79. dependency_links.append('https://github.com/ianare/exif-py/zipball/develop#egg=ExifRead-2.0.0')
  80. install_requires.append('ExifRead>=2.0.0')
  81. with open(READMEFILE, encoding="utf-8") as fobj:
  82. long_description = fobj.read()
  83. try:
  84. setup(
  85. name="mediagoblin",
  86. version=get_version(),
  87. packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
  88. zip_safe=False,
  89. include_package_data = True,
  90. # scripts and dependencies
  91. install_requires=install_requires,
  92. dependency_links=dependency_links,
  93. test_suite='nose.collector',
  94. entry_points="""\
  95. [console_scripts]
  96. gmg = mediagoblin.gmg_commands:main_cli
  97. [paste.app_factory]
  98. app = mediagoblin.app:paste_app_factory
  99. [paste.server_runner]
  100. paste_server_selector = mediagoblin.app:paste_server_selector
  101. [paste.filter_app_factory]
  102. errors = mediagoblin.errormiddleware:mgoblin_error_middleware
  103. [zc.buildout]
  104. make_user_dev_dirs = mediagoblin.buildout_recipes:MakeUserDevDirs
  105. [babel.extractors]
  106. jinja2 = jinja2.ext:babel_extract
  107. """,
  108. license='AGPLv3',
  109. author='Free Software Foundation and contributors',
  110. author_email='cwebber@gnu.org',
  111. url="http://mediagoblin.org/",
  112. long_description=long_description,
  113. description='MediaGoblin is a web application for publishing all kinds of media',
  114. classifiers=[
  115. "Development Status :: 3 - Alpha",
  116. "Environment :: Web Environment",
  117. "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
  118. "Operating System :: OS Independent",
  119. "Programming Language :: Python",
  120. 'Programming Language :: Python :: 2',
  121. 'Programming Language :: Python :: 2.7',
  122. 'Programming Language :: Python :: 3',
  123. 'Programming Language :: Python :: 3.3',
  124. 'Programming Language :: Python :: 3.4',
  125. "Topic :: Internet :: WWW/HTTP :: Dynamic Content"
  126. ],
  127. )
  128. except TypeError as e:
  129. import sys
  130. # Check if the problem is caused by the sqlalchemy/setuptools conflict
  131. msg_as_str = str(e)
  132. if not (msg_as_str == 'dist must be a Distribution instance'):
  133. raise
  134. # If so, tell the user it is OK to just run the script again.
  135. print("\n\n---------- NOTE ----------", file=sys.stderr)
  136. print("The setup.py command you ran failed.\n", file=sys.stderr)
  137. print("It is a known possible failure. Just run it again. It works the "
  138. "second time.", file=sys.stderr)
  139. sys.exit(1)