Edgewall Software

source: tags/0.6.1/setup.py

Last change on this file was 1232, checked in by hodgestar, 11 years ago

Set version and drop egg_info in preparation for tagging.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.2 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3#
4# Copyright (C) 2006-2010 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
15from distutils.cmd import Command
16from distutils.command.build_ext import build_ext
17from distutils.errors import CCompilerError, DistutilsPlatformError
18import doctest
19from glob import glob
20import os
21try:
22    from setuptools import setup, Extension, Feature
23    from setuptools.command.bdist_egg import bdist_egg
24except ImportError:
25    from distutils.core import setup, Extension
26    Feature = None
27    bdist_egg = None
28import sys
29
30sys.path.append(os.path.join('doc', 'common'))
31try:
32    from doctools import build_doc, test_doc
33except ImportError:
34    build_doc = test_doc = None
35
36_speedup_available = False
37
38
39class optional_build_ext(build_ext):
40    # This class allows C extension building to fail.
41    def run(self):
42        try:
43            build_ext.run(self)
44        except DistutilsPlatformError, e:
45            self._unavailable(e)
46
47    def build_extension(self, ext):
48        try:
49            build_ext.build_extension(self, ext)
50            global _speedup_available
51            _speedup_available = True
52        except CCompilerError, e:
53            self._unavailable(e)
54
55    def _unavailable(self, exc):
56        print('*' * 70)
57        print("""WARNING:
58An optional C extension could not be compiled, speedups will not be
59available.""")
60        print('*' * 70)
61        print(exc)
62
63
64if Feature:
65    speedups = Feature(
66        "optional C speed-enhancements",
67        standard = False,
68        ext_modules = [
69            Extension('genshi._speedups', ['genshi/_speedups.c']),
70        ],
71    )
72else:
73    speedups = None
74
75
76# Setuptools need some help figuring out if the egg is "zip_safe" or not
77if bdist_egg:
78    class my_bdist_egg(bdist_egg):
79        def zip_safe(self):
80            return not _speedup_available and bdist_egg.zip_safe(self)
81
82
83cmdclass = {'build_doc': build_doc, 'test_doc': test_doc,
84            'build_ext': optional_build_ext}
85if bdist_egg:
86    cmdclass['bdist_egg'] = my_bdist_egg
87
88
89setup(
90    name = 'Genshi',
91    version = '0.6.1',
92    description = 'A toolkit for generation of output for the web',
93    long_description = \
94"""Genshi is a Python library that provides an integrated set of
95components for parsing, generating, and processing HTML, XML or
96other textual content for output generation on the web. The major
97feature is a template language, which is heavily inspired by Kid.""",
98    author = 'Edgewall Software',
99    author_email = 'info@edgewall.org',
100    license = 'BSD',
101    url = 'http://genshi.edgewall.org/',
102    download_url = 'http://genshi.edgewall.org/wiki/Download',
103
104    classifiers = [
105        'Development Status :: 4 - Beta',
106        'Environment :: Web Environment',
107        'Intended Audience :: Developers',
108        'License :: OSI Approved :: BSD License',
109        'Operating System :: OS Independent',
110        'Programming Language :: Python',
111        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
112        'Topic :: Software Development :: Libraries :: Python Modules',
113        'Topic :: Text Processing :: Markup :: HTML',
114        'Topic :: Text Processing :: Markup :: XML'
115    ],
116    keywords = ['python.templating.engines'],
117    packages = ['genshi', 'genshi.filters', 'genshi.template'],
118    test_suite = 'genshi.tests.suite',
119
120    extras_require = {
121        'i18n': ['Babel>=0.8'],
122        'plugin': ['setuptools>=0.6a2']
123    },
124    entry_points = """
125    [babel.extractors]
126    genshi = genshi.filters.i18n:extract[i18n]
127   
128    [python.templating.engines]
129    genshi = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin]
130    genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin]
131    genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin]
132    """,
133
134    features = {'speedups': speedups},
135    cmdclass = cmdclass
136)
Note: See TracBrowser for help on using the repository browser.