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