summaryrefslogtreecommitdiff
path: root/docutils/setup.py
diff options
context:
space:
mode:
authormilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-09-01 19:39:23 +0000
committermilde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04>2019-09-01 19:39:23 +0000
commit128be373a8b9a501a1a28993c889f2e30c52cbdd (patch)
tree48c6e365319a8d23d71d4e0eb4dfe872d94ec698 /docutils/setup.py
parent4a57b49372a7aa708fc457f890433a0174a31e6b (diff)
downloaddocutils-128be373a8b9a501a1a28993c889f2e30c52cbdd.tar.gz
trivial: Cleanup setup.py
Make this file a little bit easier to parse, which will be helpful given that we're going to conduct some surgery on this going forward. This mostly involves using better wrapping and combining things where it makes sense. Signed-off-by: Stephen Finucane <stephen@that.guru> git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk@8382 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/setup.py')
-rwxr-xr-xdocutils/setup.py242
1 files changed, 124 insertions, 118 deletions
diff --git a/docutils/setup.py b/docutils/setup.py
index b952cdb40..a94e688f7 100755
--- a/docutils/setup.py
+++ b/docutils/setup.py
@@ -29,11 +29,12 @@ class smart_install_data(install_data):
# by Pete Shinners.
def run(self):
- #need to change self.install_dir to the library dir
+ # need to change self.install_dir to the library dir
install_cmd = self.get_finalized_command('install')
self.install_dir = getattr(install_cmd, 'install_lib')
return install_data.run(self)
+
class build_data(Command):
def initialize_options(self):
@@ -43,35 +44,28 @@ class build_data(Command):
pass
def run(self):
- build_py = self.get_finalized_command('build_py')
+ build_py_cmd = self.get_finalized_command('build_py')
data_files = self.distribution.data_files
for f in data_files:
dir = convert_path(f[0])
- dir = os.path.join(build_py.build_lib, dir)
+ dir = os.path.join(build_py_cmd.build_lib, dir)
self.mkpath(dir)
for data in f[1]:
data = convert_path(data)
self.copy_file(data, dir)
+
# let our build_data run
build.sub_commands.append(('build_data', lambda *a: True))
-def do_setup():
- kwargs = package_data.copy()
- kwargs['classifiers'] = classifiers
- # Install data files properly.
- kwargs['cmdclass'] = {'build_data': build_data,
- 'install_data': smart_install_data}
- dist = setup(**kwargs)
- return dist
-
s5_theme_files = []
for dir in glob.glob('docutils/writers/s5_html/themes/*'):
if os.path.isdir(dir):
theme_files = glob.glob('%s/*' % dir)
s5_theme_files.append((dir, theme_files))
+
package_data = {
'name': 'docutils',
'description': 'Docutils -- Python Documentation Utilities',
@@ -79,7 +73,7 @@ package_data = {
Docutils is a modular system for processing documentation
into useful formats, such as HTML, XML, and LaTeX. For
input Docutils supports reStructuredText, an easy-to-read,
-what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
+what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
'url': 'http://docutils.sourceforge.net/',
'version': '0.16b.dev',
'author': 'David Goodger',
@@ -89,111 +83,123 @@ what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
'license': 'public domain, Python, 2-Clause BSD, GPL 3 (see COPYING.txt)',
'platforms': 'OS-independent',
'python_requires': '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
- 'package_dir': {'docutils': 'docutils',
- 'docutils.tools': 'tools'},
- 'packages': ['docutils',
- 'docutils.languages',
- 'docutils.parsers',
- 'docutils.parsers.rst',
- 'docutils.parsers.rst.directives',
- 'docutils.parsers.rst.languages',
- 'docutils.readers',
- # 'docutils.readers.python', # in the sandbox since 0.8
- 'docutils.transforms',
- 'docutils.utils',
- 'docutils.utils.math',
- 'docutils.writers',
- 'docutils.writers.html4css1',
- 'docutils.writers.html5_polyglot',
- 'docutils.writers.pep_html',
- 'docutils.writers.s5_html',
- 'docutils.writers.latex2e',
- 'docutils.writers.xetex',
- 'docutils.writers.odf_odt',
- ],
- 'data_files': ([('docutils/parsers/rst/include',
- glob.glob('docutils/parsers/rst/include/*.txt')),
- ('docutils/writers/html5_polyglot',
- ['docutils/writers/html5_polyglot/minimal.css',
- 'docutils/writers/html5_polyglot/plain.css',
- 'docutils/writers/html5_polyglot/math.css',
- 'docutils/writers/html5_polyglot/template.txt']),
- ('docutils/writers/html4css1',
- ['docutils/writers/html4css1/html4css1.css',
- 'docutils/writers/html4css1/template.txt']),
- ('docutils/writers/latex2e',
- ['docutils/writers/latex2e/default.tex',
- 'docutils/writers/latex2e/titlepage.tex',
- 'docutils/writers/latex2e/xelatex.tex',]),
- ('docutils/writers/pep_html',
- ['docutils/writers/pep_html/pep.css',
- 'docutils/writers/pep_html/template.txt']),
- ('docutils/writers/s5_html/themes',
- ['docutils/writers/s5_html/themes/README.txt']),
- ('docutils/writers/odf_odt',
- ['docutils/writers/odf_odt/styles.odt']),
- ]
- + s5_theme_files),
- 'scripts' : ['tools/rst2html.py',
- 'tools/rst2html4.py',
- 'tools/rst2html5.py',
- 'tools/rst2s5.py',
- 'tools/rst2latex.py',
- 'tools/rst2xetex.py',
- 'tools/rst2man.py',
- 'tools/rst2xml.py',
- 'tools/rst2pseudoxml.py',
- 'tools/rstpep2html.py',
- 'tools/rst2odt.py',
- 'tools/rst2odt_prepstyles.py',
- ],}
+ 'cmdclass': {
+ 'build_data': build_data,
+ 'install_data': smart_install_data,
+ },
+ 'package_dir': {
+ 'docutils': 'docutils',
+ 'docutils.tools': 'tools'
+ },
+ 'packages': [
+ 'docutils',
+ 'docutils.languages',
+ 'docutils.parsers',
+ 'docutils.parsers.rst',
+ 'docutils.parsers.rst.directives',
+ 'docutils.parsers.rst.languages',
+ 'docutils.readers',
+ 'docutils.transforms',
+ 'docutils.utils',
+ 'docutils.utils.math',
+ 'docutils.writers',
+ 'docutils.writers.html4css1',
+ 'docutils.writers.html5_polyglot',
+ 'docutils.writers.pep_html',
+ 'docutils.writers.s5_html',
+ 'docutils.writers.latex2e',
+ 'docutils.writers.xetex',
+ 'docutils.writers.odf_odt',
+ ],
+ 'data_files': [
+ ('docutils/parsers/rst/include',
+ glob.glob('docutils/parsers/rst/include/*.txt')),
+ ('docutils/writers/html5_polyglot', [
+ 'docutils/writers/html5_polyglot/minimal.css',
+ 'docutils/writers/html5_polyglot/plain.css',
+ 'docutils/writers/html5_polyglot/math.css',
+ 'docutils/writers/html5_polyglot/template.txt']),
+ ('docutils/writers/html4css1', [
+ 'docutils/writers/html4css1/html4css1.css',
+ 'docutils/writers/html4css1/template.txt']),
+ ('docutils/writers/latex2e', [
+ 'docutils/writers/latex2e/default.tex',
+ 'docutils/writers/latex2e/titlepage.tex',
+ 'docutils/writers/latex2e/xelatex.tex']),
+ ('docutils/writers/pep_html', [
+ 'docutils/writers/pep_html/pep.css',
+ 'docutils/writers/pep_html/template.txt']),
+ ('docutils/writers/s5_html/themes', [
+ 'docutils/writers/s5_html/themes/README.txt']),
+ ('docutils/writers/odf_odt', ['docutils/writers/odf_odt/styles.odt']),
+ ] + s5_theme_files,
+ 'scripts': [
+ 'tools/rst2html.py',
+ 'tools/rst2html4.py',
+ 'tools/rst2html5.py',
+ 'tools/rst2s5.py',
+ 'tools/rst2latex.py',
+ 'tools/rst2xetex.py',
+ 'tools/rst2man.py',
+ 'tools/rst2xml.py',
+ 'tools/rst2pseudoxml.py',
+ 'tools/rstpep2html.py',
+ 'tools/rst2odt.py',
+ 'tools/rst2odt_prepstyles.py',
+ ],
+ # BUG pypi did not like following languages
+ # 'Natural Language :: Lithuanian',
+ 'classifiers': [
+ 'Development Status :: 4 - Beta',
+ 'Environment :: Console',
+ 'Intended Audience :: End Users/Desktop',
+ 'Intended Audience :: Other Audience',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: System Administrators',
+ 'License :: Public Domain',
+ 'License :: OSI Approved :: Python Software Foundation License',
+ 'License :: OSI Approved :: BSD License',
+ 'License :: OSI Approved :: GNU General Public License (GPL)',
+ 'Operating System :: OS Independent',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.5',
+ 'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Topic :: Documentation',
+ 'Topic :: Software Development :: Documentation',
+ 'Topic :: Text Processing',
+ 'Natural Language :: English', # main/default language, keep first
+ 'Natural Language :: Afrikaans',
+ 'Natural Language :: Catalan',
+ 'Natural Language :: Chinese (Simplified)',
+ 'Natural Language :: Chinese (Traditional)',
+ 'Natural Language :: Czech',
+ 'Natural Language :: Dutch',
+ 'Natural Language :: Esperanto',
+ 'Natural Language :: Finnish',
+ 'Natural Language :: French',
+ 'Natural Language :: Galician',
+ 'Natural Language :: German',
+ 'Natural Language :: Italian',
+ 'Natural Language :: Japanese',
+ 'Natural Language :: Polish',
+ 'Natural Language :: Portuguese (Brazilian)',
+ 'Natural Language :: Russian',
+ 'Natural Language :: Slovak',
+ 'Natural Language :: Spanish',
+ 'Natural Language :: Swedish',
+ ],
+}
"""Distutils setup parameters."""
-classifiers = [
- 'Development Status :: 4 - Beta',
- 'Environment :: Console',
- 'Intended Audience :: End Users/Desktop',
- 'Intended Audience :: Other Audience',
- 'Intended Audience :: Developers',
- 'Intended Audience :: System Administrators',
- 'License :: Public Domain',
- 'License :: OSI Approved :: Python Software Foundation License',
- 'License :: OSI Approved :: BSD License',
- 'License :: OSI Approved :: GNU General Public License (GPL)',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.5',
- 'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
- 'Topic :: Documentation',
- 'Topic :: Software Development :: Documentation',
- 'Topic :: Text Processing',
- 'Natural Language :: English', # main/default language, keep first
- 'Natural Language :: Afrikaans',
- 'Natural Language :: Catalan',
- 'Natural Language :: Chinese (Simplified)',
- 'Natural Language :: Chinese (Traditional)',
- 'Natural Language :: Czech',
- 'Natural Language :: Dutch',
- 'Natural Language :: Esperanto',
- 'Natural Language :: Finnish',
- 'Natural Language :: French',
- 'Natural Language :: Galician',
- 'Natural Language :: German',
- 'Natural Language :: Italian',
- 'Natural Language :: Japanese',
- 'Natural Language :: Polish',
- 'Natural Language :: Portuguese (Brazilian)',
- 'Natural Language :: Russian',
- 'Natural Language :: Slovak',
- 'Natural Language :: Spanish',
- 'Natural Language :: Swedish',
- ]
-# BUG pypi did not like following languages
-# 'Natural Language :: Lithuanian',
-"""Trove classifiers for the Distutils "register" command."""
-
-if __name__ == '__main__' :
+
+def do_setup():
+ # Install data files properly.
+ dist = setup(**package_data)
+ return dist
+
+
+if __name__ == '__main__':
do_setup()