~certify-web-dev/twisted/certify-trunk

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
#! /usr/bin/make -f

SHELL = /bin/bash

# all versions
PYVERS	:= $(shell pyversions -vs)
VER	:= $(shell /usr/bin/python -c 'import sys; print sys.version[:3]')

gamesdir = debian/twisted-quotes/usr/share/games/fortunes

build: build-stamp
build-stamp: $(PYVERS:%=build-python%)
	touch $@
build-python%:
	python$* setup.py build
	python$*-dbg setup.py build
	touch $@

clean:
	rm -rf *-stamp build-python* build
	rm -rf $(addprefix debian/,$(packages)) debian/files debian/substvars
	rm -rf _trial_temp test.log
	find . -name "*.pyc" |xargs -r rm
	dh_clean

install: build-stamp install-prereq $(PYVERS:%=install-python%) install-nover

install-prereq: build-stamp
	dh_testdir
	dh_testroot
	dh_clean -k

install-python%: install-prereq
	: # python-twisted-core
	python$* setup.py install --root=debian/python-twisted-core
	-find debian/python-twisted-core -name '*.py[co]' | xargs rm -f
#	for i in debian/python$*-twisted-core/usr/bin/*; do \
#	  mv $$i $${i}$*; \
#	done
#	mkdir -p debian/python$*-twisted-core/usr/share/man/man1
#	for i in doc/man/{manhole,*tap*,trial,twistd}.1; do \
#	  iv=`basename $$i .1`$*.1; \
#	  cp -p $$i debian/python$*-twisted-core/usr/share/man/man1/$$iv; \
#	done
	case $* in \
	  1.5|2.0|2.1|2.2) ;; \
	  *) rm -rf debian/python-twisted-core/usr/lib/python$*/site-packages/twisted/python/pymodules; \
	esac

	: # python-twisted-bin
	dh_movefiles -ppython-twisted-bin \
	  --sourcedir=debian/python-twisted-core \
	    usr/lib/python$*/site-packages/twisted/protocols/_c_urlarg.so \
	    usr/lib/python$*/site-packages/twisted/python/_epoll.so

	: # Replace all '#!' calls to python with /usr/bin/python
	: # and make them executable
	for i in `find debian/python-twisted-* -mindepth 3 -type f`; do \
	  sed '1s,#!.*python[^ ]*\(.*\),#! /usr/bin/python\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

	: # python-twisted-bin-dbg
	python$*-dbg setup.py install --root=debian/python-twisted-bin-dbg --no-compile
	find debian/python-twisted-bin-dbg ! -type d ! -name '*_d.so' | xargs rm -f
	find debian/python-twisted-bin-dbg -depth -empty -exec rmdir {} \;

install-nover:
	: # twisted-doc
	mkdir -p debian/twisted-doc/usr/share/doc/twisted-doc
	cp -a doc/* debian/twisted-doc/usr/share/doc/twisted-doc/
	-find debian/twisted-doc -type d -name man | xargs rm -rf

	mkdir -p debian/python-twisted-core/usr/share/man/man1
	for i in doc/man/{manhole,*tap*,trial,twistd}.1; do \
	  cp -p $$i debian/python-twisted-core/usr/share/man/man1/; \
	done

#	: # python-twisted-core
#	mkdir -p debian/python-twisted-core/usr/bin
#	for i in debian/python$(VER)-twisted-core/usr/bin/*; do \
#	  iv=`basename $$i $(VER)`; \
#	  ln -sf $${iv}$(VER) debian/python-twisted-core/usr/bin/$$iv; \
#	done
#	mkdir -p debian/python-twisted-core/usr/share/man/man1
#	for i in debian/python$(VER)-twisted-core/usr/share/man/man1/*; do \
#	  iv=`basename $$i $(VER).1`; \
#	  ln -sf $${iv}$(VER).1.gz \
#	    debian/python-twisted-core/usr/share/man/man1/$$iv.1.gz; \
#	done

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
	dh_installdocs -i
	rm -rf debian/twisted-doc-api/usr/share/doc/twisted-doc-api
	ln -s twisted-doc debian/twisted-doc-api/usr/share/doc/twisted-doc-api
	dh_installmenu -i
	dh_compress -i -X.py
	dh_fixperms -i
	dh_pycentral -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary-arch: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -a
	dh_installdocs -a
	dh_installmenu -a
	dh_strip -ppython-twisted-bin --dbg-package=python-twisted-bin-dbg
	rm -rf debian/python-twisted-bin-dbg/usr/share/doc/python-twisted-bin-dbg
	ln -s python-twisted-bin \
	    debian/python-twisted-bin-dbg/usr/share/doc/python-twisted-bin-dbg
	dh_compress -a -X.py
	dh_fixperms -a
	dh_pycentral -a
	dh_installdeb -a
	dh_shlibdeps -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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