File: rules

package info (click to toggle)
python3-stdlib-extensions 3.13.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 32,060 kB
  • sloc: python: 143,054; ansic: 66,791; makefile: 314; sh: 149
file content (397 lines) | stat: -rwxr-xr-x 13,698 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
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.

export SHELL = /bin/bash

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

distrelease  := $(shell lsb_release -cs)

#rel_ext	= $(strip $(shell dpkg-parsechangelog | awk -F- '/^Version:/ {print $$NF}'))

PYVERS	= $(shell py3versions -vs)
PYVERS	= 3.13

MIN_VER = 3.13.2-1~
NEXT_VER = 3.14

# FIXME: remove sid when uploading to unstable, after bullseye is released
#ifeq (,$(filter $(distrelase), jessie stretch buster bullseye bookworm sid precise trusty xenial bionic focal groovy hirsute))
#  ifneq (,$(filter 3.1% 3.2%, $(PYVERS)))
#    with_dbmmodule = yes
#    dbm_breaks = '-Vdbm:Breaks=libpython3.10-stdlib (<< 3.10.0~b1-2~)'
#    dbmdbg_breaks = '-Vdbmdbg:Breaks=libpython3.10-dbg (<< 3.10.0~b1-2~)'
#  endif
#endif

include /usr/share/dpkg/architecture.mk

SET_ENV = PYTHONPATH=$(CURDIR)/$*/Lib
SET_ENV12 = PYTHONPATH=$(CURDIR)/3.12/Lib
SET_ENV13 = PYTHONPATH=$(CURDIR)/3.13/Lib

ifneq ($(DEB_BUILD_MULTIARCH),$(DEB_HOST_MULTIARCH))
  SET_ENV += PYTHONPATH=/usr/lib/python$*/plat-$(DEB_HOST_MULTIARCH)
  SET_ENV12 += PYTHONPATH=/usr/lib/python3.12/plat-$(DEB_HOST_MULTIARCH)
  SET_ENV13 += PYTHONPATH=/usr/lib/python3.13/plat-$(DEB_HOST_MULTIARCH)

  # FIXME: is this sufficient?
  SET_ENV += _PYTHON_HOST_PLATFORM=$(DEB_HOST_GNU_CPU)
  SET_ENV12 += _PYTHON_HOST_PLATFORM=$(DEB_HOST_GNU_CPU)
  SET_ENV13 += _PYTHON_HOST_PLATFORM=$(DEB_HOST_GNU_CPU)
endif

p_tk	= python3-tk
p_gdbm	= python3-gdbm
p_2to3	= python3-lib2to3
d_tk	= debian/$(p_tk)
d_gdbm	= debian/$(p_gdbm)
d_2to3	= debian/$(p_2to3)

build-arch: build
build-indep: build
build: build-stamp
build-arch: build-stamp
build-indep: build-stamp
#build-stamp: $(PYVERS:%=build-stamp-py%) $(PYVERS:%=dbg-stamp-py%)
#	touch $@
build-stamp:
	: # all extensions built from the pythonX.Y packages
	touch $@

build-stamp-py%:
	dh_testdir
	ln -sf /usr/lib/libBLT.2.4.so.8.6 $*/libBLT86.so
	ln -sf /usr/lib/libBLT.2.4.so.8.6 $*/libBLT86.so.8.6
	cd $* && $(SET_ENV) python$* setup.py build
	touch $@

dbg-stamp-py%:
	dh_testdir
	ln -sf /usr/lib/libBLT.2.4.so.8.6 $*/libBLT85.so
	ln -sf /usr/lib/libBLT.2.4.so.8.6 $*/libBLT85.so.8.6
	cd $* && $(SET_ENV) python$*-dbg setup.py build
	touch $@

build-stamp-py3.12:
	dh_testdir
	ln -sf /usr/lib/libBLT.2.4.so.8.6 3.12/libBLT86.so
	ln -sf /usr/lib/libBLT.2.4.so.8.6 3.12/libBLT86.so.8.6
	cd 3.12 && $(SET_ENV12) python3.12 setup.py build
	touch $@

dbg-stamp-py3.12:
	dh_testdir
	ln -sf /usr/lib/libBLT.2.4.so.8.6 3.12/libBLT85.so
	ln -sf /usr/lib/libBLT.2.4.so.8.6 3.12/libBLT85.so.8.6
	cd 3.12 && $(SET_ENV12) python3.12-dbg setup.py build
	touch $@

