cmlenz@1: #!/usr/bin/env python cmlenz@1: # -*- coding: utf-8 -*- cmlenz@1: # cmlenz@1: # Copyright (C) 2007 Edgewall Software cmlenz@1: # All rights reserved. cmlenz@1: # cmlenz@1: # This software is licensed as described in the file COPYING, which cmlenz@1: # you should have received as part of this distribution. The terms cmlenz@1: # are also available at http://babel.edgewall.org/wiki/License. cmlenz@1: # cmlenz@1: # This software consists of voluntary contributions made by many cmlenz@1: # individuals. For the exact contribution history, see the revision cmlenz@1: # history and logs, available at http://babel.edgewall.org/log/. cmlenz@1: cmlenz@1: import doctest cmlenz@1: from glob import glob cmlenz@1: import os cmlenz@1: from setuptools import find_packages, setup, Command cmlenz@1: import sys cmlenz@1: cmlenz@1: cmlenz@1: class build_doc(Command): cmlenz@1: description = 'Builds the documentation' cmlenz@1: user_options = [] cmlenz@1: cmlenz@1: def initialize_options(self): cmlenz@1: pass cmlenz@1: cmlenz@1: def finalize_options(self): cmlenz@1: pass cmlenz@1: cmlenz@1: def run(self): cmlenz@1: from docutils.core import publish_cmdline cmlenz@1: docutils_conf = os.path.join('doc', 'docutils.conf') cmlenz@1: epydoc_conf = os.path.join('doc', 'epydoc.conf') cmlenz@1: cmlenz@1: for source in glob('doc/*.txt'): cmlenz@1: dest = os.path.splitext(source)[0] + '.html' cmlenz@1: if not os.path.exists(dest) or \ cmlenz@1: os.path.getmtime(dest) < os.path.getmtime(source): cmlenz@1: print 'building documentation file %s' % dest cmlenz@1: publish_cmdline(writer_name='html', cmlenz@1: argv=['--config=%s' % docutils_conf, source, cmlenz@1: dest]) cmlenz@1: cmlenz@1: try: cmlenz@1: from epydoc import cli cmlenz@1: old_argv = sys.argv[1:] cmlenz@1: sys.argv[1:] = [ cmlenz@1: '--config=%s' % epydoc_conf, cmlenz@1: '--no-private', # epydoc bug, not read from config cmlenz@1: '--simple-term', cmlenz@1: '--verbose' cmlenz@1: ] cmlenz@1: cli.cli() cmlenz@1: sys.argv[1:] = old_argv cmlenz@1: cmlenz@1: except ImportError: cmlenz@1: print 'epydoc not installed, skipping API documentation.' cmlenz@1: cmlenz@1: cmlenz@1: class test_doc(Command): cmlenz@1: description = 'Tests the code examples in the documentation' cmlenz@1: user_options = [] cmlenz@1: cmlenz@1: def initialize_options(self): cmlenz@1: pass cmlenz@1: cmlenz@1: def finalize_options(self): cmlenz@1: pass cmlenz@1: cmlenz@1: def run(self): cmlenz@1: for filename in glob('doc/*.txt'): cmlenz@1: print 'testing documentation file %s' % filename cmlenz@1: doctest.testfile(filename, False, optionflags=doctest.ELLIPSIS) cmlenz@1: cmlenz@1: cmlenz@1: setup( cmlenz@1: name = 'Babel', cmlenz@1: version = '0.1', cmlenz@1: description = 'Internationalization utilities', cmlenz@1: long_description = \ cmlenz@1: """A collection of tools for internationalizing Python applications.""", cmlenz@1: author = 'Edgewall Software', cmlenz@1: author_email = 'info@edgewall.org', cmlenz@1: license = 'BSD', cmlenz@1: url = 'http://babel.edgewall.org/', cmlenz@1: download_url = 'http://babel.edgewall.org/wiki/Download', cmlenz@1: zip_safe = False, cmlenz@1: cmlenz@1: classifiers = [ cmlenz@1: 'Development Status :: 4 - Beta', cmlenz@1: 'Environment :: Web Environment', cmlenz@1: 'Intended Audience :: Developers', cmlenz@1: 'License :: OSI Approved :: BSD License', cmlenz@1: 'Operating System :: OS Independent', cmlenz@1: 'Programming Language :: Python', cmlenz@1: 'Topic :: Software Development :: Libraries :: Python Modules', cmlenz@1: ], cmlenz@1: packages = find_packages(exclude=['tests']), cmlenz@1: package_data = {'babel': ['localedata/*.dat']}, cmlenz@1: test_suite = 'babel.tests.suite', cmlenz@1: cmlenz@1: entry_points = """ cmlenz@1: [console_scripts] cmlenz@1: pygettext = babel.catalog.frontend:main cmlenz@1: cmlenz@1: [distutils.commands] cmlenz@1: extract_messages = babel.catalog.frontend:extract_messages cmlenz@1: cmlenz@1: [babel.extractors] cmlenz@1: genshi = babel.catalog.extract:extract_genshi cmlenz@1: python = babel.catalog.extract:extract_python cmlenz@1: """, cmlenz@1: cmlenz@1: cmdclass = {'build_doc': build_doc, 'test_doc': test_doc} cmlenz@1: )