3 # Copyright: This file has been placed in the public domain.
7 from distutils
.core
import setup
8 from distutils
.command
.build_py
import build_py
12 kwargs
= package_data
.copy()
15 kwargs
['py_modules'] = extras
16 if sys
.hexversion
>= 0x02030000: # Python 2.3
17 kwargs
['classifiers'] = classifiers
19 kwargs
['cmdclass'] = {'build_py': dual_build_py
}
20 dist
= setup(**kwargs
)
25 'description': 'Docutils -- Python Documentation Utilities',
26 'long_description': """\
27 Docutils is a modular system for processing documentation
28 into useful formats, such as HTML, XML, and LaTeX. For
29 input Docutils supports reStructuredText, an easy-to-read,
30 what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
31 'url': 'http://docutils.sourceforge.net/',
33 'author': 'David Goodger',
34 'author_email': 'goodger@users.sourceforge.net',
35 'license': 'public domain, Python, BSD, GPL (see COPYING.txt)',
36 'platforms': 'OS-independent',
37 'package_dir': {'docutils': 'docutils', '': 'extras'},
38 'packages': ['docutils', 'docutils.languages',
39 'docutils.parsers', 'docutils.parsers.rst',
40 'docutils.parsers.rst.directives',
41 'docutils.parsers.rst.languages',
42 'docutils.readers', 'docutils.readers.python',
43 'docutils.transforms',
45 'scripts' : ['tools/rst2html.py','tools/rst2latex.py'],}
46 """Distutils setup parameters."""
49 'Development Status :: 3 - Alpha',
50 'Environment :: Console',
51 'Intended Audience :: End Users/Desktop',
52 'Intended Audience :: Other Audience',
53 'Intended Audience :: Developers',
54 'Intended Audience :: System Administrators',
55 'License :: Public Domain',
56 'License :: OSI Approved :: Python Software Foundation License',
57 'License :: OSI Approved :: BSD License',
58 'License :: OSI Approved :: GNU General Public License (GPL)',
59 'Operating System :: OS Independent',
60 'Programming Language :: Python',
61 'Topic :: Documentation',
62 'Topic :: Software Development :: Documentation',
63 'Topic :: Text Processing',
64 'Natural Language :: English', # main/default language, keep first
65 'Natural Language :: Afrikaans',
66 'Natural Language :: Esperanto',
67 'Natural Language :: French',
68 'Natural Language :: German',
69 'Natural Language :: Italian',
70 'Natural Language :: Russian',
71 'Natural Language :: Slovak',
72 'Natural Language :: Spanish',
73 'Natural Language :: Swedish',]
74 """Trove classifiers for the Distutils "register" command;
77 extra_modules
= [('optparse', '1.4.1', None),
78 ('textwrap', None, None),
79 ('roman', '1.4', ['toRoman', 'fromRoman',
80 'InvalidRomanNumeralError'])]
81 """Third-party modules to install if they're not already present.
82 List of (module name, minimum __version__ string, [attribute names])."""
86 for module_name
, version
, attributes
in extra_modules
:
88 module
= __import__(module_name
)
89 if version
and module
.__version
__ < version
:
91 for attribute
in attributes
or []:
92 getattr(module
, attribute
)
93 print ('"%s" module already present; ignoring extras/%s.py.'
94 % (module_name
, module_name
))
95 except (ImportError, AttributeError, ValueError):
96 extras
.append(module_name
)
100 class dual_build_py(build_py
):
103 This class allows the distribution of both packages *and* modules with one
104 call to `distutils.core.setup()` (necessary for pre-2.3 Python). Thanks
109 if not self
.py_modules
and not self
.packages
:
114 self
.build_packages()
115 self
.byte_compile(self
.get_outputs(include_bytecode
=0))
118 if __name__
== '__main__' :