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 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
#!/usr/bin/make -f
# -*- makefile -*-
include /usr/share/python/python.mk
export PYTHONWARNINGS=d
here = $(dir $(firstword $(MAKEFILE_LIST)))/..
debian_version = $(word 2,$(shell cd $(here) && dpkg-parsechangelog | grep ^Version:))
upstream_dfsg_version = $(firstword $(subst -, ,$(debian_version)))
upstream_version = $(firstword $(subst +, ,$(debian_version)))
locales = $(notdir $(patsubst %/LC_MESSAGES,%,$(wildcard sphinx/locale/*/LC_MESSAGES)))
scripts = $(basename $(wildcard sphinx-*.py))
debroot = debian/tmp/
site_packages = $(call py_libdir,$(shell pyversions -d))
py3_site_packages = $(call py_libdir,$(shell py3versions -d))
javascript_path = /usr/share/javascript/sphinxdoc/1.0/
python_all = pyversions -r | tr ' ' '\n' | xargs -t -I {} env {}
python3_all = py3versions -r | tr ' ' '\n' | xargs -t -I {} env {}
build-arch:
build-indep build: build-stamp
build-stamp:
dh_testdir
ln -sf /usr/share/javascript/jquery/jquery.js sphinx/themes/basic/static/
ln -sf /usr/share/javascript/underscore/underscore.js sphinx/themes/basic/static/
python ./sphinx-build.py doc build/html/
rm -rf build/man
cp -rl build/html build/man
python ./sphinx-build.py -b man doc build/man
python setup.py build --build-lib build/py2/
python3 setup.py build --build-lib build/py3/
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
find sphinx/locale/ -name '*.po' | xargs -t -I {} msgfmt -o /dev/null -c {}
$(python_all) tests/run.py --verbose --no-skip
export LC_ALL=C.UTF-8 && $(python3_all) tests/run.py --verbose
cd build/py3/ && rm -rf tests/ sphinx/pycode/Grammar.pickle
xvfb-run ./debian/jstest/run-tests
endif
touch build-stamp
clean:
dh_testdir
find . -name '*.py[co]' -delete
rm -rf build
rm -f $(basename $(wildcard debian/*.in))
dh_clean
install: build
dh_testdir
dh_testroot
dh_installdirs
python setup.py \
build --build-lib build/py2/ \
install --no-compile --install-layout=deb --root $(debroot)
python3 setup.py \
build --build-lib build/py3/ \
install --no-compile --install-layout=deb --root $(debroot)
rm $(debroot)/usr/lib/python*/*-packages/Sphinx-*.egg-info/SOURCES.txt
# move static files outside {site,dist}-packages
sed -i -e "s!^package_dir = .*!package_dir = '/usr/share/sphinx'!" \
$(debroot)$(site_packages)/sphinx/__init__.py \
$(debroot)$(py3_site_packages)/sphinx/__init__.py
rm -rf $(debroot)/usr/share/sphinx/
mkdir -p $(debroot)/usr/share/sphinx/
cd $(debroot) && mv -t usr/share/sphinx/ \
.$(site_packages)/sphinx/texinputs \
.$(site_packages)/sphinx/themes
mkdir -p $(debroot)/usr/share/sphinx/pycode/
cd $(debroot) && mv -t usr/share/sphinx/pycode/ \
.$(site_packages)/sphinx/pycode/Grammar.txt
cp -t $(debroot)/usr/share/sphinx/pycode/ sphinx/pycode/Grammar.pickle
mkdir -p $(debroot)/usr/share/sphinx/ext/autosummary/
cd $(debroot) && mv -t usr/share/sphinx/ext/autosummary/ \
.$(site_packages)/sphinx/ext/autosummary/templates
cd $(debroot)$(py3_site_packages)/sphinx/ && \
rm -rf texinputs/ themes/ pycode/Grammar.txt ext/autosummary/templates/
set -e -x; \
cd $(debroot) && \
for lang in $(locales); \
do \
install -m 644 -D .$(site_packages)/sphinx/locale/$$lang/LC_MESSAGES/sphinx.js \
usr/share/sphinx/locale/$$lang/sphinx.js; \
install -m 644 -D .$(site_packages)/sphinx/locale/$$lang/LC_MESSAGES/sphinx.mo \
usr/share/locale/$$lang/LC_MESSAGES/sphinx.mo; \
done
cd $(debroot)$(site_packages)/sphinx/locale && rm -rf sphinx.pot */
cd $(debroot)$(py3_site_packages)/sphinx/locale && rm -rf sphinx.pot */
# install scripts not touched by easy install
set -e -x; \
for python in python2 python3; do \
dir=$(debroot)/usr/share/sphinx/scripts/$$python/; \
mkdir -p $$dir; \
for script in $(scripts); do \
sed -e "1 s,#!.*,#!/usr/bin/$${python%2}," $$script.py \
> $$dir/$$script; \
rm -f $(debroot)/usr/bin/$$script; \
done; \
chmod 755 $$dir/*; \
done
set -e -x; \
for maintscript in $(wildcard debian/sphinx-common.*.in); do \
sed -e 's/@SCRIPTS@/$(scripts)/' $$maintscript > $${maintscript%.in}; \
done
# Move JavaScript code to libjs-sphinxdoc:
rm -f build/html/_static/websupport.js
set -e -x; \
for js in $$(find build/html/_static/ -name '*.js'); do \
rm -f debian/libjs-sphinxdoc/$(javascript_path)/$${js##*/}; \
cp -f $$js debian/libjs-sphinxdoc/$(javascript_path); \
done
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
cd debian/dh-sphinxdoc/ && pod2man -c Debhelper -r '' dh_sphinxdoc dh_sphinxdoc.1
binary-indep: build install
dh_testdir
dh_testroot
dh_installchangelogs CHANGES
dh_installdocs
dh_install -p sphinx-common -X /scripts/
dh_install -N sphinx-common --fail-missing
dh_lintian
./debian/dh-sphinxdoc/dh_sphinxdoc -p sphinx-doc /usr/share/doc/sphinx-doc/html/
dh_installexamples
ifneq ($(shell grep -h '^[.]TH' debian/*.1 | cut -d ' ' -f 6-7 | sort -u), "Sphinx $(upstream_version)")
$(warning W: version numbers in the manual pages are out of date)
endif
dh_installman
dh_pysupport -p python-sphinx
dh_python3 -p python3-sphinx --no-guessing-deps
dh_compress -X.py -X.js -X.rst -X.json -X.txt -Xobjects.inv
dh_link
dh_fixperms
dh_installdeb
dh_gencontrol
dh_md5sums
dh_builddeb
binary-arch: build install
binary: binary-indep binary-arch
get-orig-source:
sh $(here)/debian/get-orig-source.sh $(upstream_dfsg_version)
.PHONY: build-arch build-indep build clean binary-indep binary-arch binary install get-orig-source
|