build-stamp-py3.13:
	dh_testdir
	ln -sf /usr/lib/libBLT.2.4.so.8.6 3.13/libBLT86.so
	ln -sf /usr/lib/libBLT.2.4.so.8.6 3.13/libBLT86.so.8.6
	cd 3.13 && $(SET_ENV13) python3.13 setup.py build
	touch $@

dbg-stamp-py3.13:
	dh_testdir
	ln -sf /usr/lib/libBLT.2.4.so.8.6 3.13/libBLT85.so
	ln -sf /usr/lib/libBLT.2.4.so.8.6 3.13/libBLT85.so.8.6
	cd 3.13 && $(SET_ENV13) python3.13-dbg setup.py build
	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f *stamp*
	rm -rf 3.*/build
	rm -rf 3.*/libBLT*
	rm -f debian/python3-tk.postinst
	rm -f debian/python3-lib2to3.postinst
	find 3* -name __pycache__ | xargs -r rm -rf
	dh_clean

install: build install-prereq $(PYVERS:%=install-stamp-py%) $(PYVERS:%=dbg-install-py%)
#	rdfind -makehardlinks true $(d_tk)/usr/lib
#	rdfind -makehardlinks true $(d_2to3)/usr/lib
	rm -f results.txt

install-prereq:
	dh_testdir
	dh_testroot
	dh_prep

install-stamp-py%: #build-stamp-py%
	: # nothing to do
ifeq (0,1)
	: # FIXME: 3.11 install errors out ...
	if [ "$*" = 3.11 ]; then \
	  cd $* && $(SET_ENV) python$* setup.py install \
		--root=$(CURDIR)/$(d_tk) --install-layout=deb; \
	  mkdir -p $(d_tk)/usr/lib/python$*/lib-dynload; \
	  mv $(d_tk)/usr/lib/python3/dist-packages/*.so \
	    $(d_tk)/usr/lib/python$*/lib-dynload; \
	  rm -rf $(d_tk)/usr/lib/python3/dist-packages; \
	else \
	  cd $* && $(SET_ENV) python$* setup.py install \
		--root=$(CURDIR)/$(d_tk) --install-layout=deb; \
	fi
	mkdir -p $(d_tk)/usr/lib/python$*/lib-dynload
	mv $(d_tk)/usr/lib/python3/*-packages/*.so \
		$(d_tk)/usr/lib/python$*/lib-dynload/
	mkdir -p $(d_gdbm)/usr/lib/python$*/lib-dynload
	mv $(d_tk)/usr/lib/python$*/lib-dynload/_gdbm*.so \
		$(d_gdbm)/usr/lib/python$*/lib-dynload/
ifeq ($(with_dbmmodule),yes)
	if [ -f $(d_tk)/usr/lib/python$*/lib-dynload/_dbm*.so ]; then \
	  mv $(d_tk)/usr/lib/python$*/lib-dynload/_dbm*.so \
		$(d_gdbm)/usr/lib/python$*/lib-dynload/; \
	fi
endif
	rm -rf $(d_tk)/usr/lib/python3
	cp -r $*/Lib/tkinter $(d_tk)/usr/lib/python$*/.
	rm -rf $(d_tk)/usr/lib/python$*/tkinter/test
endif

#	mkdir -p $(d_2to3)/usr/lib/python$*
#	cp -r $*/Lib/lib2to3 $(d_2to3)/usr/lib/python$*/.
#	rm -rf $(d_2to3)/usr/lib/python$*/lib2to3/tests
#	find $(d_2to3) -name __pycache__ | xargs -r rm -rf

dbg-install-py%: #dbg-stamp-py%
	: # nothing to do
