setup.py 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. from setuptools import setup, find_packages
  2. from setuptools.command.test import test as TestCommand
  3. import os
  4. import re
  5. import sys
  6. v = open(os.path.join(os.path.dirname(__file__), 'mako', '__init__.py'))
  7. VERSION = re.compile(r".*__version__ = '(.*?)'", re.S).match(v.read()).group(1)
  8. v.close()
  9. readme = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
  10. if sys.version_info < (2, 6):
  11. raise Exception("Mako requires Python 2.6 or higher.")
  12. markupsafe_installs = (
  13. sys.version_info >= (2, 6) and sys.version_info < (3, 0)
  14. ) or sys.version_info >= (3, 3)
  15. install_requires = []
  16. if markupsafe_installs:
  17. install_requires.append('MarkupSafe>=0.9.2')
  18. try:
  19. import argparse
  20. except ImportError:
  21. install_requires.append('argparse')
  22. class PyTest(TestCommand):
  23. user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
  24. def initialize_options(self):
  25. TestCommand.initialize_options(self)
  26. self.pytest_args = []
  27. def finalize_options(self):
  28. TestCommand.finalize_options(self)
  29. self.test_args = []
  30. self.test_suite = True
  31. def run_tests(self):
  32. # import here, cause outside the eggs aren't loaded
  33. import pytest
  34. errno = pytest.main(self.pytest_args)
  35. sys.exit(errno)
  36. setup(name='Mako',
  37. version=VERSION,
  38. description="A super-fast templating language that borrows the \
  39. best ideas from the existing templating languages.",
  40. long_description=readme,
  41. classifiers=[
  42. 'Development Status :: 5 - Production/Stable',
  43. 'Environment :: Web Environment',
  44. 'Intended Audience :: Developers',
  45. 'Programming Language :: Python',
  46. 'Programming Language :: Python :: 3',
  47. "Programming Language :: Python :: Implementation :: CPython",
  48. "Programming Language :: Python :: Implementation :: PyPy",
  49. 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
  50. ],
  51. keywords='templates',
  52. author='Mike Bayer',
  53. author_email='mike@zzzcomputing.com',
  54. url='http://www.makotemplates.org/',
  55. license='MIT',
  56. packages=find_packages('.', exclude=['examples*', 'test*']),
  57. tests_require=['pytest', 'mock'],
  58. cmdclass={'test': PyTest},
  59. zip_safe=False,
  60. install_requires=install_requires,
  61. extras_require={},
  62. entry_points="""
  63. [python.templating.engines]
  64. mako = mako.ext.turbogears:TGPlugin
  65. [pygments.lexers]
  66. mako = mako.ext.pygmentplugin:MakoLexer
  67. html+mako = mako.ext.pygmentplugin:MakoHtmlLexer
  68. xml+mako = mako.ext.pygmentplugin:MakoXmlLexer
  69. js+mako = mako.ext.pygmentplugin:MakoJavascriptLexer
  70. css+mako = mako.ext.pygmentplugin:MakoCssLexer
  71. [babel.extractors]
  72. mako = mako.ext.babelplugin:extract
  73. [lingua.extractors]
  74. mako = mako.ext.linguaplugin:LinguaMakoExtractor
  75. [console_scripts]
  76. mako-render = mako.cmd:cmdline
  77. """
  78. )