File: rules

package info (click to toggle)
sphinx 1.6.3-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 14,872 kB
  • ctags: 9,522
  • sloc: python: 50,242; perl: 380; makefile: 292; sh: 80; xml: 16; ansic: 1
file content (169 lines) | stat: -rwxr-xr-x 6,500 bytes parent folder | download
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/make -f
# -*- makefile -*-

include /usr/share/python/python.mk

export NO_PKG_MANGLE=1
export PYTHONWARNINGS=d
export PYTHONHASHSEED=random
export http_proxy=http://127.0.0.1:9/

here = $(dir $(firstword $(MAKEFILE_LIST)))/..
debian_version = $(word 2,$(shell cd $(here) && dpkg-parsechangelog | grep ^Version:))
upstream_version = $(subst ~,,$(firstword $(subst -, ,$(debian_version))))

locales = $(notdir $(patsubst %/LC_MESSAGES,%,$(wildcard sphinx/locale/*/LC_MESSAGES)))
scripts = $(sort $(basename $(wildcard sphinx-*.py)))

debroot = debian/tmp/
py2_libdir = $(call py_libdir,$(shell pyversions -d))
py3_libdir = $(call py_libdir,$(shell py3versions -d))
javascript_path = /usr/share/javascript/sphinxdoc/1.0/

.PHONY: clean
clean:
	dh_clean 
	find . -name '*.py[co]' -delete
	rm -rf build tests/build
	rm -f $(basename $(wildcard debian/*.in))
	rm -f sphinx/pycode/Grammar*.pickle
	rm -f sphinx/locale/*/LC_MESSAGES/sphinx.js
	rm -f sphinx/locale/.DS_Store
	rm -rf sphinx/locale/.tx
	rm -f Sphinx.egg-info/SOURCES.txt Sphinx.egg-info/*-e
	rm -f sphinx/texinputs/needspace.sty

.PHONY: build build-arch build-indep
build build-indep: build-stamp

sphinx/themes/basic/static/%.js:
	ln -sf /usr/share/javascript/$(*)/$(*).js $(@)
       
build/javascript-stamp: $(addprefix sphinx/themes/basic/static/,jquery.js underscore.js)
	echo $(^) | xargs -n1 | xargs -t -I {} [ -L {} ]
	mkdir -p $(dir $@)
	touch $(@)

build-stamp: sphinx-build.py build/javascript-stamp
	python ./sphinx-build.py -T doc build/html/
	rm -f build/html/_static/jquery-*.js build/html/_static/underscore-*.js
	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'
	rm -rf build/man
	cp -rl build/html build/man
	python ./sphinx-build.py -T -b man doc build/man
	python setup.py build --build-lib build/py2/
	python3 setup.py build --build-lib build/py3/
	python setup.py compile_catalog
ifeq "$(filter nocheck,$(DEB_BUILD_OPTIONS))" ""
	export LC_ALL=C.UTF-8 && \
	set -ex; for py in $(shell pyversions -r) $(shell py3versions -r); do \
		if [ "$$py" \< "python3.5" ]; then \
			$$py tests/run.py --ignore tests/test_websupport.py --ignore tests/test_api_translator.py --ignore tests/py35; \
		else \
			$$py tests/run.py --ignore tests/test_websupport.py --ignore tests/test_api_translator.py; \
		fi; \
	done
	rm -rf build/py2/tests/ build/py3/tests/
endif
	# import sphinx.pycode to generate grammar pickle files
	cd build/py2/ && PYTHONHASHSEED=0 python -c "import sphinx.pycode"
	cd build/py3/ && PYTHONHASHSEED=0 python3 -c "import sphinx.pycode"
	touch build-stamp

.PHONY: binary binary-arch binary-indep
binary binary-indep: build-stamp
	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 -f $(debroot)/usr/lib/python*/*-packages/Sphinx-*.egg-info/SOURCES.txt
	# 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
	rm -rf $(debroot)/usr/share/sphinx/
	mkdir -p $(debroot)/usr/share/sphinx/
	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/pycode/
	cd $(debroot) && mv -t usr/share/sphinx/pycode/ \
		.$(py2_libdir)/sphinx/pycode/Grammar*
	cd $(debroot) && mv -t usr/share/sphinx/pycode/ \
		.$(py3_libdir)/sphinx/pycode/Grammar*
	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 */
	# 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:
	debian/dh-sphinxdoc/install-js debian/libjs-sphinxdoc/$(javascript_path)/
	rm -f $(debroot)/usr/share/sphinx/themes/basic/static/underscore-*.js
	rm -f $(debroot)/usr/share/sphinx/themes/basic/static/jquery-*.js
	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
	dh_install -p sphinx-common -X /scripts/
	dh_install -N sphinx-common --fail-missing
	dh_installchangelogs CHANGES
	dh_installdocs
	dh_lintian
	./debian/dh-sphinxdoc/dh_sphinxdoc -p sphinx-doc /usr/share/doc/sphinx-doc/html/
	dh_installexamples
	cd debian/dh-sphinxdoc/ && pod2man -c Debhelper -r '' dh_sphinxdoc dh_sphinxdoc.1
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_python2 -p python-sphinx
	dh_python3 -p python3-sphinx --no-guessing-deps
	dh_strip_nondeterminism
	dh_compress -X.py -X.rst -X.json -X.txt
	dh_link
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# vim:ts=4 sw=4 noet