Mercurial > genshi > mirror
annotate setup.py @ 597:19345798ba5e stable-0.4.x 0.4.4
Ported [710] to 0.4.x branch.
author | cmlenz |
---|---|
date | Tue, 14 Aug 2007 08:58:56 +0000 |
parents | 5f381cf31246 |
children | f35e1080420c |
rev | line source |
---|---|
1 | 1 #!/usr/bin/env python |
2 # -*- coding: utf-8 -*- | |
3 # | |
597 | 4 # Copyright (C) 2006-2007 Edgewall Software |
1 | 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 | |
230 | 9 # are also available at http://genshi.edgewall.org/wiki/License. |
1 | 10 # |
11 # This software consists of voluntary contributions made by many | |
12 # individuals. For the exact contribution history, see the revision | |
230 | 13 # history and logs, available at http://genshi.edgewall.org/log/. |
1 | 14 |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
15 from distutils.cmd import Command |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
16 import doctest |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
17 from glob import glob |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
18 import os |
84
0a1843b2c096
Make dependency of the setup script on setuptools optional.
cmlenz
parents:
66
diff
changeset
|
19 try: |
145
47bbd9d2a5af
* Fix error in expression evaluation when the expression evaluates to an iterable that does not produce event tuples.
cmlenz
parents:
129
diff
changeset
|
20 from setuptools import setup |
84
0a1843b2c096
Make dependency of the setup script on setuptools optional.
cmlenz
parents:
66
diff
changeset
|
21 except ImportError: |
0a1843b2c096
Make dependency of the setup script on setuptools optional.
cmlenz
parents:
66
diff
changeset
|
22 from distutils.core import setup |
426 | 23 import sys |
1 | 24 |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
25 |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
26 class build_doc(Command): |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
27 description = 'Builds the documentation' |
532 | 28 user_options = [ |
29 ('force', None, | |
30 "force regeneration even if no reStructuredText files have changed"), | |
31 ('without-apidocs', None, | |
32 "whether to skip the generation of API documentaton"), | |
33 ] | |
34 boolean_options = ['force', 'without-apidocs'] | |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
35 |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
36 def initialize_options(self): |
532 | 37 self.force = False |
38 self.without_apidocs = False | |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
39 |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
40 def finalize_options(self): |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
41 pass |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
42 |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
43 def run(self): |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
44 from docutils.core import publish_cmdline |
511 | 45 from docutils.nodes import raw |
46 from docutils.parsers import rst | |
47 | |
532 | 48 docutils_conf = os.path.join('doc', 'conf', 'docutils.ini') |
49 epydoc_conf = os.path.join('doc', 'conf', 'epydoc.ini') | |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
50 |
511 | 51 try: |
52 from pygments import highlight | |
53 from pygments.lexers import get_lexer_by_name | |
54 from pygments.formatters import HtmlFormatter | |
55 | |
56 def code_block(name, arguments, options, content, lineno, | |
57 content_offset, block_text, state, state_machine): | |
58 lexer = get_lexer_by_name(arguments[0]) | |
59 html = highlight('\n'.join(content), lexer, HtmlFormatter()) | |
60 return [raw('', html, format='html')] | |
61 code_block.arguments = (1, 0, 0) | |
62 code_block.options = {'language' : rst.directives.unchanged} | |
63 code_block.content = 1 | |
64 rst.directives.register_directive('code-block', code_block) | |
65 except ImportError: | |
66 print 'Pygments not installed, syntax highlighting disabled' | |
67 | |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
68 for source in glob('doc/*.txt'): |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
69 dest = os.path.splitext(source)[0] + '.html' |
532 | 70 if self.force or not os.path.exists(dest) or \ |
71 os.path.getmtime(dest) < os.path.getmtime(source): | |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
72 print 'building documentation file %s' % dest |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
73 publish_cmdline(writer_name='html', |
426 | 74 argv=['--config=%s' % docutils_conf, source, |
75 dest]) | |
76 | |
532 | 77 if not self.without_apidocs: |
78 try: | |
79 from epydoc import cli | |
80 old_argv = sys.argv[1:] | |
81 sys.argv[1:] = [ | |
82 '--config=%s' % epydoc_conf, | |
83 '--no-private', # epydoc bug, not read from config | |
84 '--simple-term', | |
85 '--verbose' | |
86 ] | |
87 cli.cli() | |
88 sys.argv[1:] = old_argv | |
89 | |
90 except ImportError: | |
91 print 'epydoc not installed, skipping API documentation.' | |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
92 |
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
93 |
394 | 94 class test_doc(Command): |
95 description = 'Tests the code examples in the documentation' | |
96 user_options = [] | |
97 | |
98 def initialize_options(self): | |
99 pass | |
100 | |
101 def finalize_options(self): | |
102 pass | |
103 | |
104 def run(self): | |
105 for filename in glob('doc/*.txt'): | |
106 print 'testing documentation file %s' % filename | |
107 doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS) | |
108 | |
109 | |
1 | 110 setup( |
230 | 111 name = 'Genshi', |
573 | 112 version = '0.4.4', |
230 | 113 description = 'A toolkit for stream-based generation of output for the web', |
148
dcc9dc25bc59
Added changelog file, plus some README and setup tweaks.
cmlenz
parents:
145
diff
changeset
|
114 long_description = \ |
452 | 115 """Genshi is a Python library that provides an integrated set of |
116 components for parsing, generating, and processing HTML, XML or | |
117 other textual content for output generation on the web. The major | |
118 feature is a template language, which is heavily inspired by Kid.""", | |
148
dcc9dc25bc59
Added changelog file, plus some README and setup tweaks.
cmlenz
parents:
145
diff
changeset
|
119 author = 'Edgewall Software', |
dcc9dc25bc59
Added changelog file, plus some README and setup tweaks.
cmlenz
parents:
145
diff
changeset
|
120 author_email = 'info@edgewall.org', |
dcc9dc25bc59
Added changelog file, plus some README and setup tweaks.
cmlenz
parents:
145
diff
changeset
|
121 license = 'BSD', |
230 | 122 url = 'http://genshi.edgewall.org/', |
256 | 123 download_url = 'http://genshi.edgewall.org/wiki/Download', |
148
dcc9dc25bc59
Added changelog file, plus some README and setup tweaks.
cmlenz
parents:
145
diff
changeset
|
124 zip_safe = True, |
dcc9dc25bc59
Added changelog file, plus some README and setup tweaks.
cmlenz
parents:
145
diff
changeset
|
125 |
124
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
126 classifiers = [ |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
127 'Development Status :: 4 - Beta', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
128 'Environment :: Web Environment', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
129 'Intended Audience :: Developers', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
130 'License :: OSI Approved :: BSD License', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
131 'Operating System :: OS Independent', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
132 'Programming Language :: Python', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
133 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
134 'Topic :: Software Development :: Libraries :: Python Modules', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
135 'Topic :: Text Processing :: Markup :: HTML', |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
136 'Topic :: Text Processing :: Markup :: XML' |
a9a8db67bb5a
Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents:
84
diff
changeset
|
137 ], |
215 | 138 keywords = ['python.templating.engines'], |
452 | 139 packages = ['genshi', 'genshi.filters', 'genshi.template'], |
230 | 140 test_suite = 'genshi.tests.suite', |
84
0a1843b2c096
Make dependency of the setup script on setuptools optional.
cmlenz
parents:
66
diff
changeset
|
141 |
532 | 142 extras_require = { |
143 'i18n': ['Babel>=0.8'], | |
144 'plugin': ['setuptools>=0.6a2'] | |
145 }, | |
4
49364e784c47
Added first stab of an implementation of the !TurboGears [http://www.turbogears.org/docs/plugins/template.html plugin API for template engines], and also a !TurboGears-based example using this plugin. Both written by Matt Good.
cmlenz
parents:
1
diff
changeset
|
146 entry_points = """ |
532 | 147 [babel.extractors] |
148 genshi = genshi.filters.i18n:extract[i18n] | |
149 | |
4
49364e784c47
Added first stab of an implementation of the !TurboGears [http://www.turbogears.org/docs/plugins/template.html plugin API for template engines], and also a !TurboGears-based example using this plugin. Both written by Matt Good.
cmlenz
parents:
1
diff
changeset
|
150 [python.templating.engines] |
336
7763f7aec949
Refactoring: `genshi.template` is now a package, it was getting way to crowded in that file.
cmlenz
parents:
265
diff
changeset
|
151 genshi = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] |
7763f7aec949
Refactoring: `genshi.template` is now a package, it was getting way to crowded in that file.
cmlenz
parents:
265
diff
changeset
|
152 genshi-markup = genshi.template.plugin:MarkupTemplateEnginePlugin[plugin] |
7763f7aec949
Refactoring: `genshi.template` is now a package, it was getting way to crowded in that file.
cmlenz
parents:
265
diff
changeset
|
153 genshi-text = genshi.template.plugin:TextTemplateEnginePlugin[plugin] |
4
49364e784c47
Added first stab of an implementation of the !TurboGears [http://www.turbogears.org/docs/plugins/template.html plugin API for template engines], and also a !TurboGears-based example using this plugin. Both written by Matt Good.
cmlenz
parents:
1
diff
changeset
|
154 """, |
382
2682dabbcd04
* Added documentation for the various stream event kinds.
cmlenz
parents:
336
diff
changeset
|
155 |
495 | 156 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc} |
1 | 157 ) |