Skip to content

Commit f39d4d5

Browse files
committed
initial commit of epydoc, from epydoc.sourceforge.net
1 parent 4c7e6fc commit f39d4d5

File tree

108 files changed

+42259
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+42259
-0
lines changed

Makefile

Lines changed: 311 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,311 @@
1+
############################################################
2+
## epydoc Makefile
3+
##
4+
## Edward Loper
5+
############################################################
6+
7+
##//////////////////////////////////////////////////////////////////////
8+
## Configuration variables
9+
##//////////////////////////////////////////////////////////////////////
10+
11+
# Python source files (don't include src/epydoc/test?)
12+
PY_SRC = src/epydoc/
13+
PY_SRCFILES = $(shell find $(PY_SRC) -name '*.py')
14+
EXAMPLES_SRC = $(wildcard doc/*.py)
15+
DOCDIR = doc
16+
DOCS = $(wildcard $(DOCDIR)/*)
17+
DOCTESTS = $(wildcard src/epydoc/test/*.doctest)
18+
MANUAL_SRC = $(wildcard doc/manual-*.txt)
19+
20+
# What version of python to use?
21+
PYTHON = python2.5
22+
export PYTHONPATH=src/
23+
24+
# The location of the webpage.
25+
HOST = shell.sf.net
26+
DIR = /home/groups/e/ep/epydoc/htdocs
27+
28+
# The current version of epydoc.
29+
VERSION = $(shell $(PYTHON) -c 'import epydoc; print epydoc.__version__')
30+
31+
# Base output directories
32+
WEBDIR = webpage
33+
LATEX = latex
34+
HTML = html
35+
36+
# Output subdirectories
37+
HTML_MANUAL = $(HTML)
38+
HTML_API = $(HTML)/api
39+
HTML_EXAMPLES = $(HTML)/examples
40+
HTML_STDLIB = $(HTML)/stdlib
41+
HTML_DOCTEST = $(HTML)/doctest
42+
LATEX_API = $(LATEX)/api.pdf
43+
LATEX_STDLIB = $(LATEX)/stdlib.pdf
44+
45+
EPYDOC = $(PYTHON) src/epydoc/cli.py
46+
47+
RST2HTML = $(PYTHON) src/tools/rst2html.py
48+
MKDISPATCH = $(PYTHON) src/tools/mkdispatch.py
49+
STY2HTML = $(PYTHON) src/tools/sty2html.py
50+
51+
DOCTEST_HTML_FILES := \
52+
$(DOCTESTS:src/epydoc/test/%.doctest=$(HTML_DOCTEST)/%.html)
53+
54+
MANUAL_HTML_FILES := $(HTML_MANUAL)/epydoc.html \
55+
$(MANUAL_SRC:doc/manual-%.txt=$(HTML_MANUAL)/manual-%.html)
56+
57+
##//////////////////////////////////////////////////////////////////////
58+
## Usage
59+
##//////////////////////////////////////////////////////////////////////
60+
61+
.PHONY: all usage clean distributions web webpage xfer local
62+
.PHONY: checkdocs api-html api-pdf examples stdlib-html stdlib-pdf
63+
.PHONY: test tests
64+
65+
all: usage
66+
usage:
67+
@echo "Usage:"
68+
@echo " make webpage -- build the webpage and copy it to sourceforge"
69+
@echo " make api-html -- build the HTML docs for epydoc"
70+
@echo " make api-pdf -- build the PDF docs for epydoc"
71+
@echo " make doctest-html -- convert doctests to HTML"
72+
@echo " make examples -- build example API docs for the webpage"
73+
@echo " make stdlib-html -- build HTML docs for the Python Standard Library"
74+
@echo " make checkdocs -- check the documentation completeness"
75+
@echo " make distributions -- build the distributions"
76+
@echo " make clean -- remove all built files"
77+
@echo " make test -- run unit tests"
78+
79+
##//////////////////////////////////////////////////////////////////////
80+
## Clean
81+
##//////////////////////////////////////////////////////////////////////
82+
83+
clean:
84+
$(MAKE) -C src clean
85+
rm -rf $(WEBDIR) $(HTML) $(LATEX)
86+
rm -rf .*.up2date
87+
rm -rf profile.out
88+
89+
##//////////////////////////////////////////////////////////////////////
90+
## Distributions
91+
##//////////////////////////////////////////////////////////////////////
92+
93+
distributions: .distributions.up2date
94+
.distributions.up2date: test $(PY_SRCFILES) .webpage.up2date $(DOCS)
95+
$(MAKE) -C src distributions
96+
touch .distributions.up2date
97+
98+
##//////////////////////////////////////////////////////////////////////
99+
## Web page
100+
##//////////////////////////////////////////////////////////////////////
101+
102+
web: xfer
103+
webpage: xfer
104+
xfer: test .webpage.up2date stdlib-html
105+
rsync -arzv -e ssh $(WEBDIR)/* $(HOST):$(DIR)
106+
rsync -arzv -e ssh $(HTML_STDLIB)/ $(HOST):$(DIR)/stdlib
107+
108+
local: .webpage.up2date
109+
rm -rf /var/www/epydoc/*
110+
cp -r $(WEBDIR)/* /var/www/epydoc
111+
112+
manual-html: $(MANUAL_HTML_FILES)
113+
114+
$(HTML_MANUAL)/epydoc.html: doc/manual.txt $(MANUAL_SRC) \
115+
doc/epydoc-style-list.txt
116+
$(RST2HTML) doc/manual.txt $@ --template=doc/rst-template.txt
117+
118+
$(HTML_MANUAL)/manual-%.html: doc/manual-%.txt doc/epydoc-style-list.txt
119+
echo ".. include:: ../$<" > doc/tmp.txt
120+
$(MKDISPATCH) $(MANUAL_SRC) >> doc/tmp.txt
121+
$(RST2HTML) doc/tmp.txt $@ --template=doc/rst-template.txt
122+
123+
checkdoc: checkdocs
124+
checkdocs:
125+
epydoc --check --tests=vars,types $(PY_SRC)
126+
127+
.webpage.up2date: .api-html.up2date .examples.up2date .api-pdf.up2date \
128+
$(DOCTEST_HTML_FILES) doc/epydoc-man.html \
129+
doc/epydocgui-man.html $(DOCS) $(MANUAL_HTML_FILES)
130+
rm -rf $(WEBDIR)
131+
mkdir -p $(WEBDIR)
132+
cp -r $(DOCS) $(WEBDIR)
133+
cp -r $(HTML_MANUAL)/epydoc.html $(WEBDIR)
134+
cp -r $(HTML_MANUAL)/manual*.html $(WEBDIR)
135+
cp -r $(HTML_API) $(WEBDIR)/api
136+
cp -r $(HTML_EXAMPLES) $(WEBDIR)/examples
137+
cp -r $(HTML_DOCTEST)/* $(WEBDIR)/doctest
138+
cp $(LATEX_API) $(WEBDIR)/epydoc.pdf
139+
touch .webpage.up2date
140+
141+
# Use plaintext docformat by default. But this is overridden by the
142+
# __docformat__ strings in each epydoc module. (So just
143+
# xml.dom.minidom and a few Docutils modules get plaintext
144+
# docstrings).
145+
api-html: .api-html.up2date
146+
.api-html.up2date: $(PY_SRCFILES) profile.out
147+
rm -rf $(HTML_API)
148+
mkdir -p $(HTML_API)
149+
$(EPYDOC) -o $(HTML_API) --name epydoc --css white \
150+
--url http://epydoc.sourceforge.net --pstat profile.out \
151+
--inheritance=listed --navlink "epydoc $(VERSION)"\
152+
--include-log \
153+
--docformat plaintext -v --graph all --debug $(PY_SRC)
154+
touch .api-html.up2date
155+
156+
api-pdf: .api-pdf.up2date
157+
.api-pdf.up2date: $(PY_SRCFILES)
158+
mkdir -p $(LATEX)
159+
rm -f $(LATEX_API)
160+
$(EPYDOC) --pdf -o $(LATEX_API) --docformat plaintext \
161+
--no-submodule-list --graph classtree --sty shaded \
162+
--name "Epydoc $(VERSION)" $(PY_SRC) -v --debug
163+
touch .api-pdf.up2date
164+
165+
# Convert doctest files to HTML, using rst2html.
166+
doctest-html: doctest-html-mkdir $(DOCTEST_HTML_FILES)
167+
doctest-html-mkdir:
168+
mkdir -p $(HTML_DOCTEST)
169+
$(HTML_DOCTEST)/%.html: src/epydoc/test/%.doctest
170+
mkdir -p $(HTML_DOCTEST)
171+
$(RST2HTML) --stylesheet=../custom.css $< $@ \
172+
--template=doc/rst-template2.txt
173+
174+
examples: .examples.up2date
175+
.examples.up2date: $(EXAMPLES_SRC) $(PY_SRCFILES)
176+
rm -rf $(HTML_EXAMPLES)
177+
mkdir -p $(HTML_EXAMPLES)
178+
$(EPYDOC) -o $(HTML_EXAMPLES) --name epydoc --debug \
179+
--url http://epydoc.sourceforge.net \
180+
--css white --top epytext_example --docformat=plaintext \
181+
--navlink 'epydoc examples' doc/epytext_example.py sre
182+
$(EPYDOC) -o $(HTML_EXAMPLES)/grouped --debug \
183+
--inheritance=grouped \
184+
--name epydoc --url http://epydoc.sourceforge.net \
185+
--css white --debug \
186+
--navlink 'epydoc examples' doc/inh_example.py
187+
$(EPYDOC) -o $(HTML_EXAMPLES)/listed --debug \
188+
--inheritance=listed \
189+
--name epydoc --url http://epydoc.sourceforge.net \
190+
--css white --debug \
191+
--navlink 'epydoc examples' doc/inh_example.py
192+
$(EPYDOC) -o $(HTML_EXAMPLES)/included --debug \
193+
--inheritance=included \
194+
--name epydoc --url http://epydoc.sourceforge.net \
195+
--css white --debug \
196+
--navlink 'epydoc examples' doc/inh_example.py
197+
touch .examples.up2date
198+
199+
# Generate the HTML version of the man page. Note: The
200+
# post-processing clean-up that I do is probably *not* very portable.
201+
doc/epydoc-man.html: man/epydoc.1
202+
man2html man/epydoc.1 \
203+
| sed 's/<\/HEAD>/<link rel="stylesheet" href="epydoc.css" type="text\/css"\/><\/HEAD>/' \
204+
| sed 's/<H1>EPYDOC<\/H1>/<H1>epydoc (1)<\/H1>/' \
205+
| sed 's/<BODY>/<BODY><DIV CLASS="BODY">/'\
206+
| sed 's/Content-type:.*//' \
207+
| sed '/Section: User Commands/,/<HR>/{s/.*//;}'\
208+
| sed 's/<\/BODY>/<\/DIV><\/BODY>/'\
209+
| sed '/<DD>/{s/<DD>//; :loop; n; b loop;}'\
210+
| sed 's/\(<A NAME=".*">\)&nbsp;<\/A>/\1/'\
211+
| sed 's/<\/H2>/<\/H2><\/A>/'\
212+
| sed 's/"\/cgi-bin\/man2html?epydocgui+1"/"epydocgui-man.html"/'\
213+
| sed 's/<A HREF="\/cgi-bin\/man2html">man2html<\/A>/man2html/'\
214+
> doc/epydoc-man.html
215+
216+
doc/epydocgui-man.html: man/epydocgui.1
217+
man2html man/epydocgui.1 \
218+
| sed 's/<\/HEAD>/<link rel="stylesheet" href="epydoc.css" type="text\/css"\/><\/HEAD>/' \
219+
| sed 's/<H1>EPYDOCGUI<\/H1>/<H1>epydocgui (1)<\/H1>/'\
220+
| sed 's/<BODY>/<BODY><DIV CLASS="BODY">/'\
221+
| sed 's/Content-type:.*//' \
222+
| sed '/Section: User Commands/,/<HR>/{s/.*//;}'\
223+
| sed 's/<\/BODY>/<\/DIV><\/BODY>/'\
224+
| sed '/<DD>/{s/<DD>//; :loop; n; b loop;}'\
225+
| sed 's/\(<A NAME=".*">\)&nbsp;<\/A>/\1/'\
226+
| sed 's/<\/H2>/<\/H2><\/A>/'\
227+
| sed 's/"\/cgi-bin\/man2html?epydocgui+1"/"epydocgui-man.html"/'\
228+
| sed 's/<A HREF="\/cgi-bin\/man2html">man2html<\/A>/man2html/'\
229+
> doc/epydocgui-man.html
230+
231+
profile.out: $(PY_SRCFILES)
232+
rm -f profile.out
233+
$(EPYDOC) -o profile.tmp --name epydoc --css white --debug \
234+
--url http://epydoc.sourceforge.net --profile-epydoc \
235+
--inheritance=listed --navlink "epydoc $(VERSION)"\
236+
--include-log \
237+
--docformat plaintext -v --graph all $(PY_SRC)
238+
rm -rf profile.tmp hotshot.out
239+
240+
# Convert builtin latex style files to html
241+
doc/epydoc-style-list.txt: src/epydoc/docwriter/latex_sty.py \
242+
src/tools/sty2html.py
243+
$(STY2HTML) $(DOCDIR)
244+
245+
##//////////////////////////////////////////////////////////////////////
246+
## Standard Library docs
247+
##//////////////////////////////////////////////////////////////////////
248+
249+
SLNAME = 'Python Standard Library'
250+
SLURL = "http://www.python.org/doc/lib/lib.html"
251+
SLFILES = $(shell find /usr/lib/$(PYTHON)/ -name '*.py' -o -name '*.so' \
252+
|grep -v "/$(PYTHON)/config/" \
253+
|grep -v "/$(PYTHON)/lib-old/" \
254+
|grep -v "/$(PYTHON)/idlelib/" \
255+
|grep -v "/$(PYTHON)/site-packages/" \
256+
|grep -v "/$(PYTHON)/__phello__\.foo\.py" )
257+
PY_PRINT_BUILTINS = "import sys; print ' '.join(sys.builtin_module_names)"
258+
SLBUILTINS = $(shell $(PYTHON) -c $(PY_PRINT_BUILTINS))
259+
260+
export TZ='XXX00XXX;000/00,000/00' # So tzparse won't die.
261+
stdlib-html: .stdlib-html.up2date
262+
.stdlib-html.up2date: $(PY_SRCFILES)
263+
rm -rf $(HTML_STDLIB)
264+
mkdir -p $(HTML_STDLIB)
265+
@echo "Building stdlib html docs..."
266+
@$(EPYDOC) -o $(HTML_STDLIB) --css white --name $(SLNAME) \
267+
--url $(SLURL) --debug --no-sourcecode --debug \
268+
--include-log --show-imports $(SLBUILTINS) $(SLFILES)
269+
touch .stdlib-html.up2date
270+
271+
# (this will typically cause latex to run out of resources)
272+
stdlib-pdf: .stdlib-pdf.up2date
273+
.stdlib-pdf.up2date: $(PY_SRCFILES)
274+
mkdir -p $(LATEX)
275+
rm -f $(LATEX_STDLIB)
276+
$(EPYDOC) --pdf -o $(LATEX_STDLIB) --debug \
277+
--no-private --name $(SLNAME) --docformat plaintext \
278+
--debug --builtins $(SLFILES)
279+
##//////////////////////////////////////////////////////////////////////
280+
## Unit Testing
281+
##//////////////////////////////////////////////////////////////////////
282+
283+
tests: test
284+
test:
285+
$(PYTHON) src/epydoc/test/__init__.py
286+
287+
##//////////////////////////////////////////////////////////////////////
288+
## Other test targets
289+
##//////////////////////////////////////////////////////////////////////
290+
291+
docutils: docutils-html docutils-pdf
292+
293+
docutils-html: .docutils-html.up2date
294+
.docutils-html.up2date: $(PY_SRCFILES)
295+
rm -rf $(HTML)/docutils
296+
mkdir -p $(HTML)/docutils
297+
$(EPYDOC) -o $(HTML)/docutils -n 'Docutils' --html --debug \
298+
--docformat plaintext --ignore-param-mismatch \
299+
--include-log /usr/lib/python2.3/site-packages/docutils
300+
touch .docutils-html.up2date
301+
302+
docutils-pdf: .docutils-pdf.up2date
303+
.docutils-pdf.up2date: $(PY_SRCFILES)
304+
rm -rf $(LATEX)/docutils
305+
mkdir -p $(LATEX)/docutils
306+
$(EPYDOC) -o $(LATEX)/docutils -n 'Docutils' --pdf --debug \
307+
--docformat plaintext --ignore-param-mismatch \
308+
/usr/lib/python2.3/site-packages/docutils
309+
touch .docutils-pdf.up2date
310+
311+

doc/.cvsignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*-man.html
2+
api
3+
*.pyc
4+
examples
5+

0 commit comments

Comments
 (0)