8
8
include /usr/share/dpatch/dpatch.make
10
export DH_PYCENTRAL=nomove
12
10
p = python-docutils
14
12
PYTHON = /usr/bin/python
15
13
PYVER := $(shell $(PYTHON) -c 'import sys; print sys.version[:3]')
14
DEB_UPSTREAM_VERSION := $(shell dpkg-parsechangelog | sed -rne 's,^Version: ([^-]+).*,\1,p')
17
16
BUILDHTML_DIRS := .
18
17
BUILDHTML_RECURSE_DIRS := docs
20
build-stamp: patch-stamp
23
22
$(PYTHON) setup.py build
24
23
$(PYTHON) setup_roman.py build
25
set -e && for dir in $(BUILDHTML_DIRS); do PYTHONPATH=.:extras $(PYTHON) tools/buildhtml.py --local --config=tools/docutils.conf $$dir --traceback; done
26
set -e && for dir in $(BUILDHTML_RECURSE_DIRS); do PYTHONPATH=.:extras $(PYTHON) tools/buildhtml.py --config=tools/docutils.conf $$dir --traceback; done
24
set -e && for dir in $(BUILDHTML_DIRS); do \
25
PYTHONPATH=.:extras $(PYTHON) tools/buildhtml.py \
26
--local --config=tools/docutils.conf $$dir \
29
set -e && for dir in $(BUILDHTML_RECURSE_DIRS); do \
30
PYTHONPATH=.:extras $(PYTHON) tools/buildhtml.py \
31
--config=tools/docutils.conf $$dir --traceback; \
29
35
clean: clean-patched unpatch
35
41
$(PYTHON) setup.py clean --all
36
42
-find -name '*.py[co]' | xargs rm -f
38
find docs -name '*.html' -not -name 'quickref.html' -print0 | xargs -0 --no-run-if-empty rm
45
find docs -name '*.html' -not -name 'quickref.html' -print0 | \
46
xargs -0 --no-run-if-empty rm
47
-rm -rf docutils.egg-info
45
-mkdir -p $(d)/usr/bin
47
: # Install Python files - all to python-docutils first, then sort
48
: # out roman.py afterwards (it looks simpler to do it separately,
49
: # but currently distutils ends up copying both roman and docutils
50
: # to both directories if you do)
52
55
$(PYTHON) setup.py install \
53
--root debian/tmp --no-compile \
54
--install-lib /usr/share/pycentral/$(p)/site-packages \
55
--install-data /usr/share/pycentral/$(p)/site-packages \
56
--root debian/tmp --no-compile
57
57
$(PYTHON) setup_roman.py install \
58
--root debian/tmp --no-compile \
59
--install-lib /usr/share/pycentral/$(p)/site-packages \
60
--install-data /usr/share/pycentral/$(p)/site-packages \
62
install -d debian/tmp/usr/share/pycentral/python-roman/site-packages
63
mv debian/tmp/usr/share/pycentral/python-docutils/site-packages/roman.py \
64
debian/tmp/usr/share/pycentral/python-roman/site-packages/roman.py
66
# Emacs: move files to site-start directory
67
install -d $(d)/usr/share/emacs/site-lisp
68
install -m644 tools/editors/emacs/rst.el $(d)/usr/share/emacs/site-lisp/rst.el
70
# ... and have it autoload rst-mode
71
install -d $(d)/etc/emacs/site-start.d/
72
install -m 644 debian/emacs-start.el \
73
$(d)/etc/emacs/site-start.d/50python-docutils.el
58
--root debian/tmp --no-compile
59
: # share Egg dir between all versions
60
mv debian/tmp/usr/lib/python$(PYVER)/site-packages/docutils-$(DEB_UPSTREAM_VERSION)-py$(PYVER).egg-info \
61
debian/tmp/usr/lib/python$(PYVER)/site-packages/docutils-$(DEB_UPSTREAM_VERSION).egg-info
75
62
: # give scripts canonical names in /usr/bin
76
63
cd debian/tmp/usr/bin && \
77
64
mv rst2newlatex.py rst2newlatex && \
81
68
mv rst2pseudoxml.py rst2pseudoxml && \
82
69
mv rstpep2html.py rstpep2html && \
83
70
mv rst2latex.py rst2latex
85
71
install tools/buildhtml.py debian/tmp/usr/bin/rst-buildhtml
72
: # Make the man pages (we want to do this *after* renaming all the
73
: # tools, because their executable name goes into the --help output)
74
PYTHONPATH=.:extras $(PYTHON) debian/tmp/usr/bin/rst2html --help | \
75
PYTHONPATH=.:extras $(PYTHON) tools/rst2xml.py | \
77
--stringparam name rst2html \
78
--stringparam date "`date +'%B %Y'`" \
79
--stringparam oneliner 'convert reST documents to XHTML' \
80
debian/rsthelp2man.xsl - > debian/rst2html.1
81
PYTHONPATH=.:extras $(PYTHON) debian/tmp/usr/bin/rst2xml --help | \
82
PYTHONPATH=.:extras $(PYTHON) tools/rst2xml.py | \
84
--stringparam name rst2xml \
85
--stringparam date "`date +'%B %Y'`" \
86
--stringparam oneliner 'convert reST documents to XML' \
87
debian/rsthelp2man.xsl - > debian/rst2xml.1
88
PYTHONPATH=.:extras $(PYTHON) debian/tmp/usr/bin/rst2latex --help | \
89
PYTHONPATH=.:extras $(PYTHON) tools/rst2xml.py | \
91
--stringparam name rst2latex \
92
--stringparam date "`date +'%B %Y'`" \
93
--stringparam oneliner 'convert reST documents to LaTeX (stable version)' \
94
debian/rsthelp2man.xsl - > debian/rst2latex.1
95
PYTHONPATH=.:extras $(PYTHON) debian/tmp/usr/bin/rst2newlatex --help | \
96
PYTHONPATH=.:extras $(PYTHON) tools/rst2xml.py | \
98
--stringparam name rst2newlatex \
99
--stringparam date "`date +'%B %Y'`" \
100
--stringparam oneliner 'convert reST documents to LaTeX (experimental version)' \
101
debian/rsthelp2man.xsl - > debian/rst2newlatex.1
102
PYTHONPATH=.:extras $(PYTHON) debian/tmp/usr/bin/rst2pseudoxml --help | \
103
PYTHONPATH=.:extras $(PYTHON) tools/rst2xml.py | \
105
--stringparam name rst2pseudoxml \
106
--stringparam date "`date +'%B %Y'`" \
107
--stringparam oneliner 'convert reST documents to pseudo-XML' \
108
debian/rsthelp2man.xsl - > debian/rst2pseudoxml.1
109
PYTHONPATH=.:extras $(PYTHON) debian/tmp/usr/bin/rst2s5 --help | \
110
PYTHONPATH=.:extras $(PYTHON) tools/rst2xml.py | \
112
--stringparam name rst2s5 \
113
--stringparam date "`date +'%B %Y'`" \
114
--stringparam oneliner 'convert reST documents to S5 slides' \
115
debian/rsthelp2man.xsl - > debian/rst2s5.1
116
PYTHONPATH=.:extras $(PYTHON) debian/tmp/usr/bin/rstpep2html --help | \
117
PYTHONPATH=.:extras $(PYTHON) tools/rst2xml.py | \
119
--stringparam name rstpep2html \
120
--stringparam date "`date +'%B %Y'`" \
121
--stringparam oneliner 'convert reST Python Enhancement Proposals to HTML' \
122
debian/rsthelp2man.xsl - > debian/rstpep2html.1
123
PYTHONPATH=.:extras $(PYTHON) debian/tmp/usr/bin/rst-buildhtml --help | \
124
PYTHONPATH=.:extras $(PYTHON) tools/rst2xml.py | \
126
--stringparam name rst-buildhtml \
127
--stringparam date "`date +'%B %Y'`" \
128
--stringparam oneliner 'convert many reST documents to HTML' \
129
debian/rsthelp2man.xsl - > debian/rst-buildhtml.1
87
130
: # Install documentation
88
131
rm -f $(d)/usr/share/doc/$(p)/COPYING[-.]*
89
132
set -e && ( cd docs; find . -name SCCS -prune -o -type d -print ) | \
95
138
binary-indep: build install
100
141
dh_installdocs *.txt *.html -XCOPYING
101
set -e && ( cd docs; find . -name SCCS -prune -o -type d -print ) | \
102
while read f ; do install -d $(d)/usr/share/doc/$(p)/docs/$$f ; done
103
set -e && ( cd docs; find . -name SCCS -prune -o -type f -print ) | \
104
while read f ; do install -o root -m 755 docs/$$f $(d)/usr/share/doc/$(p)/docs/$$f ; done
106
dh_movefiles -ppython-roman \
107
usr/share/pycentral/python-roman
108
dh_movefiles -ppython-docutils \
109
usr/share/pycentral/python-docutils usr/bin
111
: # The license file for python-roman mentions the GPL
112
install -d debian/python-roman/usr/share/lintian/overrides
113
install -m644 debian/python-roman.override \
114
debian/python-roman/usr/share/lintian/overrides/python-roman
118
144
dh_installexamples
120
set -e && for x in rst2latex rst2newlatex rst2html rst2pseudoxml \
121
rst2s5 rstpep2html rst2xml rst-buildhtml; do \
122
ln -sf rst2html.1.gz $(d)/usr/share/man/man1/$$x.1.gz; \
124
146
dh_installchangelogs
125
147
dh_compress -X.py -X.dtd -X.html