annotate setup.py @ 519:9e11fa7f4603 trunk

Cut and copy transformer operations can now operate on selected attributes. Also added an example of inserting content to the documentation.
author athomas
date Thu, 07 Jun 2007 18:03:02 +0000
parents 5fbc1cde74d6
children 24df908da22d
rev   line source
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
1 #!/usr/bin/env python
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
2 # -*- coding: utf-8 -*-
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
3 #
66
59eb24184e9c Switch copyright to Edgewall and URLs to markup.edgewall.org.
cmlenz
parents: 27
diff changeset
4 # Copyright (C) 2006 Edgewall Software
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
5 # All rights reserved.
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
6 #
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
7 # This software is licensed as described in the file COPYING, which
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
8 # you should have received as part of this distribution. The terms
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
9 # are also available at http://genshi.edgewall.org/wiki/License.
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
10 #
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
11 # This software consists of voluntary contributions made by many
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
12 # individuals. For the exact contribution history, see the revision
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
13 # history and logs, available at http://genshi.edgewall.org/log/.
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
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
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
23 import sys
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
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'
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
28 user_options = []
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
29
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
30 def initialize_options(self):
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
31 pass
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
32
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
33 def finalize_options(self):
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
34 pass
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 run(self):
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
37 from docutils.core import publish_cmdline
508
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
38 from docutils.nodes import raw
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
39 from docutils.parsers import rst
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
40
426
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
41 docutils_conf = os.path.join('doc', 'docutils.conf')
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
42 epydoc_conf = os.path.join('doc', 'epydoc.conf')
382
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
43
508
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
44 try:
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
45 from pygments import highlight
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
46 from pygments.lexers import get_lexer_by_name
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
47 from pygments.formatters import HtmlFormatter
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
48
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
49 def code_block(name, arguments, options, content, lineno,
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
50 content_offset, block_text, state, state_machine):
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
51 lexer = get_lexer_by_name(arguments[0])
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
52 html = highlight('\n'.join(content), lexer, HtmlFormatter())
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
53 return [raw('', html, format='html')]
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
54 code_block.arguments = (1, 0, 0)
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
55 code_block.options = {'language' : rst.directives.unchanged}
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
56 code_block.content = 1
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
57 rst.directives.register_directive('code-block', code_block)
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
58 except ImportError:
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
59 print 'Pygments not installed, syntax highlighting disabled'
5fbc1cde74d6 Enable syntax highlighting (with Pygments) on doc page.
cmlenz
parents: 492
diff changeset
60
382
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
61 for source in glob('doc/*.txt'):
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
62 dest = os.path.splitext(source)[0] + '.html'
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
63 if not os.path.exists(dest) or \
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
64 os.path.getmtime(dest) < os.path.getmtime(source):
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
65 print 'building documentation file %s' % dest
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
66 publish_cmdline(writer_name='html',
426
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
67 argv=['--config=%s' % docutils_conf, source,
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
68 dest])
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
69
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
70 try:
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
71 from epydoc import cli
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
72 old_argv = sys.argv[1:]
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
73 sys.argv[1:] = [
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
74 '--config=%s' % epydoc_conf,
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
75 '--no-private', # epydoc bug, not read from config
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
76 '--simple-term',
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
77 '--verbose'
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
78 ]
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
79 cli.cli()
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
80 sys.argv[1:] = old_argv
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
81 except ImportError:
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
82 print 'epydoc not installed, skipping API documentation.'
382
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
83
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
84
394
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
85 class test_doc(Command):
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
86 description = 'Tests the code examples in the documentation'
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
87 user_options = []
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
88
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
89 def initialize_options(self):
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
90 pass
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
91
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
92 def finalize_options(self):
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
93 pass
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
94
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
95 def run(self):
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
96 for filename in glob('doc/*.txt'):
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
97 print 'testing documentation file %s' % filename
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
98 doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS)
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
99
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
100
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
101 setup(
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
102 name = 'Genshi',
455
190ffd36b6bb Bump up version number on trunk.
cmlenz
parents: 452
diff changeset
103 version = '0.5',
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
104 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
105 long_description = \
452
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
106 """Genshi is a Python library that provides an integrated set of
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
107 components for parsing, generating, and processing HTML, XML or
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
108 other textual content for output generation on the web. The major
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
109 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
110 author = 'Edgewall Software',
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
111 author_email = 'info@edgewall.org',
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
112 license = 'BSD',
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
113 url = 'http://genshi.edgewall.org/',
256
693a228bf1c7 Fix download URL.
cmlenz
parents: 255
diff changeset
114 download_url = 'http://genshi.edgewall.org/wiki/Download',
148
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
115 zip_safe = True,
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
116
124
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
117 classifiers = [
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
118 'Development Status :: 4 - Beta',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
119 'Environment :: Web Environment',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
120 'Intended Audience :: Developers',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
121 'License :: OSI Approved :: BSD License',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
122 'Operating System :: OS Independent',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
123 'Programming Language :: Python',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
124 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
125 'Topic :: Software Development :: Libraries :: Python Modules',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
126 'Topic :: Text Processing :: Markup :: HTML',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
127 'Topic :: Text Processing :: Markup :: XML'
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
128 ],
215
94120e6b0ce4 A couple of minor XPath fixes.
cmlenz
parents: 189
diff changeset
129 keywords = ['python.templating.engines'],
452
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
130 packages = ['genshi', 'genshi.filters', 'genshi.template'],
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
131 test_suite = 'genshi.tests.suite',
84
0a1843b2c096 Make dependency of the setup script on setuptools optional.
cmlenz
parents: 66
diff changeset
132
148
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
133 extras_require = {'plugin': ['setuptools>=0.6a2']},
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
134 entry_points = """
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
135 [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
136 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
137 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
138 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
139 """,
382
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
140
492
fd10321bb1ba Fix docstring typo.
cmlenz
parents: 455
diff changeset
141 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc}
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
142 )
Copyright (C) 2012-2017 Edgewall Software