annotate setup.py @ 191:a16401b8b989

Rename command-line script to avoid conflict with the OpenBabel project. Closes #34.
author cmlenz
date Fri, 29 Jun 2007 14:50:20 +0000
parents e927dffc9ab4
children bd8b1301b27e
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'
100
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
28 user_options = [
118
3d9cb4beec8b Moved doc config into a subdirectory, and added a `--force` option to the `build_doc` command.
cmlenz
parents: 100
diff changeset
29 ('force', None,
3d9cb4beec8b Moved doc config into a subdirectory, and added a `--force` option to the `build_doc` command.
cmlenz
parents: 100
diff changeset
30 "force regeneration even if no reStructuredText files have changed"),
100
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
31 ('without-apidocs', None,
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
32 "whether to skip the generation of API documentaton"),
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
33 ]
118
3d9cb4beec8b Moved doc config into a subdirectory, and added a `--force` option to the `build_doc` command.
cmlenz
parents: 100
diff changeset
34 boolean_options = ['force', 'without-apidocs']
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
35
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
36 def initialize_options(self):
118
3d9cb4beec8b Moved doc config into a subdirectory, and added a `--force` option to the `build_doc` command.
cmlenz
parents: 100
diff changeset
37 self.force = False
100
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
38 self.without_apidocs = False
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
39
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
40 def finalize_options(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
41 pass
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
42
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
43 def run(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
44 from docutils.core import publish_cmdline
42
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
45 from docutils.nodes import raw
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
46 from docutils.parsers import rst
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
47
118
3d9cb4beec8b Moved doc config into a subdirectory, and added a `--force` option to the `build_doc` command.
cmlenz
parents: 100
diff changeset
48 docutils_conf = os.path.join('doc', 'conf', 'docutils.ini')
3d9cb4beec8b Moved doc config into a subdirectory, and added a `--force` option to the `build_doc` command.
cmlenz
parents: 100
diff changeset
49 epydoc_conf = os.path.join('doc', 'conf', 'epydoc.ini')
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
50
42
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
51 try:
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
52 from pygments import highlight
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
53 from pygments.lexers import get_lexer_by_name
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
54 from pygments.formatters import HtmlFormatter
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
55
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
56 def code_block(name, arguments, options, content, lineno,
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
57 content_offset, block_text, state, state_machine):
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
58 lexer = get_lexer_by_name(arguments[0])
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
59 html = highlight('\n'.join(content), lexer, HtmlFormatter())
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
60 return [raw('', html, format='html')]
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
61 code_block.arguments = (1, 0, 0)
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
62 code_block.options = {'language' : rst.directives.unchanged}
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
63 code_block.content = 1
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
64 rst.directives.register_directive('code-block', code_block)
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
65 except ImportError:
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
66 print 'Pygments not installed, syntax highlighting disabled'
cf94e70a77f3 Syntax highlighting for the docs.
cmlenz
parents: 14
diff changeset
67
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
68 for source in glob('doc/*.txt'):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
69 dest = os.path.splitext(source)[0] + '.html'
118
3d9cb4beec8b Moved doc config into a subdirectory, and added a `--force` option to the `build_doc` command.
cmlenz
parents: 100
diff changeset
70 if self.force or not os.path.exists(dest) or \
3d9cb4beec8b Moved doc config into a subdirectory, and added a `--force` option to the `build_doc` command.
cmlenz
parents: 100
diff changeset
71 os.path.getmtime(dest) < os.path.getmtime(source):
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
72 print 'building documentation file %s' % dest
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
73 publish_cmdline(writer_name='html',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
74 argv=['--config=%s' % docutils_conf, source,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
75 dest])
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
76
100
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
77 if not self.without_apidocs:
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
78 try:
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
79 from epydoc import cli
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
80 old_argv = sys.argv[1:]
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
81 sys.argv[1:] = [
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
82 '--config=%s' % epydoc_conf,
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
83 '--no-private', # epydoc bug, not read from config
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
84 '--simple-term',
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
85 '--verbose'
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
86 ]
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
87 cli.cli()
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
88 sys.argv[1:] = old_argv
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
89
100
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
90 except ImportError:
3eaa652b1216 Add `--without-apidocs` switch to `build_doc` command for quicker doc-edit/review cycles.
cmlenz
parents: 59
diff changeset
91 print 'epydoc not installed, skipping API documentation.'
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
92
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
93
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
94 class test_doc(Command):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
95 description = 'Tests the code examples in the documentation'
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
96 user_options = []
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
97
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
98 def initialize_options(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
99 pass
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
100
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
101 def finalize_options(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
102 pass
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
103
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
104 def run(self):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
105 for filename in glob('doc/*.txt'):
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
106 print 'testing documentation file %s' % filename
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
107 doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS)
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
108
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
109
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
110 setup(
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
111 name = 'Babel',
143
e4df809caede Bump up version number on trunk.
cmlenz
parents: 140
diff changeset
112 version = '0.9',
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
113 description = 'Internationalization utilities',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
114 long_description = \
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
115 """A collection of tools for internationalizing Python applications.""",
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
116 author = 'Edgewall Software',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
117 author_email = 'info@edgewall.org',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
118 license = 'BSD',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
119 url = 'http://babel.edgewall.org/',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
120 download_url = 'http://babel.edgewall.org/wiki/Download',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
121 zip_safe = False,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
122
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
123 classifiers = [
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
124 'Development Status :: 4 - Beta',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
125 'Environment :: Web Environment',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
126 'Intended Audience :: Developers',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
127 'License :: OSI Approved :: BSD License',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
128 'Operating System :: OS Independent',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
129 'Programming Language :: Python',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
130 'Topic :: Software Development :: Libraries :: Python Modules',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
131 ],
56
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
132 packages = ['babel', 'babel.messages'],
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
133 package_data = {'babel': ['localedata/*.dat']},
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
134 test_suite = 'babel.tests.suite',
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
135
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
136 entry_points = """
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
137 [console_scripts]
191
a16401b8b989 Rename command-line script to avoid conflict with the OpenBabel project. Closes #34.
cmlenz
parents: 183
diff changeset
138 pybabel = babel.messages.frontend:main
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
139
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
140 [distutils.commands]
162
661cb602781d Add MO file generation. Closes #21.
cmlenz
parents: 143
diff changeset
141 compile_catalog = babel.messages.frontend:compile_catalog
56
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
142 extract_messages = babel.messages.frontend:extract_messages
183
e927dffc9ab4 The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents: 162
diff changeset
143 init_catalog = babel.messages.frontend:init_catalog
e927dffc9ab4 The frontends now provide ways to update existing translations catalogs from a template. Closes #22.
cmlenz
parents: 162
diff changeset
144 update_catalog = babel.messages.frontend:update_catalog
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
145
51
3664c93860f1 Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
cmlenz
parents: 42
diff changeset
146 [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
147 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
148
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
149 [babel.extractors]
140
3b3a487cc46f Genshi extraction method has moved to Genshi project. Closes #13.
cmlenz
parents: 118
diff changeset
150 ignore = babel.messages.extract:extract_nothing
56
27d55a07c897 Rename the `babel.catalog` package to `babel.messages` for consistency with the other package names.
cmlenz
parents: 54
diff changeset
151 python = babel.messages.extract:extract_python
3
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
152 """,
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
153
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
154 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc}
e9eaddab598e Import of initial code base.
cmlenz
parents:
diff changeset
155 )
Copyright (C) 2012-2017 Edgewall Software