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
|
#!/usr/bin/make -f
# -*- makefile -*-
export NO_PKG_MANGLE=1
export LC_ALL=C.UTF-8
export PYTHONWARNINGS=d
export PYBUILD_TEST_ARGS=--verbose --ignore tests/test_websupport.py --ignore tests/test_api_translator.py
export PYBUILD_INSTALL_ARGS_python2=--install-scripts usr/share/sphinx/scripts/python2
export PYBUILD_INSTALL_ARGS_python3=--install-scripts usr/share/sphinx/scripts/python3
locales = $(notdir $(patsubst %/LC_MESSAGES,%,$(wildcard sphinx/locale/*/LC_MESSAGES)))
debroot = debian/tmp/
py2_libdir = /usr/lib/python2.7/dist-packages
py3_libdir = /usr/lib/python3/dist-packages
py3_builddir = $(shell pybuild --print build_dir --interpreter python3)
javascript_path = /usr/share/javascript/sphinxdoc/1.0/
%:
dh $@ --with python2,python3 --buildsystem=pybuild
override_dh_auto_build:
ln -sf /usr/share/javascript/jquery/jquery.js sphinx/themes/basic/static/jquery.js
ln -sf /usr/share/javascript/underscore/underscore.js sphinx/themes/basic/static/underscore.js
dh_auto_build
ifeq "$(filter nodoc,$(DEB_BUILD_OPTIONS))" ""
PYTHONPATH=$(py3_builddir) python3 ./sphinx/cmd/build.py -T doc build/html/
find build/html/ -name '*.txt' -or -name '*.html' | xargs -L1 sed -i \
's!http://docutils.sourceforge.net/docs/!file:///usr/share/doc/docutils-doc/docs/!g'
PYTHONPATH=$(py3_builddir) python3 ./sphinx/cmd/build.py -T -b man doc build/man
endif
PYTHONPATH=$(py3_builddir) python3 setup.py compile_catalog
override_dh_auto_install:
pybuild --install -p 2.7
pybuild --install -p 3
# move static files outside dist-packages
sed -i -e "s!^package_dir = .*!package_dir = '/usr/share/sphinx'!" \
$(debroot)$(py2_libdir)/sphinx/__init__.py \
$(debroot)$(py3_libdir)/sphinx/__init__.py
cd $(debroot) && mv -t usr/share/sphinx/ \
.$(py2_libdir)/sphinx/templates \
.$(py2_libdir)/sphinx/texinputs \
.$(py2_libdir)/sphinx/themes
mkdir -p $(debroot)/usr/share/sphinx/ext/autosummary/
cd $(debroot) && mv -t usr/share/sphinx/ext/autosummary/ \
.$(py2_libdir)/sphinx/ext/autosummary/templates
mkdir -p $(debroot)/usr/share/sphinx/search/
cd $(debroot) && mv -t usr/share/sphinx/search/ \
.$(py2_libdir)/sphinx/search/non-minified-js
cd $(debroot)$(py3_libdir)/sphinx/ && \
rm -rf templates/ texinputs/ themes/ ext/autosummary/templates/ \
search/non-minified-js/
set -e -x; \
cd $(debroot) && \
for lang in $(locales); \
do \
install -m 644 -D .$(py2_libdir)/sphinx/locale/$$lang/LC_MESSAGES/sphinx.js \
usr/share/sphinx/locale/$$lang/sphinx.js; \
install -m 644 -D .$(py2_libdir)/sphinx/locale/$$lang/LC_MESSAGES/sphinx.mo \
usr/share/locale/$$lang/LC_MESSAGES/sphinx.mo; \
done
cd $(debroot)$(py2_libdir)/sphinx/locale && rm -rf sphinx.pot */
cd $(debroot)$(py3_libdir)/sphinx/locale && rm -rf sphinx.pot */
# Move JavaScript code to libjs-sphinxdoc:
PYTHONPATH=$(py3_builddir) debian/dh-sphinxdoc/install-js debian/libjs-sphinxdoc$(javascript_path)
rm -f $(debroot)/usr/share/sphinx/themes/bizstyle/static/css3-mediaqueries_src.js
set -e; \
for js in $$(find $(debroot)/usr/share/sphinx/themes/ -name '*.js' -a '!' -name 'websupport.js'); do \
mv $$js debian/libjs-sphinxdoc/$(javascript_path); \
ln -sf "$(javascript_path)/$${js##*/}" $$js; \
done
override_dh_installchangelogs:
dh_installchangelogs CHANGES
override_dh_installdocs:
dh_installdocs
ifeq "$(filter nodoc,$(DEB_BUILD_OPTIONS))" ""
./debian/dh-sphinxdoc/dh_sphinxdoc -p sphinx-doc /usr/share/doc/sphinx-doc/html/
endif
override_dh_installman:
cd debian/dh-sphinxdoc/ && pod2man -c Debhelper -r '' dh_sphinxdoc dh_sphinxdoc.1
ifeq "$(filter nodoc,$(DEB_BUILD_OPTIONS))" ""
dh_installman
endif
override_dh_compress:
dh_compress -X.py -X.rst -X.json -X.txt
|