-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsetup.py
141 lines (120 loc) · 4.4 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
"""
Installer for loxun.
Developer cheat sheet
---------------------
Create the installer archive::
$ python setup.py sdist --formats=zip
Upload release to PyPI::
$ python test/test_loxun.py
$ python setup.py sdist --formats=zip upload
Tag a release::
$ git tag -a -m "Tagged version 1.x." v1.x
$ git push --tags
Build API documentation
-----------------------
Patch Epydoc 3.0.1 to work with docutils 0.6:
In ``epydoc/markup/restructuredtext.py``, change in
``_SummaryExtractor.__init__()``::
# Extract the first sentence.
for child in node:
if isinstance(child, docutils.nodes.Text):
# FIXED: m = self._SUMMARY_RE.match(child.data)
text = child.astext()
m = self._SUMMARY_RE.match(text)
if m:
summary_pieces.append(docutils.nodes.Text(m.group(1)))
# FIXED: other = child.data[m.end():]
other = text[m.end():]
if other and not other.isspace():
self.other_docs = True
break
summary_pieces.append(child)
Run::
$ python setup.py api
"""
# Copyright (C) 2010-2011 Thomas Aglassinger
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Required patch for Epydoc 3.0.1 to work with docutils 0.6:
# In epydoc/markup/restructuredtext.py, change in _SummaryExtractor.__init__():
# Extract the first sentence.
# for child in node:
# if isinstance(child, docutils.nodes.Text):
# # FIXED: m = self._SUMMARY_RE.match(child.data)
# text = child.astext()
# m = self._SUMMARY_RE.match(text)
# if m:
# summary_pieces.append(docutils.nodes.Text(m.group(1)))
# # FIXED: other = child.data[m.end():]
# other = text[m.end():]
# if other and not other.isspace():
# self.other_docs = True
# break
# summary_pieces.append(child)
import errno
import os.path
import subprocess
from distutils.core import setup
from distutils.cmd import Command
import loxun
def _makeFolders(path):
try:
os.makedirs(path)
except OSError as error:
if error.errno != errno.EEXIST:
raise
class _ApiCommand(Command):
"""
Command for setuptools to build API documentation.
"""
description = "build API documentation"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
_makeFolders(os.path.join("build", "site", "api"))
epydocCall = ["epydoc", "--config", "epydoc.config"]
print(" ".join(epydocCall))
subprocess.check_call(epydocCall)
setup(
name="loxun",
version=loxun.__version__,
py_modules=["loxun"],
description="large output in XML using unicode and namespaces",
keywords="xml output stream large big huge namespace unicode memory footprint",
author="Thomas Aglassinger",
author_email="roskakori@users.sourceforge.net",
url="http://pypi.python.org/pypi/loxun/",
license="GNU Lesser General Public License 3 or later",
long_description=loxun.__doc__, #@UndefinedVariable
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Plugins",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries",
"Topic :: Text Processing :: Markup :: XML",
],
cmdclass={"api": _ApiCommand}
)