setup.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. """
  2. FlaskBB
  3. =======
  4. FlaskBB is a forum software written in Python using the microframework Flask.
  5. And Easy to Setup
  6. -----------------
  7. .. code:: bash
  8. $ pip install -e .
  9. $ flaskbb install
  10. $ flaskbb runserver
  11. * Running on http://localhost:8080/
  12. Resources
  13. ---------
  14. * `website <https://flaskbb.org>`_
  15. * `source <https://github.com/sh4nks/flaskbb>`_
  16. * `issues <https://github.com/sh4nks/flaskbb/issues>`_
  17. """
  18. import ast
  19. import os
  20. import re
  21. import sys
  22. from setuptools import find_packages, setup
  23. from setuptools.command.test import test as TestCommand
  24. class PyTestCommand(TestCommand):
  25. user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
  26. def initialize_options(self):
  27. TestCommand.initialize_options(self)
  28. self.pytest_args = []
  29. def finalize_options(self):
  30. TestCommand.finalize_options(self)
  31. self.test_args = []
  32. self.test_suite = True
  33. def run_tests(self):
  34. import pytest # noqa
  35. errno = pytest.main(self.pytest_args)
  36. sys.exit(errno)
  37. def read(*parts):
  38. here = os.path.abspath(os.path.dirname(__file__))
  39. with open(os.path.join(here, *parts), 'r') as fp:
  40. return fp.read()
  41. def find_version(*file_paths):
  42. version_match = re.search(r'__version__\s+=\s+(.*)',
  43. read(*file_paths)).group(1)
  44. if version_match:
  45. return str(ast.literal_eval(version_match))
  46. raise RuntimeError("Unable to find version string.")
  47. def get_requirements(e=None):
  48. rf = "requirements.txt" if e is None else 'requirements-{}.txt'.format(e)
  49. r = read(rf)
  50. return [x.strip() for x in r.split('\n')
  51. if not x.startswith('#') and not x.startswith("-e")]
  52. install_requires = get_requirements()
  53. setup(
  54. name='FlaskBB',
  55. version=find_version("flaskbb", "__init__.py"),
  56. url='https://github.com/sh4nks/flaskbb/',
  57. license='BSD',
  58. author='Peter Justin',
  59. author_email='peter.justin@outlook.com',
  60. description='A classic Forum Software in Python using Flask.',
  61. long_description=__doc__,
  62. packages=find_packages(),
  63. include_package_data=True,
  64. zip_safe=False,
  65. platforms='any',
  66. install_requires=install_requires,
  67. entry_points='''
  68. [console_scripts]
  69. flaskbb=flaskbb.cli:flaskbb
  70. ''',
  71. test_suite='tests',
  72. tests_require=[
  73. 'py',
  74. 'pytest',
  75. 'pytest-cov',
  76. 'cov-core',
  77. 'coverage'
  78. ],
  79. classifiers=[
  80. 'Development Status :: 4 - Beta',
  81. 'Environment :: Web Environment',
  82. 'Intended Audience :: Developers, Users',
  83. 'License :: OSI Approved :: BSD License',
  84. 'Operating System :: OS Independent',
  85. 'Programming Language :: Python',
  86. 'Programming Language :: Python :: 3',
  87. 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
  88. 'Topic :: Software Development :: Libraries :: Python Modules'
  89. ],
  90. cmdclass={'test': PyTestCommand}
  91. )