~ubuntu-branches/ubuntu/hardy/python-docutils/hardy

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/env python
2
 
# $Id: setup.py,v 1.21 2004/05/09 16:22:22 felixwiemann Exp $
 
2
# $Id: setup.py 4260 2006-01-09 18:28:09Z fwiemann $
3
3
# Copyright: This file has been placed in the public domain.
4
4
 
5
5
import sys
6
6
import os
 
7
import glob
7
8
from distutils.core import setup
8
9
from distutils.command.build_py import build_py
9
10
 
 
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']
 
15
 
10
16
 
11
17
def do_setup():
12
18
    kwargs = package_data.copy()
 
19
    extras = get_extras()
 
20
    if extras:
 
21
        kwargs['py_modules'] = extras
13
22
    if sys.hexversion >= 0x02030000:    # Python 2.3
14
23
        kwargs['classifiers'] = classifiers
15
24
    else:
17
26
    dist = setup(**kwargs)
18
27
    return dist
19
28
 
 
29
s5_theme_files = []
 
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))
 
34
 
20
35
package_data = {
21
36
    'name': 'docutils',
22
37
    'description': 'Docutils -- Python Documentation Utilities',
23
38
    'long_description': """\
24
39
Docutils is a modular system for processing documentation
25
 
into useful formats, such as HTML, XML, and TeX.  For input
26
 
Docutils supports reStructuredText, an easy-to-read,
 
40
into useful formats, such as HTML, XML, and LaTeX.  For
 
41
input Docutils supports reStructuredText, an easy-to-read,
27
42
what-you-see-is-what-you-get plaintext markup syntax.""", # wrap at col 60
28
43
    'url': 'http://docutils.sourceforge.net/',
29
 
    'version': '0.3.3',
 
44
    'version': '0.4',
30
45
    'author': 'David Goodger',
31
46
    'author_email': 'goodger@users.sourceforge.net',
32
47
    'license': 'public domain, Python, BSD, GPL (see COPYING.txt)',
33
48
    'platforms': 'OS-independent',
34
 
    'package_dir': {'docutils': 'docutils'},
35
 
    'packages': ['docutils', 'docutils.languages',
36
 
                 'docutils.parsers', 'docutils.parsers.rst',
 
49
    'package_dir': {'docutils': 'docutils', '': 'extras'},
 
50
    'packages': ['docutils',
 
51
                 'docutils.languages',
 
52
                 'docutils.parsers',
 
53
                 'docutils.parsers.rst',
37
54
                 'docutils.parsers.rst.directives',
38
55
                 'docutils.parsers.rst.languages',
39
 
                 'docutils.readers', 'docutils.readers.python',
 
56
                 'docutils.readers',
 
57
                 'docutils.readers.python',
40
58
                 'docutils.transforms',
41
 
                 'docutils.writers',],
42
 
    'scripts' : ['tools/rst2html.py',],}
 
59
                 'docutils.writers',
 
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']),]
 
78
                   + s5_theme_files),
 
79
    'scripts' : ['tools/rst2html.py',
 
80
                 'tools/rst2s5.py',
 
81
                 'tools/rst2latex.py',
 
82
                 'tools/rst2newlatex.py',
 
83
                 'tools/rst2xml.py',
 
84
                 'tools/rst2pseudoxml.py'],}
43
85
"""Distutils setup parameters."""
44
86
 
45
87
classifiers = [
71
113
"""Trove classifiers for the Distutils "register" command;
72
114
Python 2.3 and up."""
73
115
 
 
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])."""
 
122
 
 
123
def get_extras():
 
124
    extras = []
 
125
    for module_name, version, attributes in extra_modules:
 
126
        try:
 
127
            module = __import__(module_name)
 
128
            if version and module.__version__ < version:
 
129
                raise ValueError
 
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)
 
136
    return extras
 
137
 
 
138
 
74
139
class dual_build_py(build_py):
75
140
 
76
141
    """