| 1 | #!/usr/bin/env python |
|---|
| 2 | # -*- coding: utf-8 -*- |
|---|
| 3 | # |
|---|
| 4 | # Copyright (C) 2006-2008 Edgewall Software |
|---|
| 5 | # All rights reserved. |
|---|
| 6 | # |
|---|
| 7 | # This software is licensed as described in the file COPYING, which |
|---|
| 8 | # you should have received as part of this distribution. The terms |
|---|
| 9 | # are also available at http://genshi.edgewall.org/wiki/License. |
|---|
| 10 | # |
|---|
| 11 | # This software consists of voluntary contributions made by many |
|---|
| 12 | # individuals. For the exact contribution history, see the revision |
|---|
| 13 | # history and logs, available at http://genshi.edgewall.org/log/. |
|---|
| 14 | |
|---|
| 15 | from distutils.cmd import Command |
|---|
| 16 | from distutils.command.build_ext import build_ext |
|---|
| 17 | from distutils.errors import CCompilerError, DistutilsPlatformError |
|---|
| 18 | import doctest |
|---|
| 19 | from glob import glob |
|---|
| 20 | import os |
|---|
| 21 | try: |
|---|
| 22 | from setuptools import setup, Extension, Feature |
|---|
| 23 | except ImportError: |
|---|
| 24 | from distutils.core import setup, Extension |
|---|
| 25 | Feature = None |
|---|
| 26 | import sys |
|---|
| 27 | |
|---|
| 28 | sys.path.append(os.path.join('doc', 'common')) |
|---|
| 29 | try: |
|---|
| 30 | from doctools import build_doc, test_doc |
|---|
| 31 | except ImportError: |
|---|
| 32 | build_doc = test_doc = None |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | class optional_build_ext(build_ext): |
|---|
| 36 | # This class allows C extension building to fail. |
|---|
| 37 | def run(self): |
|---|
| 38 | try: |
|---|
| 39 | build_ext.run(self) |
|---|
| 40 | except DistutilsPlatformError: |
|---|
| 41 | self._unavailable() |
|---|
| 42 | |
|---|
| 43 | def build_extension(self, ext): |
|---|
| 44 | try: |
|---|
| 45 | build_ext.build_extension(self, ext) |
|---|
| 46 | except CCompilerError, x: |
|---|
| 47 | self._unavailable() |
|---|
| 48 | |
|---|
| 49 | def _unavailable(self): |
|---|
| 50 | print '*' * 70 |
|---|
| 51 | print """WARNING: |
|---|
| 52 | An optional C extension could not be compiled, speedups will not be |
|---|
| 53 | available.""" |
|---|
| 54 | print '*' * 70 |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | if Feature: |
|---|
| 58 | speedups = Feature( |
|---|
| 59 | "optionial C speed-enhancements", |
|---|
| 60 | standard = True, |
|---|
| 61 | ext_modules = [ |
|---|
| 62 | Extension('genshi._speedups', ['genshi/_speedups.c']), |
|---|
| 63 | ], |
|---|
| 64 | ) |
|---|
| 65 | else: |
|---|
| 66 | speedups = None |
|---|
| 67 | |
|---|
| 68 | setup( |
|---|
| 69 | name = 'Genshi', |
|---|
| 70 | version = '0.5', |
|---|
| 71 | description = 'A toolkit for generation of output for the web', |
|---|
| 72 | long_description = \ |
|---|
| 73 | """Genshi is a Python library that provides an integrated set of |
|---|
| 74 | components for parsing, generating, and processing HTML, XML or |
|---|
| 75 | other textual content for output generation on the web. The major |
|---|
| 76 | feature is a template language, which is heavily inspired by Kid.""", |
|---|
| 77 | author = 'Edgewall Software', |
|---|
| 78 | author_email = 'info@edgewall.org', |
|---|
| 79 | license = 'BSD', |
|---|
| 80 | url = 'http://genshi.edgewall.org/', |
|---|
| 81 | download_url = 'http://genshi.edgewall.org/wiki/Download', |
|---|
| 82 | zip_safe = True, |
|---|
| 83 | |
|---|
| 84 | classifiers = [ |
|---|
| 85 | 'Development Status :: 4 - Beta', |
|---|
| 86 | 'Environment :: Web Environment', |
|---|
| 87 | 'Intended Audience :: Developers', |
|---|
| 88 | 'License :: OSI Approved :: BSD License', |
|---|
| 89 | 'Operating System :: OS Independent', |
|---|
| 90 | 'Programming Language :: Python', |
|---|
| 91 | 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', |
|---|
| 92 | 'Topic :: Software Development :: Libraries :: Python Modules', |
|---|
| 93 | 'Topic :: Text Processing :: Markup :: HTML', |
|---|
| 94 | 'Topic :: Text Processing :: Markup :: XML' |
|---|
| 95 | ], |
|---|
| 96 | keywords = ['python.templating.engines'], |
|---|
| 97 | packages = ['genshi', 'genshi.filters', 'genshi.template'], |
|---|
| 98 | test_suite = 'genshi.tests.suite', |
|---|
| 99 | |
|---|
| 100 | extras_require = { |
|---|
| 101 | 'i18n': ['Babel>=0.8'], |
|---|
| 102 | 'plugin': ['setuptools>=0.6a2'] |
|---|
| 103 | }, |
|---|
| 104 | entry_points = """ |
|---|
| 105 | [babel.extractors] |
|---|
| 106 | genshi = genshi.filters.i18n:extract[i18n] |
|---|
| 107 | |
|---|
| 108 | [python.templating.engines] |
|---|
| 109 | genshi = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] |
|---|
| 110 | genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] |
|---|
| 111 | genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin] |
|---|
| 112 | """, |
|---|
| 113 | |
|---|
| 114 | features = {'speedups': speedups}, |
|---|
| 115 | cmdclass = {'build_doc': build_doc, 'test_doc': test_doc, |
|---|
| 116 | 'build_ext': optional_build_ext} |
|---|
| 117 | ) |
|---|