File: rules

package info (click to toggle)
twisted 24.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,364 kB
  • sloc: python: 202,047; makefile: 200; sh: 92; xml: 31
file content (76 lines) | stat: -rwxr-xr-x 2,498 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# -*- makefile -*-

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

SHELL = /bin/bash

export PYBUILD_NAME=twisted
# Don't do any testing while build, it's done within autopkgtesting.
export PYBUILD_DISABLE=test
export PYBUILD_AFTER_INSTALL=rm -rf {destdir}/usr/lib/python3*/dist-packages/twisted/internet/iocpreactor/notes.txt

%:
	dh $@ --with sphinxdoc --buildsystem=pybuild

execute_before_dh_clean:
	rm -rf *-stamp build tmp
	rm -rf docs/_build build-doc
	rm -rf build3-python*
	rm -rf $(addprefix debian/,$(packages)) debian/files debian/substvars
	rm -rf _trial_temp test.log
	rm -f twisted/plugins/dropin.cache
	find -name '__pycache__' -type d | xargs -r rm -rf
	find . -name "*.pyc" |xargs -r rm

override_dh_sphinxdoc:
ifeq (,$(findstring nodoc, $(DEB_BUILD_OPTIONS)))
	PYTHONPATH=src python3 -m sphinx -b html -N docs/ $(CURDIR)/debian/twisted-doc/usr/share/doc/twisted-doc/html
	dh_sphinxdoc
	cp -a docs/core/* debian/twisted-doc/usr/share/doc/twisted-doc/
	-find debian/twisted-doc -type d -name man | xargs rm -rf
	# Replace all '#!' calls to python with /usr/bin/python3 and make them
	# NON executable.
	for i in `find debian/twisted-doc -mindepth 3 -type f`; do \
	  sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \
	    $${i} > $${i}.temp; \
	  if cmp --quiet $${i} $${i}.temp; then \
	    rm -f $${i}.temp; \
	  else \
	    mv -f $${i}.temp $${i}; \
	    chmod 644 $${i}; \
	    echo "fixed interpreter: $${i}"; \
	  fi; \
	done
endif

execute_after_dh_auto_install:
	find debian/python3-twisted -name '__pycache__' | xargs -r rm -rf
	find debian/python3-twisted -name .gitignore -delete
	# Replace all '#!' calls to python with /usr/bin/python3 and make them
	# executable.
	for i in `find debian/python3-twisted -mindepth 3 -type f`; do \
	  sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python3\1,' \
	    $${i} > $${i}.temp; \
	  if cmp --quiet $${i} $${i}.temp; then \
	    rm -f $${i}.temp; \
	  else \
	    mv -f $${i}.temp $${i}; \
	    chmod 755 $${i}; \
	    echo "fixed interpreter: $${i}"; \
	  fi; \
	done
	# Tune Python3 man pages.
	for i in debian/python3-twisted/usr/bin/*; do \
	  mv $${i} $${i}3; \
	done
	mkdir -p debian/python3-twisted/usr/share/man/man1
	for i in docs/core/man/{trial,twistd}.1; do \
	  i2=$$(basename $${i} .1)3.1; \
	  cp -p $${i} debian/python3-twisted/usr/share/man/man1/$${i2}; \
	done

override_dh_compress:
	# Don't compress an Python files. Especially not in twisted-doc.
	dh_compress -i -X.py