File: rules

package info (click to toggle)
dbus-python 1.2.16-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,128 kB
  • sloc: ansic: 10,146; sh: 4,962; python: 4,571; makefile: 667
file content (231 lines) | stat: -rwxr-xr-x 9,100 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#!/usr/bin/make -f
# Copyright © 2002,2003 Colin Walters <walters@verbum.org>
# Copyright © 2003 Daniel Stone <daniels@debian.org>
# Copyright © 2006 Sjoerd Simons <sjoerd@debian.org>
# Copyright © 2012 Collabora Ltd.

binaries := $(shell dh_listpackages)

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow

include /usr/share/dpkg/default.mk

ifneq ($(filter python-dbus,$(binaries)),)
PYTHON2 := $(shell pyversions --default --version)
else
PYTHON2 :=
endif
PYTHON3 := $(shell py3versions --requested --version debian/control)
PYDEFAULTVER := $(shell py3versions --default --version)

FLAVOURS := $(patsubst %,%-dbg,$(PYTHON2) $(PYTHON3)) $(PYTHON2) $(PYTHON3)

%:
	dh $@ $(DH_ADDONS) --buildsystem=autoconf
build binary %-indep: DH_ADDONS=--with=sphinxdoc

# The special case for 2.7-dbg is a workaround. Python 2 doesn't have the
# LDVERSION sysconfig variable, which would give AX_PYTHON_DEVEL the
# information it needs to know that it should link -lpython2.7_d and not
# -lpython2.7.
override_dh_auto_configure-arch:
	set -e; for x in $(FLAVOURS); do \
		if [ "x$$x" = x2.7-dbg ]; then \
			maybe_python_libs="PYTHON_LIBS=-lpython2.7_d"; \
		else \
			maybe_python_libs=""; \
		fi; \
		dh_auto_configure \
			--builddirectory=build-$$x \
			-- \
			PYTHON=/usr/bin/python$$x \
			$${maybe_python_libs} \
			--disable-documentation \
			--enable-installed-tests \
			--libdir=/usr/lib \
			; \
	done
override_dh_auto_configure-indep:
	dh_auto_configure \
		--builddirectory=build-indep \
		-- \
		PYTHON=/usr/bin/python3 \
		--libdir=/usr/lib \
		--disable-installed-tests \
		--enable-documentation \
		--docdir=/usr/share/doc/python-dbus-doc \
		--htmldir=/usr/share/doc/python-dbus-doc/html \
		${NULL}

