File: rules

package info (click to toggle)
python-defaults 2.7.16-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 856 kB
  • sloc: python: 2,342; makefile: 564; sh: 203; perl: 7
file content (401 lines) | stat: -rwxr-xr-x 14,129 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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.

export SHELL = /bin/bash

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

changelog_values := $(shell dpkg-parsechangelog \
			| awk '/^(Version|Source):/ {print $$2}')
PKGSOURCE  := $(word 1, $(changelog_values))
PKGVERSION := $(word 2, $(changelog_values))

distribution := $(shell dpkg-vendor --query Vendor)
distrelease  := $(shell lsb_release -cs)

export VER=2.7
export NVER=2.8
export PVER=python2.7

PREVVER	:= $(shell awk '/^python/ && NR > 1 {print substr($$2,2,length($$2)-2); exit}' debian/changelog)
# first version with Multi-Arch: allowed
PREVVER := 2.7.16-1~

# not yet allowed
ma_allowed	= yes

ifeq (,$(filter $(distrelease),lenny etch squeeze wheezy lucid maverick natty oneiric precise quantal raring saucy trusty))
  bd_i586 = dpkg-dev (>= 1.17.11), python2.7:any (>= 2.7.16-1~)
endif


PWD		:= $(shell pwd)

d		:= debian/tmp
scriptdir	=  usr/share/lib/python$(VER)
scriptdir	=  usr/share/python$(VER)
scriptdir	=  usr/lib/python$(VER)

rst2html	= rst2html

with_doc	= yes
ifneq ($(with_doc),yes)
  NOPKGS	= -Npython-doc
endif

build: stamp-build
build-arch: stamp-build
build-indep: stamp-build
stamp-build:
	touch stamp-build

control-file:
	sed -e "s/@PVER@/$(PVER)/g" \
	    -e "s/@NVER@/$(NVER)/g" \
	    -e "s/@VER@/$(VER)/g" \
	    -e "s/@PREVVER@/$(PREVVER)/g" \
	    -e "s/@bd_i586@/$(bd_i586)/g" \
		<debian/control.in \
	    $(if $(ma_allowed),,| grep -v '^Multi-Arch: allowed$$') \
		>debian/control.tmp
ifeq ($(distribution),Ubuntu)
  ifneq (,$(findstring ubuntu, $(PKGVERSION)))
	m='Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>'; \
	sed -i "/^Maintainer:/s/\(.*\)/Maintainer: $$m\nXSBC-Original-\1/" \
	  debian/control.tmp
  endif
endif
	[ -e debian/control ] \
	  && cmp -s debian/control debian/control.tmp \
	  && rm -f debian/control.tmp && exit 0; \
	  mv debian/control.tmp debian/control

MANPAGES ?= dh_python2.1 pycompile.1 pyclean.1

%.1: %.rst
	rst2man $< > $@

# Manually run this rule if there is a need to update the dh_python2 man pages
make-man: $(MANPAGES)
	cd pydist && \
	rst2html README.PyDist > README.PyDist.html

