3 # Copyright: This file has been placed in the public domain.
8 from distutils
.core
import setup
9 from distutils
.command
.build_py
import build_py
11 # From <http://groups.google.de/groups?as_umsgid=f70e3538.0404141327.6cea58ca@posting.google.com>.
12 from distutils
.command
.install
import INSTALL_SCHEMES
13 for scheme
in INSTALL_SCHEMES
.values():
14 scheme
['data'] = scheme
['purelib']
18 kwargs
= package_data
.copy()
21 kwargs
['py_modules'] = extras
22 if sys
.hexversion
>= 0x02030000: # Python 2.3
23 kwargs
['classifiers'] = classifiers
25 kwargs
['cmdclass'] = {'build_py': dual_build_py
}
26 dist
= setup(**kwargs
)
30 for dir in glob
.glob('docutils/writers/s5_html/themes/*'):
31 if os
.path
.isdir(dir):
32 theme_files
= glob
.glob('%s/*' % dir)
33 s5_theme_files
.append((dir, theme_files
))
37 'description': 'Docutils -- Python Documentation Utilities',
38 'long_description': """\
39 Docutils is a modular system for processing documentation
40 into useful formats, such as HTML, XML, and LaTeX. For
41 input Docutils supports reStructuredText, an easy-to-read,
42 what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
43 'url': 'http://docutils.sourceforge.net/',
45 'author': 'David Goodger',
46 'author_email': 'goodger@users.sourceforge.net',
47 'license': 'public domain, Python, BSD, GPL (see COPYING.txt)',
48 'platforms': 'OS-independent',
49 'package_dir': {'docutils': 'docutils', '': 'extras'},
50 'packages': ['docutils',
53 'docutils.parsers.rst',
54 'docutils.parsers.rst.directives',
55 'docutils.parsers.rst.languages',
57 'docutils.readers.python',
58 'docutils.transforms',
60 'docutils.writers.html4css1',
61 'docutils.writers.pep_html',
62 'docutils.writers.s5_html',
63 'docutils.writers.latex2e',
64 'docutils.writers.newlatex2e'],
65 'data_files': ([('docutils/parsers/rst/include',
66 glob
.glob('docutils/parsers/rst/include/*.txt')),
67 ('docutils/writers/html4css1',
68 ['docutils/writers/html4css1/html4css1.css']),
69 ('docutils/writers/latex2e',
70 ['docutils/writers/latex2e/latex2e.tex']),
71 ('docutils/writers/newlatex2e',
72 ['docutils/writers/newlatex2e/base.tex']),
73 ('docutils/writers/pep_html',
74 ['docutils/writers/pep_html/pep.css',
75 'docutils/writers/pep_html/template.txt']),
76 ('docutils/writers/s5_html/themes',
77 ['docutils/writers/s5_html/themes/README.txt']),]
79 'scripts' : ['tools/rst2html.py',
82 'tools/rst2newlatex.py',
84 'tools/rst2pseudoxml.py'],}
85 """Distutils setup parameters."""
88 'Development Status :: 3 - Alpha',
89 'Environment :: Console',
90 'Intended Audience :: End Users/Desktop',
91 'Intended Audience :: Other Audience',
92 'Intended Audience :: Developers',
93 'Intended Audience :: System Administrators',
94 'License :: Public Domain',
95 'License :: OSI Approved :: Python Software Foundation License',
96 'License :: OSI Approved :: BSD License',
97 'License :: OSI Approved :: GNU General Public License (GPL)',
98 'Operating System :: OS Independent',
99 'Programming Language :: Python',
100 'Topic :: Documentation',
101 'Topic :: Software Development :: Documentation',
102 'Topic :: Text Processing',
103 'Natural Language :: English', # main/default language, keep first
104 'Natural Language :: Afrikaans',
105 'Natural Language :: Esperanto',
106 'Natural Language :: French',
107 'Natural Language :: German',
108 'Natural Language :: Italian',
109 'Natural Language :: Russian',
110 'Natural Language :: Slovak',
111 'Natural Language :: Spanish',
112 'Natural Language :: Swedish',]
113 """Trove classifiers for the Distutils "register" command;
114 Python 2.3 and up."""
116 extra_modules
= [('optparse', '1.4.1', None),
117 ('textwrap', None, None),
118 ('roman', '1.4', ['toRoman', 'fromRoman',
119 'InvalidRomanNumeralError'])]
120 """Third-party modules to install if they're not already present.
121 List of (module name, minimum __version__ string, [attribute names])."""
125 for module_name
, version
, attributes
in extra_modules
:
127 module
= __import__(module_name
)
128 if version
and module
.__version
__ < version
:
130 for attribute
in attributes
or []:
131 getattr(module
, attribute
)
132 print ('"%s" module already present; ignoring extras/%s.py.'
133 % (module_name
, module_name
))
134 except (ImportError, AttributeError, ValueError):
135 extras
.append(module_name
)
139 class dual_build_py(build_py
):
142 This class allows the distribution of both packages *and* modules with one
143 call to `distutils.core.setup()` (necessary for pre-2.3 Python). Thanks
148 if not self
.py_modules
and not self
.packages
:
153 self
.build_packages()
154 self
.byte_compile(self
.get_outputs(include_bytecode
=0))
157 if __name__
== '__main__' :