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