3 # Copyright: This file has been placed in the public domain.
10 from distutils
.core
import setup
, Command
11 from distutils
.command
.build
import build
12 from distutils
.command
.build_py
import build_py
13 if sys
.version_info
>= (3,):
14 from distutils
.command
.build_py
import build_py_2to3
15 from distutils
.util
import copydir_run_2to3
16 from distutils
.command
.install_data
import install_data
17 from distutils
.util
import convert_path
18 from distutils
import log
20 print ('Error: The "distutils" standard module, which is required for the ')
21 print ('installation of Docutils, could not be found. You may need to ')
22 print ('install a package called "python-devel" (or similar) on your ')
23 print ('system using your package manager.')
27 if sys
.version_info
>= (3,):
28 # copy-convert auxiliary python sources
29 class copy_build_py_2to3(build_py_2to3
):
30 """Copy/convert Python source files in given directories recursively.
32 Build py3k versions of the modules and packages.
33 Also copy 'test/' suite and run 2to3 on *.py files.
36 exclude *.pyc *~ .DS_Store
37 recursive-exclude * *.pyc *~ .DS_Store
38 recursive-exclude functional/output *
39 include functional/output/README.txt
49 print("build_py_2to3")
50 build_py_2to3
.run(self
)
51 print("copy/convert test suite")
52 loglevel
= log
.set_threshold(log
.ERROR
)
53 copydir_run_2to3('test', 'test3', template
=self
.manifest_in
)
54 log
.set_threshold(loglevel
)
57 class smart_install_data(install_data
):
58 # From <http://wiki.python.org/moin/DistutilsInstallDataScattered>,
62 #need to change self.install_dir to the library dir
63 install_cmd
= self
.get_finalized_command('install')
64 self
.install_dir
= getattr(install_cmd
, 'install_lib')
65 return install_data
.run(self
)
67 class build_data(Command
):
69 def initialize_options(self
):
72 def finalize_options(self
):
76 build_py
= self
.get_finalized_command('build_py')
77 data_files
= self
.distribution
.data_files
79 dir = convert_path(f
[0])
80 dir = os
.path
.join(build_py
.build_lib
, dir)
83 data
= convert_path(data
)
84 self
.copy_file(data
, dir)
86 # let our build_data run
87 build
.sub_commands
.append(('build_data', lambda *a
: True))
91 kwargs
= package_data
.copy()
92 kwargs
['classifiers'] = classifiers
93 # Install data files properly.
94 kwargs
['cmdclass'] = {'build_data': build_data
,
95 'install_data': smart_install_data
}
96 # Auto-convert source code for Python 3
97 if sys
.version_info
>= (3,):
98 kwargs
['cmdclass']['build_py'] = copy_build_py_2to3
100 kwargs
['cmdclass']['build_py'] = build_py
101 dist
= setup(**kwargs
)
105 for dir in glob
.glob('docutils/writers/s5_html/themes/*'):
106 if os
.path
.isdir(dir):
107 theme_files
= glob
.glob('%s/*' % dir)
108 s5_theme_files
.append((dir, theme_files
))
112 'description': 'Docutils -- Python Documentation Utilities',
113 'long_description': """\
114 Docutils is a modular system for processing documentation
115 into useful formats, such as HTML, XML, and LaTeX. For
116 input Docutils supports reStructuredText, an easy-to-read,
117 what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
118 'url': 'http://docutils.sourceforge.net/',
119 'version': '0.16b.dev',
120 'author': 'David Goodger',
121 'author_email': 'goodger@python.org',
122 'maintainer': 'docutils-develop list',
123 'maintainer_email': 'docutils-develop@lists.sourceforge.net',
124 'license': 'public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt)',
125 'platforms': 'OS-independent',
126 'python_requires': '>=2.6, !=3.0.*, !=3.1.*, !=3.2.*',
127 'package_dir': {'docutils': 'docutils',
128 'docutils.tools': 'tools'},
129 'packages': ['docutils',
130 'docutils.languages',
132 'docutils.parsers.rst',
133 'docutils.parsers.rst.directives',
134 'docutils.parsers.rst.languages',
136 # 'docutils.readers.python', # in the sandbox since 0.8
137 'docutils.transforms',
139 'docutils.utils.math',
141 'docutils.writers.html4css1',
142 'docutils.writers.html5_polyglot',
143 'docutils.writers.pep_html',
144 'docutils.writers.s5_html',
145 'docutils.writers.latex2e',
146 'docutils.writers.xetex',
147 'docutils.writers.odf_odt',
149 'data_files': ([('docutils/parsers/rst/include',
150 glob
.glob('docutils/parsers/rst/include/*.txt')),
151 ('docutils/writers/html5_polyglot',
152 ['docutils/writers/html5_polyglot/minimal.css',
153 'docutils/writers/html5_polyglot/plain.css',
154 'docutils/writers/html5_polyglot/math.css',
155 'docutils/writers/html5_polyglot/template.txt']),
156 ('docutils/writers/html4css1',
157 ['docutils/writers/html4css1/html4css1.css',
158 'docutils/writers/html4css1/template.txt']),
159 ('docutils/writers/latex2e',
160 ['docutils/writers/latex2e/default.tex',
161 'docutils/writers/latex2e/titlepage.tex',
162 'docutils/writers/latex2e/xelatex.tex',]),
163 ('docutils/writers/pep_html',
164 ['docutils/writers/pep_html/pep.css',
165 'docutils/writers/pep_html/template.txt']),
166 ('docutils/writers/s5_html/themes',
167 ['docutils/writers/s5_html/themes/README.txt']),
168 ('docutils/writers/odf_odt',
169 ['docutils/writers/odf_odt/styles.odt']),
172 'scripts' : ['tools/rst2html.py',
173 'tools/rst2html4.py',
174 'tools/rst2html5.py',
176 'tools/rst2latex.py',
177 'tools/rst2xetex.py',
180 'tools/rst2pseudoxml.py',
181 'tools/rstpep2html.py',
183 'tools/rst2odt_prepstyles.py',
185 """Distutils setup parameters."""
188 'Development Status :: 4 - Beta',
189 'Environment :: Console',
190 'Intended Audience :: End Users/Desktop',
191 'Intended Audience :: Other Audience',
192 'Intended Audience :: Developers',
193 'Intended Audience :: System Administrators',
194 'License :: Public Domain',
195 'License :: OSI Approved :: Python Software Foundation License',
196 'License :: OSI Approved :: BSD License',
197 'License :: OSI Approved :: GNU General Public License (GPL)',
198 'Operating System :: OS Independent',
199 'Programming Language :: Python :: 2',
200 'Programming Language :: Python :: 2.6',
201 'Programming Language :: Python :: 2.7',
202 'Programming Language :: Python :: 3',
203 'Programming Language :: Python :: 3.4',
204 'Programming Language :: Python :: 3.5',
205 'Programming Language :: Python :: 3.6',
206 'Programming Language :: Python :: 3.7',
207 'Topic :: Documentation',
208 'Topic :: Software Development :: Documentation',
209 'Topic :: Text Processing',
210 'Natural Language :: English', # main/default language, keep first
211 'Natural Language :: Afrikaans',
212 'Natural Language :: Catalan',
213 'Natural Language :: Chinese (Simplified)',
214 'Natural Language :: Chinese (Traditional)',
215 'Natural Language :: Czech',
216 'Natural Language :: Dutch',
217 'Natural Language :: Esperanto',
218 'Natural Language :: Finnish',
219 'Natural Language :: French',
220 'Natural Language :: Galician',
221 'Natural Language :: German',
222 'Natural Language :: Italian',
223 'Natural Language :: Japanese',
224 'Natural Language :: Polish',
225 'Natural Language :: Portuguese (Brazilian)',
226 'Natural Language :: Russian',
227 'Natural Language :: Slovak',
228 'Natural Language :: Spanish',
229 'Natural Language :: Swedish',
231 # BUG pypi did not like following languages
232 # 'Natural Language :: Lithuanian',
233 """Trove classifiers for the Distutils "register" command."""
235 if __name__
== '__main__' :