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 TeX. For input
29 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',
44 'docutils.writers',],}
45 """Distutils setup parameters."""
48 'Development Status :: 3 - Alpha',
49 'Environment :: Console',
50 'Intended Audience :: End Users/Desktop',
51 'Intended Audience :: Other Audience',
52 'Intended Audience :: Developers',
53 'Intended Audience :: System Administrators',
54 'License :: Public Domain',
55 'License :: OSI Approved :: Python Software Foundation License',
56 'License :: OSI Approved :: BSD License',
57 'License :: OSI Approved :: GNU General Public License (GPL)',
58 'Operating System :: OS Independent',
59 'Programming Language :: Python',
60 'Topic :: Documentation',
61 'Topic :: Software Development :: Documentation',
62 'Topic :: Text Processing',
63 'Natural Language :: Afrikaans',
64 'Natural Language :: English',
65 'Natural Language :: French',
66 'Natural Language :: German',
67 'Natural Language :: Italian',
68 'Natural Language :: Russian',
69 'Natural Language :: Slovak',
70 'Natural Language :: Spanish',
71 'Natural Language :: Swedish',]
72 """Trove classifiers for the Distutils "register" command;
75 extra_modules
= [('optparse', '1.4.1', None),
76 ('textwrap', None, None),
77 ('roman', '1.4', ['toRoman', 'fromRoman',
78 'InvalidRomanNumeralError'])]
79 """Third-party modules to install if they're not already present.
80 List of (module name, minimum __version__ string, [attribute names])."""
84 for module_name
, version
, attributes
in extra_modules
:
86 module
= __import__(module_name
)
87 if version
and module
.__version
__ < version
:
89 for attribute
in attributes
or []:
90 getattr(module
, attribute
)
91 print ('"%s" module already present; ignoring extras/%s.py.'
92 % (module_name
, module_name
))
93 except (ImportError, AttributeError, ValueError):
94 extras
.append(module_name
)
98 class dual_build_py(build_py
):
101 This class allows the distribution of both packages *and* modules with one
102 call to `distutils.core.setup()` (necessary for pre-2.3 Python). Thanks
107 if not self
.py_modules
and not self
.packages
:
112 self
.build_packages()
113 self
.byte_compile(self
.get_outputs(include_bytecode
=0))
116 if __name__
== '__main__' :