setup.py 3.1 KB

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