ifeq (0,1)
	: # FIXME: 3.11 install errors out ...
	if [ "$*" = 3.11 ]; then \
	  cd $* && $(SET_ENV) python$*-dbg setup.py install \
		--root=$(CURDIR)/$(d_tk)-dbg --install-layout=deb; \
	  mkdir -p $(d_tk)/usr/lib/python$*/lib-dynload; \
	  mv $(d_tk)/usr/lib/python3/dist-packages/*.so \
	    $(d_tk)/usr/lib/python$*/lib-dynload; \
	  rm -rf $(d_tk)/usr/lib/python3/dist-packages; \
	else \
	  cd $* && $(SET_ENV) python$*-dbg setup.py install \
		--root=$(CURDIR)/$(d_tk)-dbg --install-layout=deb; \
	fi
	mkdir -p $(d_tk)-dbg/usr/lib/python$*/lib-dynload
	mv $(d_tk)-dbg/usr/lib/python3/*-packages/*.so \
		$(d_tk)-dbg/usr/lib/python$*/lib-dynload/
	mkdir -p $(d_gdbm)-dbg/usr/lib/python$*/lib-dynload
	mv $(d_tk)-dbg/usr/lib/python$*/lib-dynload/_gdbm*.so \
		$(d_gdbm)-dbg/usr/lib/python$*/lib-dynload/
  ifeq ($(with_dbmmodule),yes)
	if [ -f $(d_tk)-dbg/usr/lib/python$*/lib-dynload/_dbm*.so ]; then \
	  mv $(d_tk)-dbg/usr/lib/python$*/lib-dynload/_dbm*.so \
		$(d_gdbm)-dbg/usr/lib/python$*/lib-dynload/; \
	fi
  endif
	rm -rf $(d_tk)-dbg/usr/lib/python3
endif

