File: rules

package info (click to toggle)
twisted 12.0.0-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 9,720 kB
  • sloc: python: 78,364; ansic: 179; makefile: 113; sh: 34
file content (136 lines) | stat: -rwxr-xr-x 4,016 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
#! /usr/bin/make -f

SHELL = /bin/bash

DEB_HOST_ARCH_OS ?=  $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

# 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

twersion := $(subst twisted-,,$(notdir $(CURDIR)))

include /usr/share/python/python.mk

build: build-stamp
build-arch: build-stamp
build-indep: 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_prep

install-python%: install-prereq
	: # python-twisted-core
	python$* setup.py install --root=debian/python-twisted-core --install-layout=deb

	-find debian/python-twisted-core -name '*.py[co]' | xargs rm -f
	case $* in \
	  1.5|2.0|2.1|2.2) ;; \
	  *) rm -rf debian/python-twisted-core/usr/lib/python$*/*-packages/twisted/python/pymodules; \
	esac

	: # python-twisted-bin
ifeq ($(DEB_HOST_ARCH_OS), linux)
	dh_movefiles -ppython-twisted-bin \
	  --sourcedir=debian/python-twisted-core \
	    $(call py_libdir,$*)/twisted/internet/_sigchld.so \
	    $(call py_libdir,$*)/twisted/python/_epoll.so \
	    $(call py_libdir,$*)/twisted/python/_initgroups.so \
	    $(call py_libdir,$*)/twisted/test/raiser.so
else
	dh_movefiles -ppython-twisted-bin \
	  --sourcedir=debian/python-twisted-core \
	    $(call py_libdir,$*)/twisted/internet/_sigchld.so \
	    $(call py_libdir,$*)/twisted/python/_initgroups.so \
	    $(call py_libdir,$*)/twisted/test/raiser.so
endif

	: # python-twisted
	mkdir -p debian/python-twisted/$(call py_libdir,$*)
	sed 's/@twersion@/$(twversion)/' debian/Twisted.egg-info.in \
		> debian/python-twisted/$(call py_libdir,$*)/Twisted-$(twersion).egg-info

	: # 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 --install-layout=deb
	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,pyhtmlizer}.1; do \
	  cp -p $$i debian/python-twisted-core/usr/share/man/man1/; \
	done

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs -i
	dh_installdocs -i
	dh_installmenu -i
	dh_compress -i -X.py
	dh_fixperms -i
	dh_python2 -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_python2 -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