| 1 |
|
| 2 |
|
| 3 |
export PYTHONWARNINGS=d |
| 4 |
export PYTHONHASHSEED=random |
| 5 |
|
| 6 |
export PYBUILD_TEST_ARGS=SOURCE_DATE_EPOCH= {interpreter} test/alltests.py && \ |
| 7 |
PYTHONWARNINGS=ignore::DeprecationWarning {interpreter} $(CURDIR)/tools/test/test_buildhtml.py --verbose |
| 8 |
|
| 9 |
scripts = \ |
| 10 |
docutils \ |
| 11 |
rst-buildhtml \ |
| 12 |
rst2html \ |
| 13 |
rst2html4 \ |
| 14 |
rst2html5 \ |
| 15 |
rst2latex \ |
| 16 |
rst2man \ |
| 17 |
rst2odt \ |
| 18 |
rst2pseudoxml \ |
| 19 |
rst2s5 \ |
| 20 |
rst2xetex \ |
| 21 |
rst2xml \ |
| 22 |
rstpep2html \ |
| 23 |
|
| 24 |
pre_localize_css = 's,href="(([.][.]/)*)docutils/.*/([^/]+[.]css)",href="$$1css/$$3",g;' |
| 25 |
pre_strip_images1 = 's,<img src="http://[^"]+" alt="([^"]*)"[^>]*>,$$1,g;' |
| 26 |
pre_strip_images2 = 's,<img alt="([^"]*)"[^>]*\bsrc="http://[^"]+"[^>]*>,$$1,g;' |
| 27 |
pre_strip_images = $(pre_strip_images1)$(pre_strip_images2) |
| 28 |
|
| 29 |
%: |
| 30 |
dh $@ --with xml_core --buildsystem=pybuild |
| 31 |
|
| 32 |
override_dh_auto_build: |
| 33 |
|
| 34 |
rm -f docutils/utils/_roman_numerals.py test/test_utils/test__roman_numerals.py |
| 35 |
|
| 36 |
if grep -r __file__ --include='*.py' docutils/ | grep -vw '_datadir'; then \ |
| 37 |
echo "Error: Some uses of __file__ are not guarded by _datadir()." \ |
| 38 |
"Is move-data-to-usr-share.diff up-to-date?"; \ |
| 39 |
exit 1; \ |
| 40 |
fi |
| 41 |
dh_auto_build |
| 42 |
|
| 43 |
PYTHONPATH=. LC_ALL=C.UTF-8 python3 tools/buildhtml.py \ |
| 44 |
--local --link-stylesheet --traceback --writer=html5 \ |
| 45 |
. |
| 46 |
PYTHONPATH=. LC_ALL=C.UTF-8 python3 tools/buildhtml.py \ |
| 47 |
--link-stylesheet --traceback --writer=html5 \ |
| 48 |
docs |
| 49 |
( ls *.html && find docs/ -name '*.html' ) \ |
| 50 |
| xargs perl -0777 -p -i -e $(pre_localize_css)$(pre_strip_images) |
| 51 |
sed -i 's,$(CURDIR),,' docs/user/rst/demo.html |
| 52 |
|
| 53 |
override_dh_auto_test: |
| 54 |
dh_auto_test -- --system custom |
| 55 |
|
| 56 |
override_dh_auto_clean: |
| 57 |
dh_auto_clean |
| 58 |
find docs -name '*.html' -not -name 'quickref.html' -delete |
| 59 |
|
| 60 |
override_dh_auto_install: |
| 61 |
dh_auto_install |
| 62 |
|
| 63 |
mkdir -p debian/tmp/usr/share/ |
| 64 |
cp -rlf debian/tmp/usr/lib/python3*/dist-packages/docutils debian/tmp/usr/share/ |
| 65 |
find debian/tmp/usr/lib/python3*/dist-packages/docutils/ -type f '!' -name '*.py' -delete |
| 66 |
find debian/tmp/usr/share/docutils/ \( -name '*.py' -o -name '*.py[co]' \) -delete |
| 67 |
find debian/tmp/ -type d -empty -delete |
| 68 |
|
| 69 |
sed -i -e 's/^\(_debian_package\) = 0/\1 = "build"/' debian/tmp/usr/lib/python3*/dist-packages/docutils/__init__.py |
| 70 |
install tools/buildhtml.py debian/tmp/usr/bin/rst-buildhtml |
| 71 |
install tools/rstpep2html.py debian/tmp/usr/bin/rstpep2html |
| 72 |
sed -i -e "1 s,^#!.*,#!/usr/bin/python3," \ |
| 73 |
debian/tmp/usr/bin/rst-buildhtml \ |
| 74 |
debian/tmp/usr/bin/rstpep2html |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
mkdir -p debian/tmp/man/ |
| 80 |
set -ex && for exe in $(scripts); do \ |
| 81 |
export PYTHONPATH=debian/tmp/usr/lib/$(shell py3versions -d)/dist-packages; \ |
| 82 |
cp debian/$$exe.txt debian/tmp/man/$$exe.txt; \ |
| 83 |
python3 debian/tmp/usr/bin/$$exe --help > debian/tmp/man/$$exe.help.txt; \ |
| 84 |
sed \ |
| 85 |
-e '1 s/^Usage$$/Synopsis/' \ |
| 86 |
-e 's/^=/====/' \ |
| 87 |
-e '3 s/^ //' \ |
| 88 |
-e '4 a Description' \ |
| 89 |
-e '4 a ===========' \ |
| 90 |
< debian/tmp/man/$$exe.help.txt >> debian/tmp/man/$$exe.txt;\ |
| 91 |
python3 tools/rst2man.py debian/tmp/man/$$exe.txt \ |
| 92 |
debian/tmp/man/$$exe.1; \ |
| 93 |
rm debian/tmp/man/$$exe.help.txt debian/tmp/man/$$exe.txt; \ |
| 94 |
done |
| 95 |
|
| 96 |
sed -i -e 's/^\(_debian_package\) = "build"/\1 = 1/' debian/tmp/usr/lib/python3*/dist-packages/docutils/__init__.py |
| 97 |
sed -i -e 's,"\(docutils/writers/\),"/usr/share/\1,g' debian/tmp/man/* |
| 98 |
|
| 99 |
override_dh_installdocs: |
| 100 |
dh_installdocs -XCOPYING |
| 101 |
mkdir -p debian/docutils-doc/usr/share/doc/python3-docutils/ |
| 102 |
cd debian/docutils-doc/usr/share/doc/python3-docutils/ && ln -sf ../docutils-doc/*.html . |
| 103 |
|
| 104 |
override_dh_installchangelogs: |
| 105 |
dh_installchangelogs -XHISTORY |
| 106 |
|
| 107 |
override_dh_compress: |
| 108 |
dh_compress -p docutils-doc -X.dtd -X.rst |
| 109 |
dh_compress --remaining-packages |