Mercurial > babel > old > mirror
comparison setup.py @ 3:e9eaddab598e
Import of initial code base.
author | cmlenz |
---|---|
date | Tue, 29 May 2007 20:33:55 +0000 |
parents | |
children | 29ef15a6fd75 |
comparison
equal
deleted
inserted
replaced
2:203a60d8c1d6 | 3:e9eaddab598e |
---|---|
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 | |
15 import doctest | |
16 from glob import glob | |
17 import os | |
18 from setuptools import find_packages, setup, Command | |
19 import sys | |
20 | |
21 | |
22 class build_doc(Command): | |
23 description = 'Builds the documentation' | |
24 user_options = [] | |
25 | |
26 def initialize_options(self): | |
27 pass | |
28 | |
29 def finalize_options(self): | |
30 pass | |
31 | |
32 def run(self): | |
33 from docutils.core import publish_cmdline | |
34 docutils_conf = os.path.join('doc', 'docutils.conf') | |
35 epydoc_conf = os.path.join('doc', 'epydoc.conf') | |
36 | |
37 for source in glob('doc/*.txt'): | |
38 dest = os.path.splitext(source)[0] + '.html' | |
39 if not os.path.exists(dest) or \ | |
40 os.path.getmtime(dest) < os.path.getmtime(source): | |
41 print 'building documentation file %s' % dest | |
42 publish_cmdline(writer_name='html', | |
43 argv=['--config=%s' % docutils_conf, source, | |
44 dest]) | |
45 | |
46 try: | |
47 from epydoc import cli | |
48 old_argv = sys.argv[1:] | |
49 sys.argv[1:] = [ | |
50 '--config=%s' % epydoc_conf, | |
51 '--no-private', # epydoc bug, not read from config | |
52 '--simple-term', | |
53 '--verbose' | |
54 ] | |
55 cli.cli() | |
56 sys.argv[1:] = old_argv | |
57 | |
58 except ImportError: | |
59 print 'epydoc not installed, skipping API documentation.' | |
60 | |
61 | |
62 class test_doc(Command): | |
63 description = 'Tests the code examples in the documentation' | |
64 user_options = [] | |
65 | |
66 def initialize_options(self): | |
67 pass | |
68 | |
69 def finalize_options(self): | |
70 pass | |
71 | |
72 def run(self): | |
73 for filename in glob('doc/*.txt'): | |
74 print 'testing documentation file %s' % filename | |
75 doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS) | |
76 | |
77 | |
78 setup( | |
79 name = 'Babel', | |
80 version = '0.1', | |
81 description = 'Internationalization utilities', | |
82 long_description = \ | |
83 """A collection of tools for internationalizing Python applications.""", | |
84 author = 'Edgewall Software', | |
85 author_email = 'info@edgewall.org', | |
86 license = 'BSD', | |
87 url = 'http://babel.edgewall.org/', | |
88 download_url = 'http://babel.edgewall.org/wiki/Download', | |
89 zip_safe = False, | |
90 | |
91 classifiers = [ | |
92 'Development Status :: 4 - Beta', | |
93 'Environment :: Web Environment', | |
94 'Intended Audience :: Developers', | |
95 'License :: OSI Approved :: BSD License', | |
96 'Operating System :: OS Independent', | |
97 'Programming Language :: Python', | |
98 'Topic :: Software Development :: Libraries :: Python Modules', | |
99 ], | |
100 packages = find_packages(exclude=['tests']), | |
101 package_data = {'babel': ['localedata/*.dat']}, | |
102 test_suite = 'babel.tests.suite', | |
103 | |
104 entry_points = """ | |
105 [console_scripts] | |
106 pygettext = babel.catalog.frontend:main | |
107 | |
108 [distutils.commands] | |
109 extract_messages = babel.catalog.frontend:extract_messages | |
110 | |
111 [babel.extractors] | |
112 genshi = babel.catalog.extract:extract_genshi | |
113 python = babel.catalog.extract:extract_python | |
114 """, | |
115 | |
116 cmdclass = {'build_doc': build_doc, 'test_doc': test_doc} | |
117 ) |