annotate setup.py @ 589:a8bfe7828ce6 stable-0.4.x

Ported [702] to 0.4.x branch.
author cmlenz
date Thu, 09 Aug 2007 14:59:52 +0000
parents 7fa1192c9da8
children 2c52ec2c9d7e
rev   line source
1
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
1 #!/usr/bin/env python
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
2 # -*- coding: utf-8 -*-
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
3 #
66
822089ae65ce Switch copyright to Edgewall and URLs to markup.edgewall.org.
cmlenz
parents: 27
diff changeset
4 # Copyright (C) 2006 Edgewall Software
1
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
5 # All rights reserved.
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
6 #
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
7 # This software is licensed as described in the file COPYING, which
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
8 # you should have received as part of this distribution. The terms
230
24757b771651 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
9 # are also available at http://genshi.edgewall.org/wiki/License.
1
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
10 #
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
11 # This software consists of voluntary contributions made by many
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
12 # individuals. For the exact contribution history, see the revision
230
24757b771651 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
13 # history and logs, available at http://genshi.edgewall.org/log/.
1
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
14
382
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
15 from distutils.cmd import Command
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
16 import doctest
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
17 from glob import glob
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
18 import os
84
894576e2b813 Make dependency of the setup script on setuptools optional.
cmlenz
parents: 66
diff changeset
19 try:
145
56d534eb53f9 * 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
894576e2b813 Make dependency of the setup script on setuptools optional.
cmlenz
parents: 66
diff changeset
21 except ImportError:
894576e2b813 Make dependency of the setup script on setuptools optional.
cmlenz
parents: 66
diff changeset
22 from distutils.core import setup
426
a0711da164ac Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
23 import sys
1
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
24
382
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
25
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
26 class build_doc(Command):
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
27 description = 'Builds the documentation'
532
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
28 user_options = [
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
29 ('force', None,
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
30 "force regeneration even if no reStructuredText files have changed"),
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
31 ('without-apidocs', None,
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
32 "whether to skip the generation of API documentaton"),
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
33 ]
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
34 boolean_options = ['force', 'without-apidocs']
382
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
35
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
36 def initialize_options(self):
532
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
37 self.force = False
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
38 self.without_apidocs = False
382
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
39
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
40 def finalize_options(self):
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
41 pass
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
42
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
43 def run(self):
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
44 from docutils.core import publish_cmdline
511
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
45 from docutils.nodes import raw
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
46 from docutils.parsers import rst
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
47
532
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
48 docutils_conf = os.path.join('doc', 'conf', 'docutils.ini')
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
49 epydoc_conf = os.path.join('doc', 'conf', 'epydoc.ini')
382
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
50
511
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
51 try:
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
52 from pygments import highlight
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
53 from pygments.lexers import get_lexer_by_name
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
54 from pygments.formatters import HtmlFormatter
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
55
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
56 def code_block(name, arguments, options, content, lineno,
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
57 content_offset, block_text, state, state_machine):
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
58 lexer = get_lexer_by_name(arguments[0])
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
59 html = highlight('\n'.join(content), lexer, HtmlFormatter())
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
60 return [raw('', html, format='html')]
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
61 code_block.arguments = (1, 0, 0)
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
62 code_block.options = {'language' : rst.directives.unchanged}
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
63 code_block.content = 1
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
64 rst.directives.register_directive('code-block', code_block)
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
65 except ImportError:
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
66 print 'Pygments not installed, syntax highlighting disabled'
1a29617a5d87 Ported [611:614] to 0.4.x branch.
cmlenz
parents: 495
diff changeset
67
382
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
68 for source in glob('doc/*.txt'):
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
69 dest = os.path.splitext(source)[0] + '.html'
532
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
70 if self.force or not os.path.exists(dest) or \
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
71 os.path.getmtime(dest) < os.path.getmtime(source):
382
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
72 print 'building documentation file %s' % dest
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
73 publish_cmdline(writer_name='html',
426
a0711da164ac Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
74 argv=['--config=%s' % docutils_conf, source,
a0711da164ac Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
75 dest])
a0711da164ac Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
76
532
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
77 if not self.without_apidocs:
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
78 try:
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
79 from epydoc import cli
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
80 old_argv = sys.argv[1:]
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
81 sys.argv[1:] = [
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
82 '--config=%s' % epydoc_conf,
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
83 '--no-private', # epydoc bug, not read from config
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
84 '--simple-term',
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
85 '--verbose'
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
86 ]
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
87 cli.cli()
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
88 sys.argv[1:] = old_argv
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
89
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
90 except ImportError:
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
91 print 'epydoc not installed, skipping API documentation.'
382
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
92
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
93
394
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
94 class test_doc(Command):
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
95 description = 'Tests the code examples in the documentation'
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
96 user_options = []
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
97
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
98 def initialize_options(self):
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
99 pass
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
100
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
101 def finalize_options(self):
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
102 pass
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
103
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
104 def run(self):
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
105 for filename in glob('doc/*.txt'):
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
106 print 'testing documentation file %s' % filename
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
107 doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS)
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
108
ebc7c1a3bc4d Minor doc fixes.
cmlenz
parents: 382
diff changeset
109
1
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
110 setup(
230
24757b771651 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
111 name = 'Genshi',
573
7fa1192c9da8 Bump up version number on 0.4.x branch.
cmlenz
parents: 532
diff changeset
112 version = '0.4.4',
230
24757b771651 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
113 description = 'A toolkit for stream-based generation of output for the web',
148
a0a52cf4e4de Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
114 long_description = \
452
0ed55216e8f2 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
115 """Genshi is a Python library that provides an integrated set of
0ed55216e8f2 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
116 components for parsing, generating, and processing HTML, XML or
0ed55216e8f2 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
117 other textual content for output generation on the web. The major
0ed55216e8f2 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
118 feature is a template language, which is heavily inspired by Kid.""",
148
a0a52cf4e4de Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
119 author = 'Edgewall Software',
a0a52cf4e4de Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
120 author_email = 'info@edgewall.org',
a0a52cf4e4de Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
121 license = 'BSD',
230
24757b771651 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
122 url = 'http://genshi.edgewall.org/',
256
3ea3977c8c4d Fix download URL.
cmlenz
parents: 255
diff changeset
123 download_url = 'http://genshi.edgewall.org/wiki/Download',
148
a0a52cf4e4de Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
124 zip_safe = True,
a0a52cf4e4de Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
125
124
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
126 classifiers = [
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
127 'Development Status :: 4 - Beta',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
128 'Environment :: Web Environment',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
129 'Intended Audience :: Developers',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
130 'License :: OSI Approved :: BSD License',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
131 'Operating System :: OS Independent',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
132 'Programming Language :: Python',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
133 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
134 'Topic :: Software Development :: Libraries :: Python Modules',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
135 'Topic :: Text Processing :: Markup :: HTML',
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
136 'Topic :: Text Processing :: Markup :: XML'
9a2acebe84f7 Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
137 ],
215
e92135672812 A couple of minor XPath fixes.
cmlenz
parents: 189
diff changeset
138 keywords = ['python.templating.engines'],
452
0ed55216e8f2 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
139 packages = ['genshi', 'genshi.filters', 'genshi.template'],
230
24757b771651 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
140 test_suite = 'genshi.tests.suite',
84
894576e2b813 Make dependency of the setup script on setuptools optional.
cmlenz
parents: 66
diff changeset
141
532
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
142 extras_require = {
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
143 'i18n': ['Babel>=0.8'],
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
144 'plugin': ['setuptools>=0.6a2']
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
145 },
4
f8612f05af99 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
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
147 [babel.extractors]
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
148 genshi = genshi.filters.i18n:extract[i18n]
f9ad40cae2f7 Ported [634:637] to 0.4.x branch.
cmlenz
parents: 511
diff changeset
149
4
f8612f05af99 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
5f2c7782cd8a 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]
5f2c7782cd8a 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]
5f2c7782cd8a 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
f8612f05af99 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
d7da3fba7faf * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
155
495
90eecd360b18 Ported [594:596] to 0.4.x branch.
cmlenz
parents: 491
diff changeset
156 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc}
1
821114ec4f69 Initial import.
cmlenz
parents:
diff changeset
157 )
Copyright (C) 2012-2017 Edgewall Software