annotate setup.py @ 744:cd6624cf2f7c trunk

Lots of `Transformer` cleanup: - Content-insertion transformations (before, after, etc.) now accept a callable. - `.prepend()` now ''only'' operates on elements. Previously it also operated on `OUTSIDE` marked events. - Where it makes sense, transformations are now ''consistently'' applied to individually selected objects in the document, rather than on any contiguous selection. This means that adjacent selected elements will be treated individually rather than as a whole. - Transformations should now consistently work on the context node. - `.substitute()` now defaults to a count of 0 (ie. all) rather than 1. This is to be consistent with Python's regex substitution. - `ATTR` events now have a `kind` of `ATTR` in addition to having this as their `mark`. - Added the `BREAK` `mark`. This allows cuts of otherwise seamlessly joined objects to be operated on. - Added a full test suite.
author athomas
date Mon, 09 Jun 2008 06:39:46 +0000
parents 4bc6741b2811
children 46d3b965a05b 8718e1e94c1c ea46fb523485
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 #
719
4bc6741b2811 Fix copyright years.
cmlenz
parents: 673
diff changeset
4 # Copyright (C) 2006-2008 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
541
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
16 from distutils.command.build_ext import build_ext
673
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
17 from distutils.errors import CCompilerError, DistutilsPlatformError
382
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
18 import doctest
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
19 from glob import glob
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
20 import os
84
0a1843b2c096 Make dependency of the setup script on setuptools optional.
cmlenz
parents: 66
diff changeset
21 try:
541
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
22 from setuptools import setup, Extension, Feature
84
0a1843b2c096 Make dependency of the setup script on setuptools optional.
cmlenz
parents: 66
diff changeset
23 except ImportError:
541
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
24 from distutils.core import setup, Extension
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
25 Feature = None
426
a1955bc39924 Add epydoc-based API doc generation to the build.
cmlenz
parents: 394
diff changeset
26 import sys
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
27
585
db133252d1ff Documentation stuff moved to a common shared repository.
cmlenz
parents: 541
diff changeset
28 sys.path.append(os.path.join('doc', 'common'))
db133252d1ff Documentation stuff moved to a common shared repository.
cmlenz
parents: 541
diff changeset
29 try:
db133252d1ff Documentation stuff moved to a common shared repository.
cmlenz
parents: 541
diff changeset
30 from doctools import build_doc, test_doc
db133252d1ff Documentation stuff moved to a common shared repository.
cmlenz
parents: 541
diff changeset
31 except ImportError:
db133252d1ff Documentation stuff moved to a common shared repository.
cmlenz
parents: 541
diff changeset
32 build_doc = test_doc = None
394
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
33
cab6b0256019 Minor doc fixes.
cmlenz
parents: 382
diff changeset
34
541
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
35 class optional_build_ext(build_ext):
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
36 # This class allows C extension building to fail.
673
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
37 def run(self):
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
38 try:
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
39 build_ext.run(self)
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
40 except DistutilsPlatformError:
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
41 self._unavailable()
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
42
541
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
43 def build_extension(self, ext):
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
44 try:
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
45 build_ext.build_extension(self, ext)
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
46 except CCompilerError, x:
673
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
47 self._unavailable()
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
48
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
49 def _unavailable(self):
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
50 print '*' * 70
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
51 print """WARNING:
541
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
52 An optional C extension could not be compiled, speedups will not be
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
53 available."""
673
ae54722b00d1 Ignore missing compiler errors on Windows. Fixes #174 and #165.
athomas
parents: 599
diff changeset
54 print '*' * 70
541
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
55
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
56
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
57 if Feature:
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
58 speedups = Feature(
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
59 "optionial C speed-enhancements",
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
60 standard = True,
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
61 ext_modules = [
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
62 Extension('genshi._speedups', ['genshi/_speedups.c']),
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
63 ],
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
64 )
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
65 else:
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
66 speedups = None
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
67
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
68 setup(
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
69 name = 'Genshi',
455
190ffd36b6bb Bump up version number on trunk.
cmlenz
parents: 452
diff changeset
70 version = '0.5',
599
eaf2a3171e12 Get rid of the previously overemphasized term ?stream-based? in the tagline, which seems to turn some people off.
cmlenz
parents: 596
diff changeset
71 description = 'A toolkit for generation of output for the web',
148
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
72 long_description = \
452
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
73 """Genshi is a Python library that provides an integrated set of
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
74 components for parsing, generating, and processing HTML, XML or
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
75 other textual content for output generation on the web. The major
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
76 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
77 author = 'Edgewall Software',
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
78 author_email = 'info@edgewall.org',
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
79 license = 'BSD',
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
80 url = 'http://genshi.edgewall.org/',
256
693a228bf1c7 Fix download URL.
cmlenz
parents: 255
diff changeset
81 download_url = 'http://genshi.edgewall.org/wiki/Download',
148
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
82 zip_safe = True,
dcc9dc25bc59 Added changelog file, plus some README and setup tweaks.
cmlenz
parents: 145
diff changeset
83
124
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
84 classifiers = [
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
85 'Development Status :: 4 - Beta',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
86 'Environment :: Web Environment',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
87 'Intended Audience :: Developers',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
88 'License :: OSI Approved :: BSD License',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
89 'Operating System :: OS Independent',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
90 'Programming Language :: Python',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
91 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
92 'Topic :: Software Development :: Libraries :: Python Modules',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
93 'Topic :: Text Processing :: Markup :: HTML',
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
94 'Topic :: Text Processing :: Markup :: XML'
a9a8db67bb5a Add Trove classifiers and download URL to `setup.py`.
cmlenz
parents: 84
diff changeset
95 ],
215
94120e6b0ce4 A couple of minor XPath fixes.
cmlenz
parents: 189
diff changeset
96 keywords = ['python.templating.engines'],
452
a89368769b82 Add `filters` package in `setup.py`.
cmlenz
parents: 426
diff changeset
97 packages = ['genshi', 'genshi.filters', 'genshi.template'],
230
84168828b074 Renamed Markup to Genshi in repository.
cmlenz
parents: 215
diff changeset
98 test_suite = 'genshi.tests.suite',
84
0a1843b2c096 Make dependency of the setup script on setuptools optional.
cmlenz
parents: 66
diff changeset
99
530
78039a4c2f57 Add extra for I18n.
cmlenz
parents: 528
diff changeset
100 extras_require = {
78039a4c2f57 Add extra for I18n.
cmlenz
parents: 528
diff changeset
101 'i18n': ['Babel>=0.8'],
78039a4c2f57 Add extra for I18n.
cmlenz
parents: 528
diff changeset
102 'plugin': ['setuptools>=0.6a2']
78039a4c2f57 Add extra for I18n.
cmlenz
parents: 528
diff changeset
103 },
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
104 entry_points = """
528
24df908da22d Integrated [http://babel.edgewall.org/ Babel] message extraction plugin, and added I18n doc page.
cmlenz
parents: 508
diff changeset
105 [babel.extractors]
530
78039a4c2f57 Add extra for I18n.
cmlenz
parents: 528
diff changeset
106 genshi = genshi.filters.i18n:extract[i18n]
528
24df908da22d Integrated [http://babel.edgewall.org/ Babel] message extraction plugin, and added I18n doc page.
cmlenz
parents: 508
diff changeset
107
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
108 [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
109 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
110 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
111 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
112 """,
382
2682dabbcd04 * Added documentation for the various stream event kinds.
cmlenz
parents: 336
diff changeset
113
541
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
114 features = {'speedups': speedups},
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
115 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc,
773d8c470e82 Merged cspeedups branch into trunk.
cmlenz
parents: 530
diff changeset
116 'build_ext': optional_build_ext}
1
5479aae32f5a Initial import.
cmlenz
parents:
diff changeset
117 )
Copyright (C) 2012-2017 Edgewall Software