annotate setup.py @ 154:4d2117dfd7f5

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