override_dh_auto_build-arch:
	set -e; for x in $(FLAVOURS); do \
		PYTHON=/usr/bin/python$$x \
		dh_auto_build \
			--arch \
			--builddirectory=build-$$x \
			-- \
			installed_testdir='$${libexecdir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x" \
			installed_test_metadir='$${datadir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x" \
			$(NULL); \
	done
override_dh_auto_build-indep:
	PYTHON=/usr/bin/python3 dh_auto_build --indep --builddirectory=build-indep

override_dh_auto_test-arch:
	set -e; for x in $(PYTHON2) $(PYTHON3); do \
		LC_ALL=C.UTF-8 \
		PYTHON=/usr/bin/python$$x \
		VERBOSE=1 \
		dh_auto_test --no-parallel --arch --builddirectory=build-$$x; \
		LC_ALL=C.UTF-8 \
		PYTHON=/usr/bin/python$$x-dbg \
		VERBOSE=1 \
		dh_auto_test --no-parallel --arch --builddirectory=build-$$x-dbg; \
	done
override_dh_auto_test-indep:
	:

override_dh_auto_install-arch:
ifneq ($(filter python-dbus,$(binaries)),)
	set -e; for x in $(PYTHON2); do \
		PYTHON=/usr/bin/python$$x \
		dh_auto_install \
			--arch \
			--builddirectory=build-$$x \
			--destdir=debian/tmp \
			-- \
			installed_testdir='$${libexecdir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x" \
			installed_test_metadir='$${datadir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x" \
			pyexecdir='$${pythondir}' \
			pythondir='$${libdir}'/python$$x/dist-packages \
			; \
		PYTHON=/usr/bin/python$$x-dbg \
		dh_auto_install \
			--arch \
			--builddirectory=build-$$x-dbg \
			--destdir=debian/tmp-dbg \
			-- \
			installed_testdir='$${libexecdir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x-dbg" \
			installed_test_metadir='$${datadir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x-dbg" \
			pyexecdir='$${pythondir}' \
			pythondir='$${libdir}'/python$$x/dist-packages \
			; \
		install debian/tmp-dbg/usr/lib/python$$x/dist-packages/_dbus_bindings.so \
			debian/tmp/usr/lib/python$$x/dist-packages/_dbus_bindings_d.so; \
		install debian/tmp-dbg/usr/lib/python$$x/dist-packages/_dbus_glib_bindings.so \
			debian/tmp/usr/lib/python$$x/dist-packages/_dbus_glib_bindings_d.so; \
		install -d debian/tmp/usr/lib/python$$x/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info; \
		install -m644 dbus_python.egg-info/PKG-INFO debian/tmp/usr/lib/python$$x/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info/; \
		install -m644 dbus_python.egg-info/dependency_links.txt debian/tmp/usr/lib/python$$x/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info/; \
		install -m644 dbus_python.egg-info/top_level.txt debian/tmp/usr/lib/python$$x/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info/; \
		touch debian/tmp/usr/lib/python$$x/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info/not-zip-safe; \
	done
endif
	set -e; for x in $(PYTHON3); do \
		PYTHON=/usr/bin/python$$x \
		dh_auto_install \
			--arch \
			--builddirectory=build-$$x \
			--destdir=debian/tmp \
			-- \
			installed_testdir='$${libexecdir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x" \
			installed_test_metadir='$${datadir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x" \
			pyexecdir='$${pythondir}' \
			pythondir='$${libdir}/python3/dist-packages' \
			; \
		so=`/usr/bin/python$$x -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX') or sysconfig.get_config_var('SO'))"`; \
		mv debian/tmp/usr/lib/python3/dist-packages/_dbus_bindings.so \
			debian/tmp/usr/lib/python3/dist-packages/_dbus_bindings$$so; \
		mv debian/tmp/usr/lib/python3/dist-packages/_dbus_glib_bindings.so \
			debian/tmp/usr/lib/python3/dist-packages/_dbus_glib_bindings$$so; \
		mv "debian/tmp/usr/libexec/installed-tests/dbus-python/python$$x/test/dbus_py_test.so" \
			"debian/tmp/usr/lib/python3/dist-packages/dbus_py_test$$so"; \
		PYTHON=/usr/bin/python$$x-dbg \
		dh_auto_install \
			--arch \
			--builddirectory=build-$$x-dbg \
			--destdir=debian/tmp-dbg \
			-- \
			installed_testdir='$${libexecdir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x-dbg" \
			installed_test_metadir='$${datadir}/installed-tests/$${PACKAGE_TARNAME}/'"python$$x-dbg" \
			pyexecdir='$${pythondir}' \
			pythondir='$${libdir}/python3/dist-packages' \
			; \
		so=`/usr/bin/python$$x-dbg -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX') or sysconfig.get_config_var('SO'))"`; \
		mv debian/tmp-dbg/usr/lib/python3/dist-packages/_dbus_bindings.so \
			debian/tmp-dbg/usr/lib/python3/dist-packages/_dbus_bindings$$so; \
		mv debian/tmp-dbg/usr/lib/python3/dist-packages/_dbus_glib_bindings.so \
			debian/tmp-dbg/usr/lib/python3/dist-packages/_dbus_glib_bindings$$so; \
		mv "debian/tmp-dbg/usr/libexec/installed-tests/dbus-python/python$$x-dbg/test/dbus_py_test.so" \
			"debian/tmp-dbg/usr/lib/python3/dist-packages/dbus_py_test$$so"; \
	done
	install -d debian/tmp/usr/lib/python3/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info
	install -m644 dbus_python.egg-info/PKG-INFO debian/tmp/usr/lib/python3/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info/
	install -m644 dbus_python.egg-info/dependency_links.txt debian/tmp/usr/lib/python3/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info/
	install -m644 dbus_python.egg-info/top_level.txt debian/tmp/usr/lib/python3/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info/
	touch debian/tmp/usr/lib/python3/dist-packages/dbus_python-${DEB_VERSION_UPSTREAM}.egg-info/not-zip-safe

override_dh_auto_install-indep:
	dh_auto_install \
		--indep \
		--builddirectory=build-indep \
		--destdir=debian/tmp-indep \
		$(NULL)

override_dh_install:
	rm -fr debian/tmp/usr/include
	rm -fr debian/tmp/usr/lib/pkgconfig
	rm -fr debian/tmp/usr/share/doc/dbus-python
	find debian/tmp -name '*.py[co]' -print0 | xargs -0 rm -f
	find debian/tmp -name '*.la' -print0 | xargs -0 rm -f
	dh_install

override_dh_installchangelogs:
	dh_installchangelogs -XChangeLog

override_dh_installexamples:
	dh_installexamples --doc-main-package=python-dbus-doc -ppython-dbus-doc
	dh_installexamples --remaining-packages

override_dh_installdocs:
ifneq ($(filter python-dbus,$(binaries)),)
	dh_installdocs --link-doc=python-dbus -ppython-dbus-dbg
	dh_installdocs --doc-main-package=python-dbus -ppython-dbus
endif
	dh_installdocs --link-doc=python3-dbus -ppython3-dbus-dbg
	dh_installdocs --doc-main-package=python-dbus-doc -ppython-dbus-doc
	dh_installdocs --doc-main-package=python3-dbus -ppython3-dbus
	dh_installdocs --remaining-packages

override_dh_sphinxdoc-indep:
	dh_sphinxdoc /usr/share/doc/python-dbus-doc/html

override_dh_auto_clean:
	dh_auto_clean
	rm -Rf build-* install-2* install-3* debian/tmp-dbg
	find . -name '*.py[co]' -print0 | xargs -0 rm -f

override_dh_missing:
	dh_missing --fail-missing

override_dh_strip:
ifneq ($(filter python-dbus,$(binaries)),)
	dh_strip --dbg-package=python-dbus-dbg -ppython-dbus -ppython-dbus-dbg -ppython-dbus-tests
endif
	dh_strip --dbg-package=python3-dbus-dbg -ppython3-dbus -ppython3-dbus-dbg -ppython3-dbus-tests

ifneq ($(filter python-dbus,$(binaries)),)
override_dh_python2:
	dh_python2
	set -e; for x in $(PYTHON2) $(patsubst %,%-dbg,$(PYTHON2)); do \
		dh_python2 --shebang="/usr/bin/python$$x" \
			/usr/libexec/installed-tests/dbus-python/python$$x; \
	done
endif

override_dh_python3:
	dh_python3
	set -e; for x in $(PYTHON3) $(patsubst %,%-dbg,$(PYTHON3)); do \
		dh_python3 --shebang="/usr/bin/python$$x" \
			/usr/libexec/installed-tests/dbus-python/python$$x; \
	done