install-stamp-py3.12: #build-stamp-py3.12
ifeq (0,1)
	: # FIXME: 3.12 install errors out ...
	if [ "3.12" = 3.12 ]; then \
	  cd 3.12 && $(SET_ENV12) python3.12 setup.py install \
		--root=$(CURDIR)/$(d_tk) --install-layout=deb; \
	  mkdir -p $(d_tk)/usr/lib/python3.12/lib-dynload; \
	  mv $(d_tk)/usr/lib/python3/dist-packages/*.so \
	    $(d_tk)/usr/lib/python3.12/lib-dynload; \
	  rm -rf $(d_tk)/usr/lib/python3/dist-packages; \
	else \
	  cd 3.12 && $(SET_ENV12) python3.12 setup.py install \
		--root=$(CURDIR)/$(d_tk) --install-layout=deb; \
	fi
	mkdir -p $(d_tk)/usr/lib/python3.12/lib-dynload
	mv $(d_tk)/usr/lib/python3/*-packages/*.so \
		$(d_tk)/usr/lib/python3.12/lib-dynload/
	mkdir -p $(d_gdbm)/usr/lib/python3.12/lib-dynload
	mv $(d_tk)/usr/lib/python3.12/lib-dynload/_gdbm*.so \
		$(d_gdbm)/usr/lib/python3.12/lib-dynload/
  ifeq ($(with_dbmmodule),yes)
	if [ -f $(d_tk)/usr/lib/python3.12/lib-dynload/_dbm*.so ]; then \
	  mv $(d_tk)/usr/lib/python3.12/lib-dynload/_dbm*.so \
		$(d_gdbm)/usr/lib/python3.12/lib-dynload/; \
	fi
  endif
	rm -rf $(d_tk)/usr/lib/python3
	cp -r 3.12/Lib/tkinter $(d_tk)/usr/lib/python3.12/.
	rm -rf $(d_tk)/usr/lib/python3.12/tkinter/test
endif
#	mkdir -p $(d_2to3)/usr/lib/python3.12
#	cp -r 3.12/Lib/lib2to3 $(d_2to3)/usr/lib/python3.12/.
#	rm -rf $(d_2to3)/usr/lib/python3.12/lib2to3/tests
#	find $(d_2to3) -name __pycache__ | xargs -r rm -rf

dbg-install-py3.12: #dbg-stamp-py3.12
ifeq (0,1)
	: # FIXME: 3.12 install errors out ...
	if [ "3.12" = 3.12 ]; then \
	  cd 3.12 && $(SET_ENV12) python3.12-dbg setup.py install \
		--root=$(CURDIR)/$(d_tk)-dbg --install-layout=deb; \
	  mkdir -p $(d_tk)/usr/lib/python3.12/lib-dynload; \
	  mv $(d_tk)/usr/lib/python3/dist-packages/*.so \
	    $(d_tk)/usr/lib/python3.12/lib-dynload; \
	  rm -rf $(d_tk)/usr/lib/python3/dist-packages; \
	else \
	  cd 3.12 && $(SET_ENV12) python3.12-dbg setup.py install \
		--root=$(CURDIR)/$(d_tk)-dbg --install-layout=deb; \
	fi
	mkdir -p $(d_tk)-dbg/usr/lib/python3.12/lib-dynload
	mv $(d_tk)-dbg/usr/lib/python3/*-packages/*.so \
		$(d_tk)-dbg/usr/lib/python3.12/lib-dynload/
	mkdir -p $(d_gdbm)-dbg/usr/lib/python3.12/lib-dynload
	mv $(d_tk)-dbg/usr/lib/python3.12/lib-dynload/_gdbm*.so \
		$(d_gdbm)-dbg/usr/lib/python3.12/lib-dynload/
  ifeq ($(with_dbmmodule),yes)
	if [ -f $(d_tk)-dbg/usr/lib/python3.12/lib-dynload/_dbm*.so ]; then \
	  mv $(d_tk)-dbg/usr/lib/python3.12/lib-dynload/_dbm*.so \
		$(d_gdbm)-dbg/usr/lib/python3.12/lib-dynload/; \
	fi
  endif
	rm -rf $(d_tk)-dbg/usr/lib/python3
endif

install-stamp-py3.13: #build-stamp-py3.13
	: # nothing to do
ifeq (0,1)
	: # FIXME: 3.13 install errors out ...
	if [ "3.13" = 3.13 ]; then \
	  cd 3.13 && $(SET_ENV13) python3.13 setup.py install \
		--root=$(CURDIR)/$(d_tk) --install-layout=deb; \
	  mkdir -p $(d_tk)/usr/lib/python3.13/lib-dynload; \
	  mv $(d_tk)/usr/lib/python3/dist-packages/*.so \
	    $(d_tk)/usr/lib/python3.13/lib-dynload; \
	  rm -rf $(d_tk)/usr/lib/python3/dist-packages; \
	else \
	  cd 3.13 && $(SET_ENV13) python3.13 setup.py install \
		--root=$(CURDIR)/$(d_tk) --install-layout=deb; \
	fi
	mkdir -p $(d_tk)/usr/lib/python3.13/lib-dynload
	mv $(d_tk)/usr/lib/python3/*-packages/*.so \
		$(d_tk)/usr/lib/python3.13/lib-dynload/
	mkdir -p $(d_gdbm)/usr/lib/python3.13/lib-dynload
	mv $(d_tk)/usr/lib/python3.13/lib-dynload/_gdbm*.so \
		$(d_gdbm)/usr/lib/python3.13/lib-dynload/
  ifeq ($(with_dbmmodule),yes)
	if [ -f $(d_tk)/usr/lib/python3.13/lib-dynload/_dbm*.so ]; then \
	  mv $(d_tk)/usr/lib/python3.13/lib-dynload/_dbm*.so \
		$(d_gdbm)/usr/lib/python3.13/lib-dynload/; \
	fi
  endif
	rm -rf $(d_tk)/usr/lib/python3
	cp -r 3.13/Lib/tkinter $(d_tk)/usr/lib/python3.13/.
	rm -rf $(d_tk)/usr/lib/python3.13/tkinter/test

	mkdir -p $(d_dist)/usr/lib/python3.13
	find $(d_dist) -name __pycache__ | xargs -r rm -rf
endif

dbg-install-py3.13: #dbg-stamp-py3.13
ifeq (0,1)
	: # FIXME: 3.13 install errors out ...
	if [ "3.13" = 3.13 ]; then \
	  cd 3.13 && $(SET_ENV13) python3.13-dbg setup.py install \
		--root=$(CURDIR)/$(d_tk)-dbg --install-layout=deb; \
	  mkdir -p $(d_tk)/usr/lib/python3.13/lib-dynload; \
	  mv $(d_tk)/usr/lib/python3/dist-packages/*.so \
	    $(d_tk)/usr/lib/python3.13/lib-dynload; \
	  rm -rf $(d_tk)/usr/lib/python3/dist-packages; \
	else \
	  cd 3.13 && $(SET_ENV13) python3.13-dbg setup.py install \
		--root=$(CURDIR)/$(d_tk)-dbg --install-layout=deb; \
	fi
	mkdir -p $(d_tk)-dbg/usr/lib/python3.13/lib-dynload
	mv $(d_tk)-dbg/usr/lib/python3/*-packages/*.so \
		$(d_tk)-dbg/usr/lib/python3.13/lib-dynload/
	mkdir -p $(d_gdbm)-dbg/usr/lib/python3.13/lib-dynload
	mv $(d_tk)-dbg/usr/lib/python3.13/lib-dynload/_gdbm*.so \
		$(d_gdbm)-dbg/usr/lib/python3.13/lib-dynload/
  ifeq ($(with_dbmmodule),yes)
	if [ -f $(d_tk)-dbg/usr/lib/python3.13/lib-dynload/_dbm*.so ]; then \
	  mv $(d_tk)-dbg/usr/lib/python3.13/lib-dynload/_dbm*.so \
		$(d_gdbm)-dbg/usr/lib/python3.13/lib-dynload/; \
	fi
  endif
	rm -rf $(d_tk)-dbg/usr/lib/python3
endif

SPACE := $(EMPTY) $(EMPTY)
COMMA := ,
# $(call _pyver,<prefix>,<versions>,<suffix>)
_pyver = $(subst $(SPACE),$(COMMA)$(SPACE),$(strip $(foreach v,$2,$1$(v)$3)))
#
# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
#	dh_installdocs -p$(p_2to3) debian/README.Debian
#	( \
#	  echo 'python3:Depends=python3:any (>= $(MIN_VER)), python3:any (<< $(NEXT_VER))'; \
#	  echo 'python3:Versions=$(call _pyver,,$(PYVERS),)'; \
#	  echo 'python3:Provides=$(call _pyver,python,$(PYVERS),-lib2to3)'; \
#	) >> debian/python3-lib2to3.substvars

	dh_lintian -i
	dh_compress -i
	dh_fixperms -i
#	sed 's/@PYVERS@/$(PYVERS)/' debian/python3-lib2to3.postinst.in \
#	  > debian/python3-lib2to3.postinst
	dh_installdeb -i
	dh_shlibdeps -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

# Build architecture-dependent files here.
binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -a
	dh_installdocs -p$(p_gdbm) -p$(p_tk) debian/README.Debian
	rm -rf $(d_gdbm)-dbg/usr/share/doc/$(p_gdbm)-dbg
	ln -s $(p_gdbm) $(d_gdbm)-dbg/usr/share/doc/$(p_gdbm)-dbg
	rm -rf $(d_tk)-dbg/usr/share/doc/$(p_tk)-dbg
	ln -s $(p_tk) $(d_tk)-dbg/usr/share/doc/$(p_tk)-dbg
#	dh_strip -p$(p_gdbm) --dbg-package=$(p_gdbm)-dbg
#	dh_strip -p$(p_tk) --dbg-package=$(p_tk)-dbg

	( \
	  echo 'python3:Depends=python3 (>= $(MIN_VER)), python3 (<< $(NEXT_VER))'; \
	  echo 'python3:Versions=$(call _pyver,,$(PYVERS),)'; \
	  echo 'python3:Provides=$(call _pyver,python,$(PYVERS),-gdbm)'; \
	  echo 'gdbm:Depends=$(call _pyver,python,$(PYVERS),-gdbm)'; \
	) >> debian/python3-gdbm.substvars
	( \
	  echo 'python3:Depends=python3 (>= $(MIN_VER)), python3 (<< $(NEXT_VER))'; \
	  echo 'python3:Versions=$(call _pyver,,$(PYVERS),)'; \
	  echo 'python3:Provides=$(call _pyver,python,$(PYVERS),-tk)'; \
	  echo 'tk:Depends=$(call _pyver,python,$(PYVERS),-tk)'; \
	) >> debian/python3-tk.substvars

	dh_lintian -a
	dh_compress -a
	dh_fixperms -a
	sed 's/@PYVERS@/$(PYVERS)/' debian/python3-tk.postinst.in \
	  > debian/python3-tk.postinst
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a -- $(dbm_breaks) $(dbmdbg_breaks)
	dh_md5sums -a
	dh_builddeb -a

binary: binary-indep binary-arch

update-patches:
	export QUILT_PATCHES=debian/patches; \
	while quilt push; do quilt refresh -pab --no-timestamps --no-index; done

.PHONY: build clean binary-indep binary-arch binary install