annotate setup.py @ 77:ea0f11b08d53

Fixed MIME type of new doc page.
author cmlenz
date Fri, 08 Jun 2007 21:54:56 +0000
parents e68fd956ebce
children 3eaa652b1216
rev   line source
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
1 #!/usr/bin/env python
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
2 # -*- coding: utf-8 -*-
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
3 #
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
4 # Copyright (C) 2007 Edgewall Software
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
5 # All rights reserved.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
6 #
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
7 # This software is licensed as described in the file COPYING, which
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
8 # you should have received as part of this distribution. The terms
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
9 # are also available at http://babel.edgewall.org/wiki/License.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
10 #
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
11 # This software consists of voluntary contributions made by many
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
12 # individuals. For the exact contribution history, see the revision
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
13 # history and logs, available at http://babel.edgewall.org/log/.
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
14
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 3
diff changeset
15 from distutils.cmd import Command
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
16 import doctest
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
17 from glob import glob
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
18 import os
14
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 3
diff changeset
19 try:
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 3
diff changeset
20 from setuptools import setup
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 3
diff changeset
21 except ImportError:
29ef15a6fd75 * Removed pkg_resources/setuptools requirement from various places.
cmlenz
parents: 3
diff changeset
22 from distutils.core import setup
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
23 import sys
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
24
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
25
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
26 class build_doc(Command):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
27 description = 'Builds the documentation'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
28 user_options = []
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
29
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
30 def initialize_options(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
31 pass
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
32
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
33 def finalize_options(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
34 pass
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
35
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
36 def run(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
37 from docutils.core import publish_cmdline
42
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
38 from docutils.nodes import raw
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
39 from docutils.parsers import rst
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
40
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
41 docutils_conf = os.path.join('doc', 'docutils.conf')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
42 epydoc_conf = os.path.join('doc', 'epydoc.conf')
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
43
42
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
44 try:
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
45 from pygments import highlight
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
46 from pygments.lexers import get_lexer_by_name
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
47 from pygments.formatters import HtmlFormatter
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
48
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
49 def code_block(name, arguments, options, content, lineno,
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
50 content_offset, block_text, state, state_machine):
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
51 lexer = get_lexer_by_name(arguments[0])
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
52 html = highlight('\n'.join(content), lexer, HtmlFormatter())
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
53 return [raw('', html, format='html')]
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
54 code_block.arguments = (1, 0, 0)
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
55 code_block.options = {'language' : rst.directives.unchanged}
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
56 code_block.content = 1
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
57 rst.directives.register_directive('code-block', code_block)
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
58 except ImportError:
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
59 print 'Pygments not installed, syntax highlighting disabled'
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
60
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
61 for source in glob('doc/*.txt'):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
62 dest = os.path.splitext(source)[0] + '.html'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
63 if not os.path.exists(dest) or \
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
64 os.path.getmtime(dest) < os.path.getmtime(source):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
65 print 'building documentation file %s' % dest
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
66 publish_cmdline(writer_name='html',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
67 argv=['--config=%s' % docutils_conf, source,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
68 dest])
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
69
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
70 try:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
71 from epydoc import cli
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
72 old_argv = sys.argv[1:]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
73 sys.argv[1:] = [
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
74 '--config=%s' % epydoc_conf,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
75 '--no-private', # epydoc bug, not read from config
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
76 '--simple-term',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
77 '--verbose'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
78 ]
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
79 cli.cli()
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
80 sys.argv[1:] = old_argv
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
81
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
82 except ImportError:
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
83 print 'epydoc not installed, skipping API documentation.'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
84
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
85
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
86 class test_doc(Command):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
87 description = 'Tests the code examples in the documentation'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
88 user_options = []
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
89
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
90 def initialize_options(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
91 pass
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
92
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
93 def finalize_options(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
94 pass
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
95
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
96 def run(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
97 for filename in glob('doc/*.txt'):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
98 print 'testing documentation file %s' % filename
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
99 doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
100
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
101
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
102 setup(
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
103 name = 'Babel',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
104 version = '0.1',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
105 description = 'Internationalization utilities',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
106 long_description = \
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
107 """A collection of tools for internationalizing Python applications.""",
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
108 author = 'Edgewall Software',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
109 author_email = 'info@edgewall.org',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
110 license = 'BSD',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
111 url = 'http://babel.edgewall.org/',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
112 download_url = 'http://babel.edgewall.org/wiki/Download',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
113 zip_safe = False,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
114
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
115 classifiers = [
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
116 'Development Status :: 4 - Beta',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
117 'Environment :: Web Environment',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
118 'Intended Audience :: Developers',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
119 'License :: OSI Approved :: BSD License',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
120 'Operating System :: OS Independent',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
121 'Programming Language :: Python',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
122 'Topic :: Software Development :: Libraries :: Python Modules',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
123 ],
56
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
124 packages = ['babel', 'babel.messages'],
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
125 package_data = {'babel': ['localedata/*.dat']},
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
126 test_suite = 'babel.tests.suite',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
127
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
128 entry_points = """
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
129 [console_scripts]
56
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
130 babel = babel.messages.frontend:main
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
131
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
132 [distutils.commands]
56
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
133 extract_messages = babel.messages.frontend:extract_messages
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
134 new_catalog = babel.messages.frontend:new_catalog
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
135
51
3664c93860f1 Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents: 42
diff changeset
136 [distutils.setup_keywords]
56
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
137 message_extractors = babel.messages.frontend:check_message_extractors
51
3664c93860f1 Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents: 42
diff changeset
138
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
139 [babel.extractors]
56
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
140 genshi = babel.messages.extract:extract_genshi
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
141 python = babel.messages.extract:extract_python
59
e68fd956ebce * The `extract_messages` distutils command now operators on configurable input directories again, instead of the complete current directory. The `input_dirs` default to the package directories.
cmlenz
parents: 56
diff changeset
142 ignore = babel.messages.extract:extract_nothing
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
143 """,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
144
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
145 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc}
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
146 )
Copyright (C) 2012-2017 Edgewall Software