clean: control-file
	dh_testdir
	dh_testroot
	rm -f stamp-*
	rm -f patch-stamp*

	set -e;\
	for f in debian/*.in; do \
	    f2=`echo $$f | sed "s,PVER,$(PVER),g;s/VER/$(VER)/g;s,\.in$$,,"`; \
	    if [ $$f2 != debian/control ]; then \
	        rm -f $$f2; \
	    fi; \
	done
	rm -f debian/*.py[co]
	make clean
	dh_clean

stamp-control:
	: # We have to prepare the various control files

	set -e;\
	for f in debian/*.in; do \
	    f2=`echo $$f | sed "s,PVER,$(PVER),g;s/VER/$(VER)/g;s,\.in$$,,"`; \
	    if [ $$f2 != debian/control ]; then \
		sed -e "s/@PVER@/$(PVER)/g;s/@VER@/$(VER)/g" \
		    -e "s/@PRIORITY@/$(PRIORITY)/g" \
		    -e "s,@SCRIPTDIR@,/$(scriptdir),g" \
		  <$$f >$$f2; \
	    fi; \
	done

install: build stamp-dh_python stamp-install
stamp-install: stamp-build control-file stamp-control
	dh_testdir
	dh_testroot
	dh_installdirs -ppython usr/share/doc/python
	dh_install

	touch stamp-install

stamp-dh_python:
	dh_testdir
	dh_testroot
	dh_installdirs
	-make check_versions
	DESTDIR=debian/python2 PREFIX=/usr make install-dev
	DESTDIR=debian/python2-minimal PREFIX=/usr make install-runtime
	# disabled by default, run manually if you want to update it
	# (requires apt-file and network connection)
	#make -C pydist dist_fallback
	touch $@

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir -i
	dh_testroot -i
	dh_installman -i

ifeq ($(with_doc),yes)
	dh_installdocs -ppython-doc -ppython2-doc debian/README.Debian
	dh_installchangelogs -ppython-doc -ppython2-doc
	mkdir -p debian/python-doc/usr/share/doc/python
	ln -sf ../python$(VER)-doc/html \
		debian/python-doc/usr/share/doc/python/html
	mkdir -p debian/python-doc/usr/share/doc/python-doc
	ln -sf ../python$(VER)-doc/html \
		debian/python-doc/usr/share/doc/python-doc/html

	mkdir -p debian/python2-doc/usr/share/doc/python2
	ln -sf ../python$(VER)-doc/html \
		debian/python2-doc/usr/share/doc/python2/html
	mkdir -p debian/python2-doc/usr/share/doc/python2-doc
	ln -sf ../python$(VER)-doc/html \
		debian/python2-doc/usr/share/doc/python2-doc/html
endif

#	dh_installdebconf -i $(NOPKGS)
	dh_lintian -i
	dh_installdocs -i $(NOPKGS) --all debian/README.Debian
	dh_installchangelogs -i $(NOPKGS)

	dh_compress -i $(NOPKGS)
	dh_fixperms -i $(NOPKGS)
	dh_installdeb -i $(NOPKGS)
	dh_gencontrol -i $(NOPKGS)
	dh_md5sums -i $(NOPKGS)
	dh_builddeb -i $(NOPKGS)

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir -a
	dh_testroot -a
	dh_installman -a

	: # provide the python2 and python2.1 defaults
	mkdir -p debian/python2-minimal/usr/bin
	ln -sf python$(VER) debian/python2-minimal/usr/bin/python2
	mkdir -p debian/python2-minimal/usr/share/man/man1
	ln -sf python$(VER).1.gz \
		debian/python2-minimal/usr/share/man/man1/python2.1.gz

	: # provide the python and python.1 defaults
	mkdir -p debian/python-minimal/usr/bin
	ln -sf python2 debian/python-minimal/usr/bin/python
	mkdir -p debian/python-minimal/usr/share/man/man1
	ln -sf python2.1.gz \
		debian/python-minimal/usr/share/man/man1/python.1.gz

	: # 
	mkdir -p debian/python2-minimal/usr/share/python
	cp -p debian/debian_defaults \
		debian/python2-minimal/usr/share/python/

	install -m 755 debian/pyversions.py \
		debian/python2-minimal/usr/share/python/
	install -m 644 debian/pyversions.1 \
		debian/python2-minimal/usr/share/man/man1/
	dh_link -ppython2-minimal /usr/share/python/pyversions.py /usr/bin/pyversions

	mkdir -p debian/python2/usr/bin
	ln -sf pydoc$(VER) debian/python2/usr/bin/pydoc2
	ln -sf pygettext$(VER) debian/python2/usr/bin/pygettext2
	ln -sf pdb$(VER) debian/python2/usr/bin/pdb2

	mkdir -p debian/python/usr/bin
	ln -sf pydoc2 debian/python/usr/bin/pydoc
	ln -sf pygettext2 debian/python/usr/bin/pygettext
	ln -sf pdb2 debian/python/usr/bin/pdb

	mkdir -p debian/python2/usr/share/python
	install -m 644 debian/python.mk \
		debian/python2/usr/share/python/

	mkdir -p debian/python2/usr/share/man/man1
	ln -sf pydoc$(VER).1.gz \
		debian/python2/usr/share/man/man1/pydoc2.1.gz
	ln -sf pygettext$(VER).1.gz \
		debian/python2/usr/share/man/man1/pygettext2.1.gz
	ln -sf pdb$(VER).1.gz \
		debian/python2/usr/share/man/man1/pdb2.1.gz

	mkdir -p debian/python/usr/share/man/man1
	ln -sf pydoc2.1.gz \
		debian/python/usr/share/man/man1/pydoc.1.gz
	ln -sf pygettext2.1.gz \
		debian/python/usr/share/man/man1/pygettext.1.gz
	ln -sf pdb2.1.gz \
		debian/python/usr/share/man/man1/pdb.1.gz

	mkdir -p debian/python2/usr/share/pixmaps
	ln -sf python$(VER).xpm debian/python2/usr/share/pixmaps/python2.xpm

	mkdir -p debian/python/usr/share/pixmaps
	ln -sf python$(VER).xpm debian/python/usr/share/pixmaps/python.xpm

	mkdir -p debian/python2/usr/share/apps/konsole
	cp -p debian/python2.desktop debian/python2/usr/share/apps/konsole/

	mkdir -p debian/python/usr/share/apps/konsole
	cp -p debian/python.desktop debian/python/usr/share/apps/konsole/

	: # provide the python2-config default
	mkdir -p debian/python2-dev/usr/bin
	ln -sf python$(VER)-config debian/python2-dev/usr/bin/python2-config
	mkdir -p debian/python2-dev/usr/share/man/man1
	ln -sf python$(VER)-config.1.gz \
		debian/python2-dev/usr/share/man/man1/python2-config.1.gz

	: # provide the python-config default
	mkdir -p debian/python-dev/usr/bin
	ln -sf python2-config debian/python-dev/usr/bin/python-config
	mkdir -p debian/python-dev/usr/share/man/man1
	ln -sf python2-config.1.gz \
		debian/python-dev/usr/share/man/man1/python-config.1.gz

	: # provide pkgconfig defaults
	mkdir -p debian/python2-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	ln -sf python-$(VER).pc debian/python2-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python2.pc
	mkdir -p debian/python2-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	ln -sf python-$(VER)-dbg.pc debian/python2-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python2-dbg.pc

	mkdir -p debian/python-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	ln -sf python2.pc debian/python-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python.pc
	mkdir -p debian/python-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	ln -sf python2-dbg.pc debian/python-dbg/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/python-dbg.pc

	: # provide the python2-dbg and python2-dbg.1 defaults
	mkdir -p debian/python2-dbg/usr/bin
	ln -sf python$(VER)-dbg debian/python2-dbg/usr/bin/python2-dbg
	ln -sf python$(VER)-dbg-config debian/python2-dbg/usr/bin/python2-dbg-config
	mkdir -p debian/python2-dbg/usr/share/man/man1
	ln -sf python$(VER)-dbg.1.gz \
		debian/python2-dbg/usr/share/man/man1/python2-dbg.1.gz
	ln -sf python$(VER)-dbg-config.1.gz \
		debian/python2-dbg/usr/share/man/man1/python2-dbg-config.1.gz
	mkdir -p debian/python2-dbg/usr/share/doc/python2
	ln -sf ../python$(VER)/SpecialBuilds.txt.gz \
		debian/python2-dbg/usr/share/doc/python2/SpecialBuilds.txt.gz
	ln -sf ../python$(VER)/README.debug \
		debian/python2-dbg/usr/share/doc/python2/README.debug

	: # provide the python-dbg and python-dbg.1 defaults
	mkdir -p debian/python-dbg/usr/bin
	ln -sf python2-dbg debian/python-dbg/usr/bin/python-dbg
	ln -sf python2-dbg-config debian/python-dbg/usr/bin/python-dbg-config
	mkdir -p debian/python-dbg/usr/share/man/man1
	ln -sf python2-dbg.1.gz \
		debian/python-dbg/usr/share/man/man1/python-dbg.1.gz
	ln -sf python2-dbg-config.1.gz \
		debian/python-dbg/usr/share/man/man1/python-dbg-config.1.gz
	mkdir -p debian/python-dbg/usr/share/doc/python
	ln -sf ../python2/SpecialBuilds.txt.gz \
		debian/python-dbg/usr/share/doc/python/SpecialBuilds.txt.gz
	ln -sf ../python2/README.debug \
		debian/python-dbg/usr/share/doc/python/README.debug

	mkdir -p debian/python2/usr/lib/valgrind
	cp -p debian/valgrind-python.supp \
		debian/python2/usr/lib/valgrind/python2.supp
	mkdir -p debian/python/usr/lib/valgrind
	ln -sf python2.supp \
		debian/python/usr/lib/valgrind/python.supp

	: # provide the DEB_HOST_GNU_TYPE/DEB_HOST_MULTIRACH python2-config defaults
	mkdir -p debian/libpython2-dev/usr/bin
	ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)-config \
		debian/libpython2-dev/usr/bin/$(DEB_HOST_MULTIARCH)-python2-config
	mkdir -p debian/libpython2-dev/usr/share/man/man1
	ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)-config.1.gz \
		debian/libpython2-dev/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python2-config.1.gz
ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE))
	ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)-config \
		debian/libpython2-dev/usr/bin/$(DEB_HOST_GNU_TYPE)-python2-config
	ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)-config.1.gz \
		debian/libpython2-dev/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-python2-config.1.gz
endif

	mkdir -p debian/libpython2-dbg/usr/bin
	ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)-dbg-config \
		debian/libpython2-dbg/usr/bin/$(DEB_HOST_MULTIARCH)-python2-dbg-config
	mkdir -p debian/libpython2-dbg/usr/share/man/man1
	ln -sf $(DEB_HOST_MULTIARCH)-python$(VER)-dbg-config.1.gz \
		debian/libpython2-dbg/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python2-dbg-config.1.gz
ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE))
	ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)-dbg-config \
		debian/libpython2-dbg/usr/bin/$(DEB_HOST_GNU_TYPE)-python2-dbg-config
	ln -sf $(DEB_HOST_GNU_TYPE)-python$(VER)-dbg-config.1.gz \
		debian/libpython2-dbg/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-python2-dbg-config.1.gz
endif

	: # provide the DEB_HOST_GNU_TYPE/DEB_HOST_MULTIRACH python-config defaults
	mkdir -p debian/libpython-dev/usr/bin
	ln -sf $(DEB_HOST_MULTIARCH)-python2-config \
		debian/libpython-dev/usr/bin/$(DEB_HOST_MULTIARCH)-python-config
	mkdir -p debian/libpython-dev/usr/share/man/man1
	ln -sf $(DEB_HOST_MULTIARCH)-python2-config.1.gz \
		debian/libpython-dev/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python-config.1.gz
ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE))
	ln -sf $(DEB_HOST_GNU_TYPE)-python2-config \
		debian/libpython-dev/usr/bin/$(DEB_HOST_GNU_TYPE)-python-config
	ln -sf $(DEB_HOST_GNU_TYPE)-python2-config.1.gz \
		debian/libpython-dev/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-python-config.1.gz
endif

	mkdir -p debian/libpython-dbg/usr/bin
	ln -sf $(DEB_HOST_MULTIARCH)-python2-dbg-config \
		debian/libpython-dbg/usr/bin/$(DEB_HOST_MULTIARCH)-python-dbg-config
	mkdir -p debian/libpython-dbg/usr/share/man/man1
	ln -sf $(DEB_HOST_MULTIARCH)-python2-dbg-config.1.gz \
		debian/libpython-dbg/usr/share/man/man1/$(DEB_HOST_MULTIARCH)-python-dbg-config.1.gz
ifneq ($(DEB_HOST_MULTIARCH),$(DEB_HOST_GNU_TYPE))
	ln -sf $(DEB_HOST_GNU_TYPE)-python2-dbg-config \
		debian/libpython-dbg/usr/bin/$(DEB_HOST_GNU_TYPE)-python-dbg-config
	ln -sf $(DEB_HOST_GNU_TYPE)-python2-dbg-config.1.gz \
		debian/libpython-dbg/usr/share/man/man1/$(DEB_HOST_GNU_TYPE)-python-dbg-config.1.gz
endif

	dh_lintian -a
	dh_installdocs -a $(NOPKGS) --all debian/README.Debian
	dh_installchangelogs -a $(NOPKGS)

	for p in dbg dev; do \
	  p=python2-$$p; \
	  rm -rf debian/$$p/usr/share/doc/$$p; \
	  ln -sf python2 debian/$$p/usr/share/doc/$$p; \
	done
	for p in all all-dev all-dbg dbg dev; do \
	  p=python-$$p; \
	  rm -rf debian/$$p/usr/share/doc/$$p; \
	  ln -sf python debian/$$p/usr/share/doc/$$p; \
	done
	rm -rf debian/libpython-all-dev/usr/share/doc/libpython-all-dev
	ln -sf libpython-dev debian/libpython-all-dev/usr/share/doc/libpython-all-dev
	rm -rf debian/libpython-all-dbg/usr/share/doc/libpython-all-dbg
	ln -sf libpython-dbg debian/libpython-all-dbg/usr/share/doc/libpython-all-dbg

	dh_compress -a $(NOPKGS)
	dh_fixperms -a $(NOPKGS)
	dh_installdeb -a $(NOPKGS)
	dh_gencontrol -a $(NOPKGS)
	dh_md5sums -a $(NOPKGS)
	dh_builddeb -a $(NOPKGS)

# Build architecture-dependent files here.
binary-arch: build install
# nothing to do

binary: binary-indep binary-arch

.PHONY: control-file configure build clean binary-indep binary-arch binary install

# Local Variables:
# mode: makefile
# end: