5
def setup(*args, **kwds):
10
from setuptools import setup
12
from distutils.core import setup
13
return setup(*args, **kwds)
18
Compatibility wrapper.
20
Taken from storm setup.py.
23
from setuptools import find_packages
24
return find_packages()
28
for directory, subdirectories, files in os.walk("txlb"):
29
if '__init__.py' in files:
30
packages.append(directory.replace(os.sep, '.'))
36
Check to see if docutils is installed.
45
def _validateReST(text):
47
Make sure that the given ReST text is valid.
49
Taken from Zope Corp's zc.twist setup.py.
52
import docutils.parsers.rst
55
doc = docutils.utils.new_document('validator')
56
# our desired settings
57
doc.reporter.halt_level = 5
58
doc.reporter.report_level = 1
59
stream = doc.reporter.stream = StringIO.StringIO()
60
# docutils buglets (?)
61
doc.settings.tab_width = 2
62
doc.settings.pep_references = doc.settings.rfc_references = False
63
doc.settings.trim_footnote_reference_space = None
65
parser = docutils.parsers.rst.Parser()
66
parser.parse(text, doc)
67
return stream.getvalue()
70
def validateReST(text):
72
A wrapper that ensafens the validation for pythons that are not embiggened
76
return _validateReST(text)
77
print " *** No docutils; can't validate ReST."
81
def catReST(*args, **kwds):
83
Concatenate the contents of one or more ReST files.
85
Taken from Zope Corp's zc.twist setup.py.
87
# note: distutils explicitly disallows unicode for setup values :-/
88
# http://docs.python.org/dist/meta-data.html
91
if a in ['README', 'DEPENDENCIES'] or a.endswith('.txt'):
92
f = open(os.path.join(*a.split('/')))
102
out = kwds.get('out')
104
out = 'CHECK_THIS_BEFORE_UPLOAD.txt'
109
report = validateReST(res)
112
raise ValueError('ReST validation error')