cmlenz@1: #!/usr/bin/env python cmlenz@1: # -*- coding: utf-8 -*- cmlenz@1: # cmlenz@897: # Copyright (C) 2006-2010 Edgewall Software cmlenz@1: # All rights reserved. cmlenz@1: # cmlenz@1: # This software is licensed as described in the file COPYING, which cmlenz@1: # you should have received as part of this distribution. The terms cmlenz@230: # are also available at http://genshi.edgewall.org/wiki/License. cmlenz@1: # cmlenz@1: # This software consists of voluntary contributions made by many cmlenz@1: # individuals. For the exact contribution history, see the revision cmlenz@230: # history and logs, available at http://genshi.edgewall.org/log/. cmlenz@1: cmlenz@382: from distutils.cmd import Command cmlenz@541: from distutils.command.build_ext import build_ext athomas@673: from distutils.errors import CCompilerError, DistutilsPlatformError cmlenz@382: import doctest cmlenz@382: from glob import glob cmlenz@382: import os cmlenz@84: try: cmlenz@541: from setuptools import setup, Extension, Feature jonas@786: from setuptools.command.bdist_egg import bdist_egg cmlenz@84: except ImportError: cmlenz@541: from distutils.core import setup, Extension cmlenz@541: Feature = None jonas@786: bdist_egg = None cmlenz@426: import sys cmlenz@1: cmlenz@585: sys.path.append(os.path.join('doc', 'common')) cmlenz@585: try: cmlenz@585: from doctools import build_doc, test_doc cmlenz@585: except ImportError: cmlenz@585: build_doc = test_doc = None cmlenz@394: jonas@786: _speedup_available = False cmlenz@394: hodgestar@954: is_pypy = hasattr(sys, 'pypy_version_info') cmlenz@897: cmlenz@541: class optional_build_ext(build_ext): cmlenz@541: # This class allows C extension building to fail. athomas@673: def run(self): athomas@673: try: athomas@673: build_ext.run(self) hodgestar@929: except DistutilsPlatformError: hodgestar@929: _etype, e, _tb = sys.exc_info() cmlenz@795: self._unavailable(e) athomas@673: cmlenz@541: def build_extension(self, ext): cmlenz@541: try: cmlenz@541: build_ext.build_extension(self, ext) jonas@786: global _speedup_available jonas@786: _speedup_available = True hodgestar@929: except CCompilerError: hodgestar@929: _etype, e, _tb = sys.exc_info() cmlenz@795: self._unavailable(e) athomas@673: cmlenz@795: def _unavailable(self, exc): cmlenz@853: print('*' * 70) cmlenz@853: print("""WARNING: cmlenz@541: An optional C extension could not be compiled, speedups will not be cmlenz@853: available.""") cmlenz@853: print('*' * 70) cmlenz@853: print(exc) cmlenz@541: cmlenz@541: cmlenz@541: if Feature: cmlenz@541: speedups = Feature( cmlenz@866: "optional C speed-enhancements", hodgestar@954: standard = not is_pypy, cmlenz@541: ext_modules = [ cmlenz@541: Extension('genshi._speedups', ['genshi/_speedups.c']), cmlenz@541: ], cmlenz@541: ) cmlenz@541: else: cmlenz@541: speedups = None cmlenz@541: jonas@786: jonas@786: # Setuptools need some help figuring out if the egg is "zip_safe" or not jonas@786: if bdist_egg: jonas@786: class my_bdist_egg(bdist_egg): jonas@786: def zip_safe(self): jonas@786: return not _speedup_available and bdist_egg.zip_safe(self) jonas@786: jonas@786: jonas@786: cmdclass = {'build_doc': build_doc, 'test_doc': test_doc, jonas@786: 'build_ext': optional_build_ext} jonas@786: if bdist_egg: jonas@786: cmdclass['bdist_egg'] = my_bdist_egg jonas@786: cmlenz@795: hodgestar@929: # Use 2to3 if we're running under Python 3 (with Distribute) hodgestar@929: extra = {} hodgestar@929: if sys.version_info >= (3,): hodgestar@929: extra['use_2to3'] = True hodgestar@929: extra['convert_2to3_doctests'] = [] hodgestar@929: extra['use_2to3_fixers'] = ['fixes'] hodgestar@929: # Install genshi template tests hodgestar@929: extra['include_package_data'] = True hodgestar@988: hodgestar@988: hodgestar@988: # include tests for python3 setup.py test (needed when creating hodgestar@988: # source distributions on python2 too so that they work on python3) hodgestar@988: packages = [ hodgestar@988: 'genshi', 'genshi.filters', 'genshi.template', hodgestar@988: 'genshi.tests', 'genshi.filters.tests', hodgestar@988: 'genshi.template.tests', hodgestar@988: 'genshi.template.tests.templates', hodgestar@988: ] hodgestar@929: hodgestar@929: cmlenz@1: setup( cmlenz@230: name = 'Genshi', hodgestar@986: version = '0.8', cmlenz@599: description = 'A toolkit for generation of output for the web', cmlenz@148: long_description = \ cmlenz@452: """Genshi is a Python library that provides an integrated set of cmlenz@452: components for parsing, generating, and processing HTML, XML or cmlenz@452: other textual content for output generation on the web. The major cmlenz@452: feature is a template language, which is heavily inspired by Kid.""", cmlenz@148: author = 'Edgewall Software', cmlenz@148: author_email = 'info@edgewall.org', cmlenz@148: license = 'BSD', cmlenz@230: url = 'http://genshi.edgewall.org/', cmlenz@256: download_url = 'http://genshi.edgewall.org/wiki/Download', cmlenz@148: cmlenz@124: classifiers = [ cmlenz@124: 'Development Status :: 4 - Beta', cmlenz@124: 'Environment :: Web Environment', cmlenz@124: 'Intended Audience :: Developers', cmlenz@124: 'License :: OSI Approved :: BSD License', cmlenz@124: 'Operating System :: OS Independent', cmlenz@124: 'Programming Language :: Python', hodgestar@978: 'Programming Language :: Python :: 2', hodgestar@929: 'Programming Language :: Python :: 3', cmlenz@124: 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', cmlenz@124: 'Topic :: Software Development :: Libraries :: Python Modules', cmlenz@124: 'Topic :: Text Processing :: Markup :: HTML', cmlenz@124: 'Topic :: Text Processing :: Markup :: XML' cmlenz@124: ], cmlenz@215: keywords = ['python.templating.engines'], hodgestar@929: packages = packages, cmlenz@230: test_suite = 'genshi.tests.suite', cmlenz@84: cmlenz@530: extras_require = { cmlenz@530: 'i18n': ['Babel>=0.8'], cmlenz@530: 'plugin': ['setuptools>=0.6a2'] cmlenz@530: }, cmlenz@4: entry_points = """ cmlenz@528: [babel.extractors] cmlenz@530: genshi = genshi.filters.i18n:extract[i18n] cmlenz@528: cmlenz@4: [python.templating.engines] cmlenz@336: genshi = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] cmlenz@336: genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] cmlenz@336: genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin] cmlenz@4: """, cmlenz@382: cmlenz@541: features = {'speedups': speedups}, hodgestar@929: cmdclass = cmdclass, hodgestar@929: hodgestar@929: **extra cmlenz@1: )